From 05bea906c181f7cc22bdfd96194a35337259586a Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Wed, 18 Mar 2009 10:13:08 +0000 Subject: [PATCH] Revert my previous change on Local.cpp, instead, fix the bug on scalarrepl. If the instruction has no users, it is also not only used by debug info and should not be deleted. llvm-svn: 67194 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 2 +- llvm/lib/Transforms/Utils/Local.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 78730b6eb723..358b0981cc8e 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1223,7 +1223,7 @@ void SROA::CleanupAllocaUsers(AllocationInst *AI) { CleanupGEP(GEPI); else if (Instruction *I = dyn_cast(U)) { SmallVector DbgInUses; - if (OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) { + if (!I->use_empty() && OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) { // Safe to remove debug info uses. while (!DbgInUses.empty()) { DbgInfoIntrinsic *DI = DbgInUses.back(); DbgInUses.pop_back(); diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 468136c9968f..4be1b8717d28 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -262,9 +262,6 @@ bool llvm::OnlyUsedByDbgInfoIntrinsics(Instruction *I, if (DbgInUses) DbgInUses->clear(); - if (I->use_empty()) - return false; - for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE; ++UI) { if (DbgInfoIntrinsic *DI = dyn_cast(*UI)) {