llvm-6502/lib/Transforms/InstCombine
Benjamin Kramer 9589ff8949 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238602 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:43:39 +00:00
..
CMakeLists.txt Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects. 2015-02-11 03:28:02 +00:00
InstCombineAddSub.cpp [ValueTracking] refactor: extract method haveNoCommonBitsSet 2015-05-14 23:53:19 +00:00
InstCombineAndOrXor.cpp [ConstantRange] Split makeICmpRegion in two. 2015-03-18 00:41:24 +00:00
InstCombineCalls.cpp [InstSimplify] Handle some overflow intrinsics in InstSimplify 2015-05-22 03:56:46 +00:00
InstCombineCasts.cpp Reapply r237539 with a fix for the Chromium build. 2015-05-20 18:41:25 +00:00
InstCombineCompares.cpp [InstSimplify] Handle some overflow intrinsics in InstSimplify 2015-05-22 03:56:46 +00:00
InstCombineInternal.h Rip min/max pattern matching out of InstCombine and into 2015-05-11 14:42:20 +00:00
InstCombineLoadStoreAlloca.cpp [InstCombine] Fold IntToPtr and PtrToInt into preceding loads. 2015-05-28 18:39:17 +00:00
InstCombineMulDivRem.cpp [InstCombine] (mul nsw 1, INT_MIN) != (shl nsw 1, 31) 2015-04-18 04:41:30 +00:00
InstCombinePHI.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
InstCombineSelect.cpp Reapply r237539 with a fix for the Chromium build. 2015-05-20 18:41:25 +00:00
InstCombineShifts.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
InstCombineSimplifyDemanded.cpp Reapply r237539 with a fix for the Chromium build. 2015-05-20 18:41:25 +00:00
InstCombineVectorOps.cpp [InstCombine] Use DataLayout to determine vector element width 2015-04-03 20:18:40 +00:00
InstructionCombining.cpp Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types 2015-05-29 19:43:39 +00:00
LLVMBuild.txt Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00
Makefile