[PATCH] D19659: [X86] Enable RRL part of the LEA optimization pass for -O2

Andrey Turetskiy via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 02:05:14 PDT 2016


aturetsk added inline comments.

================
Comment at: test/CodeGen/X86/lea-opt.ll:1-2
@@ -1,2 +1,3 @@
 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
+; RUN: llc --disable-x86-lea-opt < %s -mtriple=x86_64-linux | FileCheck %s -check-prefix=DISABLED
 
----------------
Done.

================
Comment at: test/CodeGen/X86/lea-opt.ll:137
@@ -113,1 +136,3 @@
+  %cvt = ptrtoint i32* %b to i32
+  store i32 %cvt, i32* %b, align 4
   br label %sw.epilog
----------------
There are two LEA instructions in this test.

Before this patch, RRL part of the pass was disabled for 'optsize', so both LEAs were preserved and RemoveRedundantAddressCalculation part of the pass had to choose a LEA for substitution in load instructions. And it should choose not the closest one, but the one which would make a resulting displacement fit 1 byte (that's exactly what the test checks).

After this patch, RRL part of the pass is enabled for 'optsize'. And without the changes in the test I made it would remove one of the LEAs and thus RRAC part of the pass wouldn't need to choose a LEA for substitution (because only one remained). So the test would become useless.


http://reviews.llvm.org/D19659





More information about the llvm-commits mailing list