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 | aa295aa7a6f2fb1bd2c86ad3d3d42ccf9fd59aaa (patch) | |
tree | d1172f014f0021a86adc76b5fc995f5bf23fce61 /lib/Transforms | |
parent | 5ade9e8bc38ae6cc1a5f006b28dc2fe603a271c3 (diff) | |
download | external_llvm-aa295aa7a6f2fb1bd2c86ad3d3d42ccf9fd59aaa.zip external_llvm-aa295aa7a6f2fb1bd2c86ad3d3d42ccf9fd59aaa.tar.gz external_llvm-aa295aa7a6f2fb1bd2c86ad3d3d42ccf9fd59aaa.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index c76403e..527ed43 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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); |