[llvm-commits] [llvm] r156258 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/cmov-into-branch.ll test/CodeGen/X86/cmov.ll
Benjamin Kramer
benny.kra at googlemail.com
Sun May 6 07:25:16 PDT 2012
Author: d0k
Date: Sun May 6 09:25:16 2012
New Revision: 156258
URL: http://llvm.org/viewvc/llvm-project?rev=156258&view=rev
Log:
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!
Modified:
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
llvm/trunk/test/CodeGen/X86/cmov-into-branch.ll
llvm/trunk/test/CodeGen/X86/cmov.ll
Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=156258&r1=156257&r2=156258&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Sun May 6 09:25:16 2012
@@ -71,8 +71,9 @@
"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 @@
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) ||
Modified: llvm/trunk/test/CodeGen/X86/cmov-into-branch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov-into-branch.ll?rev=156258&r1=156257&r2=156258&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/cmov-into-branch.ll (original)
+++ llvm/trunk/test/CodeGen/X86/cmov-into-branch.ll Sun May 6 09:25:16 2012
@@ -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) {
Modified: llvm/trunk/test/CodeGen/X86/cmov.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmov.ll?rev=156258&r1=156257&r2=156258&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/cmov.ll (original)
+++ llvm/trunk/test/CodeGen/X86/cmov.ll Sun May 6 09:25:16 2012
@@ -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 {
More information about the llvm-commits
mailing list