Revert my previous change on Local.cpp, instead, fix the bug on scalarrepl.
authorZhou Sheng <zhousheng00@gmail.com>
Wed, 18 Mar 2009 10:13:08 +0000 (10:13 +0000)
committerZhou Sheng <zhousheng00@gmail.com>
Wed, 18 Mar 2009 10:13:08 +0000 (10:13 +0000)
If the instruction has no users, it is also not only used by debug info
and should not be deleted.

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

lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Utils/Local.cpp

index 78730b6eb7230d35d7f5e4c52638a26210ae5f53..358b0981cc8eac29b5caf86b020e6f215061b494 100644 (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();
index 468136c9968f06405fe4092a9e06e0701abf7402..4be1b8717d28d3916f2e93f96454c15866842829 100644 (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)) {