diff options
author | Duncan Sands <baldrick@free.fr> | 2009-05-06 06:49:50 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-05-06 06:49:50 +0000 |
commit | 1efabaaa2ad2a90bb2fe7f79461353b5f1ea63e8 (patch) | |
tree | 719834c43dbeab5fa7413c1e2a259167fc6307b0 /llvm/lib/VMCore/Instruction.cpp | |
parent | 51f57a419581f772fb06e4c27128e702373177d9 (diff) | |
download | bcm5719-llvm-1efabaaa2ad2a90bb2fe7f79461353b5f1ea63e8.tar.gz bcm5719-llvm-1efabaaa2ad2a90bb2fe7f79461353b5f1ea63e8.zip |
Allow readonly functions to unwind exceptions. Teach
the optimizers about this. For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.
llvm-svn: 71071
Diffstat (limited to 'llvm/lib/VMCore/Instruction.cpp')
-rw-r--r-- | llvm/lib/VMCore/Instruction.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Instruction.cpp b/llvm/lib/VMCore/Instruction.cpp index f33c1a23f23..9e030b78e9e 100644 --- a/llvm/lib/VMCore/Instruction.cpp +++ b/llvm/lib/VMCore/Instruction.cpp @@ -320,6 +320,14 @@ 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 false; +} + /// isAssociative - Return true if the instruction is associative: /// /// Associative operators satisfy: x op (y op z) === (x op y) op z) |