[PATCH] [LSR] Canonicalize reg1 + ... + regN into reg1 + ... + 1*regN

Quentin Colombet qcolombet at apple.com
Mon May 19 14:05:07 PDT 2014


PS: Tested version was trunk r208630.

================
Comment at: test/CodeGen/X86/avoid_complex_am.ll:25
@@ -23,1 +24,3 @@
+; The induction variable should carry the scaling factor: 1.
+; CHECK: [[IVNEXT]] = add nuw nsw i64 [[IV]], 1
   %indvars.iv.next = add i64 %indvars.iv, 1
----------------
Note: Since reg1 + <{0,+,8}> has the same cost as reg1 + <{0,+,1}> * 8 on x86, IIRC, in that example LSR chooses the second as the ImmCost is lower.

================
Comment at: test/CodeGen/X86/masked-iv-safe.ll:8
@@ -7,3 +7,3 @@
 ; CHECK-NOT: {{and|movz|sar|shl}}
-; CHECK: addq $8,
+; CHECK: incq
 ; CHECK-NOT: {{and|movz|sar|shl}}
----------------
Same here.

http://reviews.llvm.org/D3830






More information about the llvm-commits mailing list