diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-17 16:48:30 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-17 16:48:30 +0000 |
commit | 57772dcbacdf8a32239cd49254b374c33a8b72af (patch) | |
tree | ed778ce0079163867386c6940814c08ec5ac86f6 /lib/CodeGen/CGCleanup.cpp | |
parent | 51108a12a34f0084c701ee0a58b1045058214d24 (diff) |
Prefer SmallVector::append/insert over push_back loops. Clang edition.
Same functionality, but hoists the vector growth out of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCleanup.cpp')
-rw-r--r-- | lib/CodeGen/CGCleanup.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/CodeGen/CGCleanup.cpp b/lib/CodeGen/CGCleanup.cpp index 566befc915..f7971f687c 100644 --- a/lib/CodeGen/CGCleanup.cpp +++ b/lib/CodeGen/CGCleanup.cpp @@ -731,7 +731,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { } llvm::BasicBlock *FallthroughDest = nullptr; - SmallVector<llvm::Instruction*, 2> InstsToAppend; + llvm::BasicBlock::InstListType InstsToAppend; // If there's exactly one branch-after and no other threads, // we can route it without a switch. @@ -796,8 +796,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // Append the prepared cleanup prologue from above. llvm::BasicBlock *NormalExit = Builder.GetInsertBlock(); - for (unsigned I = 0, E = InstsToAppend.size(); I != E; ++I) - NormalExit->getInstList().push_back(InstsToAppend[I]); + NormalExit->getInstList().splice(NormalExit->end(), InstsToAppend); // Optimistically hope that any fixups will continue falling through. for (unsigned I = FixupDepth, E = EHStack.getNumBranchFixups(); |