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...
|
// Move all definitions in the successor to the predecessor...
|
||||||
OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
|
OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
|
||||||
|
|
||||||
|
// OldName will be valid until erased.
|
||||||
StringRef OldName = BB->getName();
|
StringRef OldName = BB->getName();
|
||||||
|
|
||||||
// Erase basic block from the function...
|
// Erase basic block from the function...
|
||||||
|
@ -102,12 +103,13 @@ static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LI->removeBlock(BB);
|
LI->removeBlock(BB);
|
||||||
BB->eraseFromParent();
|
|
||||||
|
|
||||||
// Inherit predecessor's name if it exists...
|
// Inherit predecessor's name if it exists...
|
||||||
if (!OldName.empty() && !OnlyPred->hasName())
|
if (!OldName.empty() && !OnlyPred->hasName())
|
||||||
OnlyPred->setName(OldName);
|
OnlyPred->setName(OldName);
|
||||||
|
|
||||||
|
BB->eraseFromParent();
|
||||||
|
|
||||||
return OnlyPred;
|
return OnlyPred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue