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 | f989042f181cbf4d55e74f3ff1a75bc1b765a2a6 (patch) | |
| tree | 3a5a3e33192efd1c94685473edf3b02263c32d00 /clang/lib/CodeGen/CGCleanup.cpp | |
| parent | bc3776803b817e2384e1665cede66133d661c593 (diff) | |
| download | bcm5719-llvm-f989042f181cbf4d55e74f3ff1a75bc1b765a2a6.tar.gz bcm5719-llvm-f989042f181cbf4d55e74f3ff1a75bc1b765a2a6.zip | |
Prefer SmallVector::append/insert over push_back loops. Clang edition.
Same functionality, but hoists the vector growth out of the loop.
llvm-svn: 229508
Diffstat (limited to 'clang/lib/CodeGen/CGCleanup.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGCleanup.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 566befc915c..f7971f687c2 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/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(); |

