[Mem2Reg] Don't call LBI.deleteValue on AllocInst/DbgVariableIntrinsic

Only StoreInst/LoadInst are assigned numbers. Other types of instructions are not in LBI.

llvm-svn: 358350
This commit is contained in:
Fangrui Song 2019-04-14 06:27:07 +00:00
parent 8f9bb2250b
commit f42990e687
1 changed files with 1 additions and 6 deletions

View 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;