[PATCH] D110829: [X86] Special-case ADD of two identical registers in convertToThreeAddress

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 09:33:19 PDT 2021


foad added inline comments.


================
Comment at: llvm/test/CodeGen/X86/twoaddr-mul2.ll:11
   ; CHECK-NEXT:   [[COPY:%[0-9]+]]:gr32 = COPY killed $edi
-  ; CHECK-NEXT:   undef %2.sub_32bit:gr64 = COPY killed [[COPY]]
-  ; CHECK-NEXT:   undef %3.sub_32bit:gr64_nosp = COPY [[COPY]]
-  ; CHECK-NEXT:   [[LEA64_32r:%[0-9]+]]:gr32 = LEA64_32r killed %2, 1, killed %3, 0, $noreg
+  ; CHECK-NEXT:   undef %2.sub_32bit:gr64_nosp = COPY [[COPY]]
+  ; CHECK-NEXT:   [[LEA64_32r:%[0-9]+]]:gr32 = LEA64_32r killed %2, 1, killed %2, 0, $noreg
----------------
MatzeB wrote:
> Why isn't this `COPY killed [[COPY]]` anymore? Are we loosing a kill-flag now?
Because the use is copied from the second use operand in `%1:gr32 = ADD32rr killed %0:gr32(tied-def 0), %0:gr32, implicit-def dead $eflags`, which does not have the killed flag.

Yes we could implement more code here to try to preserve the kill flag from the first use operand, but I thought it might be better to fix the root cause instead, and work out why the second use operand of the ADD32rr was not killed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110829



More information about the llvm-commits mailing list