Add option to enable/disable LEA optimization pass. By default the pass is disabled.
Differential Revision: http://reviews.llvm.org/D15573
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255881
91177308-0d34-0410-b5e6-
96231b3b80d8
#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 {
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();
-; 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 }