summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-25 00:55:12 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-25 00:55:12 +0000
commit115455e435bee444b3be39026b6706e1a074b2c5 (patch)
treedaf799314a05a6c4f69557416c133d4a3a71119d /include
parent7360cd168a1f0aac78dac31feeb2f0addaa400f3 (diff)
The absence of noreturn doesn't ensure mayReturn
There are two separate issues: - LLVM doesn't consider infinite loops to be side effects: we happily hoist/sink above/below loops whose bounds are unknown. - The absence of the noreturn attribute is insufficient for us to know if a function will definitely return. Relying on noreturn in the middle-end for any property is an accident waiting to happen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273762 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/Instruction.h10
1 files changed, 1 insertions, 9 deletions
diff --git a/include/llvm/IR/Instruction.h b/include/llvm/IR/Instruction.h
index ea262def2c2..efcd26cc30f 100644
--- a/include/llvm/IR/Instruction.h
+++ b/include/llvm/IR/Instruction.h
@@ -394,21 +394,13 @@ public:
/// Return true if this instruction may throw an exception.
bool mayThrow() const;
- /// Return true if this is a function that may return.
- /// This is true for all normal instructions. The only exception
- /// is functions that are marked with the 'noreturn' attribute.
- ///
- bool mayReturn() const;
-
/// Return true if the instruction may have side effects.
///
/// Note that this does not consider malloc and alloca to have side
/// effects because the newly allocated memory is completely invisible to
/// instructions which don't use the returned value. For cases where this
/// matters, isSafeToSpeculativelyExecute may be more appropriate.
- bool mayHaveSideEffects() const {
- return mayWriteToMemory() || mayThrow() || !mayReturn();
- }
+ bool mayHaveSideEffects() const { return mayWriteToMemory() || mayThrow(); }
/// Return true if the instruction is a variety of EH-block.
bool isEHPad() const {