710 changes: 0 additions & 710 deletions llvm/lib/CodeGen/CodeGenPrepare.cpp

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions llvm/lib/CodeGen/TargetPassConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,14 @@ void TargetPassConfig::addIRPasses() {
addPass(createPrintFunctionPass(dbgs(), "\n\n*** Code after LSR ***\n"));
}

if (getOptLevel() != CodeGenOpt::None && EnableMergeICmps) {
addPass(createMergeICmpsPass());
if (getOptLevel() != CodeGenOpt::None) {
// The MergeICmpsPass tries to create memcmp calls by grouping sequences of
// loads and compares. ExpandMemCmpPass then tries to expand those calls
// into optimally-sized loads and compares. The transforms are enabled by a
// target lowering hook.
if (EnableMergeICmps)
addPass(createMergeICmpsPass());
addPass(createExpandMemCmpPass());
}

// Run GC lowering passes for builtin collectors
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Transforms/Scalar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_llvm_library(LLVMScalarOpts
DeadStoreElimination.cpp
DivRemPairs.cpp
EarlyCSE.cpp
ExpandMemCmp.cpp
FlattenCFGPass.cpp
Float2Int.cpp
GuardWidening.cpp
Expand Down
828 changes: 828 additions & 0 deletions llvm/lib/Transforms/Scalar/ExpandMemCmp.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions llvm/lib/Transforms/Scalar/Scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) {
initializeNewGVNLegacyPassPass(Registry);
initializeEarlyCSELegacyPassPass(Registry);
initializeEarlyCSEMemSSALegacyPassPass(Registry);
initializeExpandMemCmpPassPass(Registry);
initializeGVNHoistLegacyPassPass(Registry);
initializeGVNSinkLegacyPassPass(Registry);
initializeFlattenCFGPassPass(Registry);
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/CodeGen/Generic/llc-start-stop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
; STOP-BEFORE-NOT: Loop Strength Reduction

; RUN: llc < %s -debug-pass=Structure -start-after=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=START-AFTER
; START-AFTER: -machine-branch-prob -gc-lowering
; START-AFTER: -machine-branch-prob -expandmemcmp
; START-AFTER: FunctionPass Manager
; START-AFTER-NEXT: Lower Garbage Collection Instructions
; START-AFTER-NEXT: Expand memcmp() to load/stores

; RUN: llc < %s -debug-pass=Structure -start-before=loop-reduce -o /dev/null 2>&1 | FileCheck %s -check-prefix=START-BEFORE
; START-BEFORE: -machine-branch-prob -domtree
; START-BEFORE: FunctionPass Manager
; START-BEFORE: Loop Strength Reduction
; START-BEFORE-NEXT: Lower Garbage Collection Instructions
; START-BEFORE-NEXT: Expand memcmp() to load/stores

; RUN: not llc < %s -start-before=nonexistent -o /dev/null 2>&1 | FileCheck %s -check-prefix=NONEXISTENT-START-BEFORE
; RUN: not llc < %s -stop-before=nonexistent -o /dev/null 2>&1 | FileCheck %s -check-prefix=NONEXISTENT-STOP-BEFORE
Expand Down
224 changes: 111 additions & 113 deletions llvm/test/CodeGen/X86/memcmp-optsize.ll

Large diffs are not rendered by default.

240 changes: 118 additions & 122 deletions llvm/test/CodeGen/X86/memcmp.ll

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions llvm/test/Transforms/ExpandMemCmp/X86/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if not 'X86' in config.root.targets:
config.unsupported = True

Large diffs are not rendered by default.