diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-06 14:25:16 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-06 14:25:16 +0000 |
commit | 77c4ef8a47ef30d826bf56eb81d4059f4813ace1 (patch) | |
tree | 11a5805f8cb4c0c6dcf234a1bbcf92eeb48bf374 | |
parent | 58c1da84f27d7821a75d41bed6e28c76fba8b64d (diff) | |
download | llvm-77c4ef8a47ef30d826bf56eb81d4059f4813ace1.tar.gz llvm-77c4ef8a47ef30d826bf56eb81d4059f4813ace1.tar.bz2 llvm-77c4ef8a47ef30d826bf56eb81d4059f4813ace1.tar.xz |
Switch the select to branch transformation on by default.
The primitive conservative heuristic seems to give a slight overall
improvement while not regressing stuff. Make it available to wider
testing. If you notice any speed regressions (or significant code
size regressions) let me know!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156258 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 7 | ||||
-rw-r--r-- | test/CodeGen/X86/cmov-into-branch.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/cmov.ll | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 291274d715..24d64b50c2 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -71,8 +71,9 @@ static cl::opt<bool> DisableDeleteDeadBlocks( "disable-cgp-delete-dead-blocks", cl::Hidden, cl::init(false), cl::desc("Disable deleting dead blocks in CodeGenPrepare")); -static cl::opt<bool> EnableSelectToBranch("enable-cgp-select2branch", cl::Hidden, - cl::desc("Enable select to branch conversion.")); +static cl::opt<bool> DisableSelectToBranch( + "disable-cgp-select2branch", cl::Hidden, cl::init(false), + cl::desc("Disable select to branch conversion.")); namespace { class CodeGenPrepare : public FunctionPass { @@ -1132,7 +1133,7 @@ static bool isFormingBranchFromSelectProfitable(SelectInst *SI) { bool CodeGenPrepare::OptimizeSelectInst(SelectInst *SI) { // If we have a SelectInst that will likely profit from branch prediction, // turn it into a branch. - if (!EnableSelectToBranch || OptSize || !TLI->isPredictableSelectExpensive()) + if (DisableSelectToBranch || OptSize || !TLI->isPredictableSelectExpensive()) return false; if (!SI->getCondition()->getType()->isIntegerTy(1) || diff --git a/test/CodeGen/X86/cmov-into-branch.ll b/test/CodeGen/X86/cmov-into-branch.ll index 3b450edb3c..780746ab1a 100644 --- a/test/CodeGen/X86/cmov-into-branch.ll +++ b/test/CodeGen/X86/cmov-into-branch.ll @@ -1,4 +1,4 @@ -; RUN: llc -march=x86-64 -mcpu=core2 -enable-cgp-select2branch < %s | FileCheck %s +; RUN: llc -march=x86-64 -mcpu=core2 < %s | FileCheck %s ; cmp with single-use load, should not form cmov. define i32 @test1(double %a, double* nocapture %b, i32 %x, i32 %y) { diff --git a/test/CodeGen/X86/cmov.ll b/test/CodeGen/X86/cmov.ll index 2e7ffbfd54..43beac0b6f 100644 --- a/test/CodeGen/X86/cmov.ll +++ b/test/CodeGen/X86/cmov.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-apple-darwin10 -disable-cgp-select2branch | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" define i32 @test1(i32 %x, i32 %n, i32 %w, i32* %vp) nounwind readnone { |