diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-02-19 20:02:09 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-02-19 20:02:09 +0000 |
commit | 03544ec2a43fab162d25cf44627d1d08430bcccd (patch) | |
tree | f2fba81aeee9fe84179a7af0dbdfcfe078b2e8f8 /include/llvm/IR/Instruction.h | |
parent | a175396816a9b28835acfe2cd07250881f1fee6c (diff) |
Fix a bug in mayHaveSideEffects. Functions that do not return are now considered as instructions with side effects.
rdar://13227456
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/IR/Instruction.h')
-rw-r--r-- | include/llvm/IR/Instruction.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/llvm/IR/Instruction.h b/include/llvm/IR/Instruction.h index e5e5f96d56..5721d8f2f3 100644 --- a/include/llvm/IR/Instruction.h +++ b/include/llvm/IR/Instruction.h @@ -309,6 +309,12 @@ public: /// bool mayThrow() const; + /// mayReturn - 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; + /// mayHaveSideEffects - Return true if the instruction may have side effects. /// /// Note that this does not consider malloc and alloca to have side @@ -316,7 +322,7 @@ public: /// instructions which don't used the returned value. For cases where this /// matters, isSafeToSpeculativelyExecute may be more appropriate. bool mayHaveSideEffects() const { - return mayWriteToMemory() || mayThrow(); + return mayWriteToMemory() || mayThrow() || !mayReturn(); } /// clone() - Create a copy of 'this' instruction that is identical in all |