[PATCH] D64707: [x86] try harder to form LEA from ADD to avoid flag conflicts (PR40483)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 09:15:56 PDT 2019


spatel added a comment.

In D64707#1586664 <https://reviews.llvm.org/D64707#1586664>, @craig.topper wrote:

> Are the multiply test changes due to the flags being used by seto? But seto usage should never be in danger of creating the instruction duplication we're seeing in the motivating case. It does look like we're getting an improvement on those tests, but not for the reason we're selecting LEA.


Yes, I think you're right - we have something like this:

  t95: i32,i32 = X86ISD::ADD t73:1, t93
  t102: i32,i32 = X86ISD::UMUL t36, t38
  t106: i32,i32 = X86ISD::UMUL t40, t33
    t93: i32 = add t106, t102
          t107: i8 = X86ISD::SETCC Constant:i8<0>, t106:1
        t104: i8 = X86ISD::SETCC Constant:i8<0>, t102:1

So the use of LEA is presumably just making things easier for register allocation.
Not sure how to handle this:

1. Remove UMUL/SMUL from the cases in this patch and forego those improvements.
2. Add a comment expanding on our reasoning for the transform and keep the improvements.
3. Refine the flags check somehow (and again forego those improvements in this patch)?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64707/new/

https://reviews.llvm.org/D64707





More information about the llvm-commits mailing list