[PATCH] D15573: [X86] Add option for enabling LEA optimization pass

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 08:43:02 PST 2015


Out of curiosity, are there actually plans to make this faster?
(Since it would be non-ideal to have this disabled by default but in-tree
forever)

On Wed, Dec 16, 2015 at 8:40 AM, Andrey Turetskiy via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> aturetsk created this revision.
> aturetsk added a reviewer: qcolombet.
> aturetsk added a subscriber: llvm-commits.
>
> Add option to enable/disable LEA optimization pass. By default the pass is
> disabled.
>
> http://reviews.llvm.org/D15573
>
> Files:
>   lib/Target/X86/X86OptimizeLEAs.cpp
>   test/CodeGen/X86/lea-opt.ll
>
> Index: test/CodeGen/X86/lea-opt.ll
> ===================================================================
> --- test/CodeGen/X86/lea-opt.ll
> +++ test/CodeGen/X86/lea-opt.ll
> @@ -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 }
> Index: lib/Target/X86/X86OptimizeLEAs.cpp
> ===================================================================
> --- lib/Target/X86/X86OptimizeLEAs.cpp
> +++ lib/Target/X86/X86OptimizeLEAs.cpp
> @@ -33,6 +33,10 @@
>
>  #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 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();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151216/367bb0d2/attachment.html>


More information about the llvm-commits mailing list