diff options
author | Clement Courbet <courbet@google.com> | 2017-09-01 09:07:05 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2017-09-01 09:07:05 +0000 |
commit | 9473c01e968bc4ecf5ea7c54ef0c84b687d365ea (patch) | |
tree | 9e04b30b7f8eb3e0cf2b85a997419c352005ccbc /llvm/lib/CodeGen | |
parent | b16598d54fe050fcc576860d4b79a3d617b51dea (diff) | |
download | bcm5719-llvm-9473c01e968bc4ecf5ea7c54ef0c84b687d365ea.tar.gz bcm5719-llvm-9473c01e968bc4ecf5ea7c54ef0c84b687d365ea.zip |
[MergeICmps] MergeICmps is a new optimization pass that turns chains of integer
comparisons into memcmp.
Thanks to recent improvements in the LLVM codegen, the memcmp is typically
inlined as a chain of efficient hardware comparisons.
This typically benefits C++ member or nonmember operator==().
For now this is disabled by default until:
- https://bugs.llvm.org/show_bug.cgi?id=33329 is complete
- Benchmarks show that this is always useful.
Differential Revision:
https://reviews.llvm.org/D33987
llvm-svn: 312315
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 481baea2dff..329768769f1 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -94,6 +94,10 @@ static cl::opt<bool> EnableImplicitNullChecks( "enable-implicit-null-checks", cl::desc("Fold null checks into faulting memory operations"), cl::init(false)); +static cl::opt<bool> EnableMergeICmps( + "enable-mergeicmps", + cl::desc("Merge ICmp chains into a single memcmp"), + cl::init(false)); static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden, cl::desc("Print LLVM IR produced by the loop-reduce pass")); static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden, @@ -591,6 +595,10 @@ void TargetPassConfig::addIRPasses() { addPass(createPrintFunctionPass(dbgs(), "\n\n*** Code after LSR ***\n")); } + if (getOptLevel() != CodeGenOpt::None && EnableMergeICmps) { + addPass(createMergeICmpsPass()); + } + // Run GC lowering passes for builtin collectors // TODO: add a pass insertion point here addPass(createGCLoweringPass()); |