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
diff --git a/lib/IR/Instruction.cpp b/lib/IR/Instruction.cpp
index 42df5d7..2b5a0b3 100644
--- a/lib/IR/Instruction.cpp
+++ b/lib/IR/Instruction.cpp
@@ -455,14 +455,18 @@
}
}
-/// 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