diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-11-17 18:05:34 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-11-17 18:05:34 +0000 |
commit | 80ccd9ea59b8911f12836da98aceedce4ebc6a6f (patch) | |
tree | c6b7b48be113b0c88677e17436da7b30368dc426 /lib | |
parent | c8dc96be28fd1a3d6ddebbb48b8d55b61e4bd89b (diff) | |
download | external_llvm-80ccd9ea59b8911f12836da98aceedce4ebc6a6f.zip external_llvm-80ccd9ea59b8911f12836da98aceedce4ebc6a6f.tar.gz external_llvm-80ccd9ea59b8911f12836da98aceedce4ebc6a6f.tar.bz2 |
Utils/LoopUnroll.cpp: Tweak (StringRef)OldName to be valid until it is used, since r194601.
eraseFromParent() invalidates OldName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Utils/LoopUnroll.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/LoopUnroll.cpp b/lib/Transforms/Utils/LoopUnroll.cpp index 9955bfd..162807d 100644 --- a/lib/Transforms/Utils/LoopUnroll.cpp +++ b/lib/Transforms/Utils/LoopUnroll.cpp @@ -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; } |