[PATCH] D35014: [X86] PR32755 : Improvement in CodeGen instruction selection for LEAs.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 11:01:20 PDT 2017


RKSimon added inline comments.


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:1418
+          AM.IndexReg = Base_Reg;
+          AM.Scale++;
+          return false;
----------------
craig.topper wrote:
> Is Scale limited to 1 before this or could it be 2 in which case this creates an illegal scale of 3?
There is a check for AM.scale == 1. But I agree it'd be clearer with "AM.Scale = 2" instead of incrementing.


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:1421
+       } else if (AM.IndexReg == N) {
+          AM.Scale++;
+          return false;
----------------
AM.Scale = 2;


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:738
+   return cseDone;
+}
+
----------------
Please can you run this through clang-format?


================
Comment at: test/CodeGen/X86/lea-opt-cst.ll:3
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
----------------
Drop the triple/datalayouts and just use the -mtriple=x86_64-unknown-linux-gnu instead.

Add a i686-unknown-linux-gnu test as well. 

By convention we tend to use X86 as the prefix for i686 triples and X64 for x86_64 triples.

You should be able to use utils/update_llc_test_checks.py to generate the codegen.


https://reviews.llvm.org/D35014





More information about the llvm-commits mailing list