forked from OSchip/llvm-project
Utils/LoopUnroll.cpp: Tweak (StringRef)OldName to be valid until it is used, since r194601.
eraseFromParent() invalidates OldName. llvm-svn: 194970
This commit is contained in:
parent
b90f560303
commit
f9c8339a4e
|
@ -90,6 +90,7 @@ static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI,
|
|||
// Move all definitions in the successor to the predecessor...
|
||||
OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
|
||||
|
||||
// OldName will be valid until erased.
|
||||
StringRef OldName = BB->getName();
|
||||
|
||||
// Erase basic block from the function...
|
||||
|
@ -102,12 +103,13 @@ static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI,
|
|||
}
|
||||
}
|
||||
LI->removeBlock(BB);
|
||||
BB->eraseFromParent();
|
||||
|
||||
// Inherit predecessor's name if it exists...
|
||||
if (!OldName.empty() && !OnlyPred->hasName())
|
||||
OnlyPred->setName(OldName);
|
||||
|
||||
BB->eraseFromParent();
|
||||
|
||||
return OnlyPred;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue