[llvm] r255881 - [X86] Add option for enabling LEA optimization pass, by Andrey Turetsky

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 23:34:40 PST 2015


Author: abataev
Date: Thu Dec 17 01:34:39 2015
New Revision: 255881

URL: http://llvm.org/viewvc/llvm-project?rev=255881&view=rev
Log:
[X86] Add option for enabling LEA optimization pass, by Andrey Turetsky
Add option to enable/disable LEA optimization pass. By default the pass is disabled.
Differential Revision: http://reviews.llvm.org/D15573

Modified:
    llvm/trunk/lib/Target/X86/X86OptimizeLEAs.cpp
    llvm/trunk/test/CodeGen/X86/lea-opt.ll

Modified: llvm/trunk/lib/Target/X86/X86OptimizeLEAs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86OptimizeLEAs.cpp?rev=255881&r1=255880&r2=255881&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86OptimizeLEAs.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86OptimizeLEAs.cpp Thu Dec 17 01:34:39 2015
@@ -33,6 +33,10 @@ using namespace llvm;
 
 #define DEBUG_TYPE "x86-optimize-LEAs"
 
+static cl::opt<bool> EnableX86LEAOpt("enable-x86-lea-opt", cl::Hidden,
+                                     cl::desc("X86: Enable LEA optimizations."),
+                                     cl::init(false));
+
 STATISTIC(NumSubstLEAs, "Number of LEA instruction substitutions");
 
 namespace {
@@ -296,7 +300,7 @@ bool OptimizeLEAPass::runOnMachineFuncti
   bool Changed = false;
 
   // Perform this optimization only if we care about code size.
-  if (!MF.getFunction()->optForSize())
+  if (!EnableX86LEAOpt || !MF.getFunction()->optForSize())
     return false;
 
   MRI = &MF.getRegInfo();

Modified: llvm/trunk/test/CodeGen/X86/lea-opt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/lea-opt.ll?rev=255881&r1=255880&r2=255881&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/lea-opt.ll (original)
+++ llvm/trunk/test/CodeGen/X86/lea-opt.ll Thu Dec 17 01:34:39 2015
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-linux -enable-x86-lea-opt | FileCheck %s
 
 %struct.anon1 = type { i32, i32, i32 }
 %struct.anon2 = type { i32, [32 x i32], i32 }




More information about the llvm-commits mailing list