summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-01 18:04:58 +0000
committerChris Lattner <sabre@nondot.org>2010-02-01 18:04:58 +0000
commit2cecedf0819233a3013d1e6ce3d81f5ced0448b8 (patch)
tree770612b5e6dcc7ec31d48c7d6fac54f42c9d9278 /llvm/lib
parentf65ba356e12514ff868154b6c29443394258db01 (diff)
downloadbcm5719-llvm-2cecedf0819233a3013d1e6ce3d81f5ced0448b8.tar.gz
bcm5719-llvm-2cecedf0819233a3013d1e6ce3d81f5ced0448b8.zip
fix rdar://7590304, an infinite loop in instcombine. In the invoke
case, instcombine can't zap the invoke for fear of changing the CFG. However, we have to do something to prevent the next iteration of instcombine from inserting another store -> undef before the invoke thereby getting into infinite iteration between dead store elim and store insertion. Just zap the callee to null, which will prevent the next iteration from doing anything. llvm-svn: 94985
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 47c37c46587..9c420c83873 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -703,8 +703,13 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
// This allows ValueHandlers and custom metadata to adjust itself.
if (!OldCall->getType()->isVoidTy())
OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
- if (isa<CallInst>(OldCall)) // Not worth removing an invoke here.
+ if (isa<CallInst>(OldCall))
return EraseInstFromFunction(*OldCall);
+
+ // We cannot remove an invoke, because it would change the CFG, just
+ // change the callee to a null pointer.
+ cast<InvokeInst>(OldCall)->setOperand(0,
+ Constant::getNullValue(CalleeF->getType()));
return 0;
}
OpenPOWER on IntegriCloud