From: Fangrui Song Date: Sun, 14 Apr 2019 06:27:07 +0000 (+0000) Subject: [Mem2Reg] Don't call LBI.deleteValue on AllocInst/DbgVariableIntrinsic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a526661d0f8c38f218126653d0277d4a1acd7316;p=llvm [Mem2Reg] Don't call LBI.deleteValue on AllocInst/DbgVariableIntrinsic 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 --- diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 28462e8c8b6..bdf1c209d59 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -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;