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 /lib | |
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 'lib')
-rw-r--r-- | lib/IR/Instruction.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/IR/Instruction.cpp b/lib/IR/Instruction.cpp index 42df5d7118..2b5a0b39c3 100644 --- a/lib/IR/Instruction.cpp +++ b/lib/IR/Instruction.cpp @@ -455,14 +455,18 @@ bool Instruction::mayWriteToMemory() const { } } -/// mayThrow - Return true if this instruction may throw an exception. -/// bool Instruction::mayThrow() const { if (const CallInst *CI = dyn_cast<CallInst>(this)) return !CI->doesNotThrow(); return isa<ResumeInst>(this); } +bool Instruction::mayReturn() const { + if (const CallInst *CI = dyn_cast<CallInst>(this)) + return !CI->doesNotReturn(); + return true; +} + /// isAssociative - Return true if the instruction is associative: /// /// Associative operators satisfy: x op (y op z) === (x op y) op z |