diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-05-13 17:39:14 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-05-13 17:39:14 +0000 |
| commit | 149546a6a0569da1a05395a670200982f3a1e80f (patch) | |
| tree | 26583a8706a20347c0d364d831c30aa956f2008f /llvm/lib/Transforms | |
| parent | 939952c19c99d032a8b3401c5efadd094266f33b (diff) | |
| download | bcm5719-llvm-149546a6a0569da1a05395a670200982f3a1e80f.tar.gz bcm5719-llvm-149546a6a0569da1a05395a670200982f3a1e80f.zip | |
calls in nothrow functions can be marked nothrow even if the callee
is not known to be nothrow. This allows readnone/readonly functions
to be deleted even if we don't know whether the callee can throw.
llvm-svn: 71676
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index c76403e0390..527ed430106 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -9578,6 +9578,16 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) { /// the heavy lifting. /// Instruction *InstCombiner::visitCallInst(CallInst &CI) { + // If the caller function is nounwind, mark the call as nounwind, even if the + // callee isn't. + if (CI.getParent()->getParent()->doesNotThrow() && + !CI.doesNotThrow()) { + CI.setDoesNotThrow(); + return &CI; + } + + + IntrinsicInst *II = dyn_cast<IntrinsicInst>(&CI); if (!II) return visitCallSite(&CI); |

