]> granicus.if.org Git - llvm/commitdiff
[Mem2Reg] Don't call LBI.deleteValue on AllocInst/DbgVariableIntrinsic
authorFangrui Song <maskray@google.com>
Sun, 14 Apr 2019 06:27:07 +0000 (06:27 +0000)
committerFangrui Song <maskray@google.com>
Sun, 14 Apr 2019 06:27:07 +0000 (06:27 +0000)
Only StoreInst/LoadInst are assigned numbers. Other types of instructions are not in LBI.

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

lib/Transforms/Utils/PromoteMemoryToRegister.cpp

index 28462e8c8b65ab34e16d5dcf91b866d6ae00e232..bdf1c209d59d9e5fbef1f3f67cef9f575daee617 100644 (file)
@@ -421,14 +421,12 @@ static bool rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info,
     DIBuilder DIB(*AI->getModule(), /*AllowUnresolved*/ false);
     ConvertDebugDeclareToDebugValue(DII, Info.OnlyStore, DIB);
     DII->eraseFromParent();
-    LBI.deleteValue(DII);
   }
   // Remove the (now dead) store and alloca.
   Info.OnlyStore->eraseFromParent();
   LBI.deleteValue(Info.OnlyStore);
 
   AI->eraseFromParent();
-  LBI.deleteValue(AI);
   return true;
 }
 
@@ -526,13 +524,10 @@ static bool promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
   }
 
   AI->eraseFromParent();
-  LBI.deleteValue(AI);
 
   // The alloca's debuginfo can be removed as well.
-  for (DbgVariableIntrinsic *DII : Info.DbgDeclares) {
+  for (DbgVariableIntrinsic *DII : Info.DbgDeclares)
     DII->eraseFromParent();
-    LBI.deleteValue(DII);
-  }
 
   ++NumLocalPromoted;
   return true;