From: Nick Lewycky Date: Tue, 24 Jul 2012 21:33:00 +0000 (+0000) Subject: Don't delete one more instruction than we're allowed to. This should fix the X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=952f5d562c40bc19147df4fbf3415069659236d1;p=oota-llvm.git Don't delete one more instruction than we're allowed to. This should fix the Darwin bootstrap. Testcase exists but isn't fully reduced, I expect to commit the testcase this evening. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160693 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 60ce958de0d..72623a36e50 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -442,12 +442,14 @@ static bool CleanupPointerRootUsers(GlobalVariable *GV) { Dead[i].second->eraseFromParent(); Instruction *I = Dead[i].first; do { + if (isAllocationFn(I)) + break; Instruction *J = dyn_cast(I->getOperand(0)); if (!J) break; I->eraseFromParent(); I = J; - } while (!isAllocationFn(I)); + } while (1); I->eraseFromParent(); } }