[PATCH] D75519: [ExpandMemCmp] Properly constant-fold all compares.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 06:21:21 PST 2020


courbet created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
courbet updated this revision to Diff 247879.
courbet added a comment.
courbet marked an inline comment as done.

regenerate pgso tests


courbet added a comment.

Note that most test changes are NFC (just interleaving computations). I've highlighted the actual changes.



================
Comment at: llvm/test/CodeGen/X86/memcmp.ll:103
 ; X86-NEXT:    movzwl %ax, %eax
-; X86-NEXT:    movzwl %cx, %ecx
-; X86-NEXT:    subl %ecx, %eax
+; X86-NEXT:    addl $-12594, %eax # imm = 0xCECE
 ; X86-NEXT:    retl
----------------
This is the real change.


This gets rid of duplicated code and diverging behaviour w.r.t.
constants.
Fixes PR45086.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75519

Files:
  llvm/lib/CodeGen/ExpandMemCmp.cpp
  llvm/test/CodeGen/X86/memcmp-more-load-pairs.ll
  llvm/test/CodeGen/X86/memcmp-optsize.ll
  llvm/test/CodeGen/X86/memcmp-pgso.ll
  llvm/test/CodeGen/X86/memcmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75519.247879.patch
Type: text/x-patch
Size: 49100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200303/a51a1b0f/attachment-0001.bin>


More information about the llvm-commits mailing list