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
This commit is contained in:
Zhou Sheng 2009-03-18 10:13:08 +00:00
parent a2aedc6943
commit 05bea906c1
2 changed files with 1 additions and 4 deletions

View File

@ -1223,7 +1223,7 @@ void SROA::CleanupAllocaUsers(AllocationInst *AI) {
CleanupGEP(GEPI);
else if (Instruction *I = dyn_cast<Instruction>(U)) {
SmallVector<DbgInfoIntrinsic *, 2> 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();

View File

@ -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<DbgInfoIntrinsic>(*UI)) {