It's not safe to blindly remove invoke instructions. This happens when we
authorNick Lewycky <nicholas@mxc.ca>
Wed, 25 Jul 2012 21:19:40 +0000 (21:19 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 25 Jul 2012 21:19:40 +0000 (21:19 +0000)
encounter an invoke of an allocation function. This should fix the dragonegg
bootstrap. Testcase to follow, later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160757 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalOpt.cpp

index 72623a36e509b51600a91dbc0a226204250131f6..6d950d20240a3bf80e3c2514ab24270f59129330 100644 (file)
@@ -352,7 +352,8 @@ static bool IsSafeComputationToRemove(Value *V) {
       return true;
     if (!V->hasOneUse())
       return false;
-    if (isa<LoadInst>(V) || isa<Argument>(V) || isa<GlobalValue>(V))
+    if (isa<LoadInst>(V) || isa<InvokeInst>(V) || isa<Argument>(V) ||
+        isa<GlobalValue>(V))
       return false;
     if (isAllocationFn(V))
       return true;