[PATCH] D100491: [X86] combineCMP - fold cmpEQ/NE(TRUNC(X),0) -> cmpEQ/NE(X,0)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 14 09:10:28 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: craig.topper, spatel, lebedev.ri, pengfei.
Herald added a subscriber: hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

If we are truncating from a i32/i64 source before comparing the result against zero, then see if we can directly compare the source value against zero.

If the upper (truncated) bits are known to be zero then we can compare against that, hopefully increasing the chances of us folding the compare into a EFLAG result of the source's operation.

Fixes PR49028.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100491

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/and-with-overflow.ll
  llvm/test/CodeGen/X86/pr34137.ll
  llvm/test/CodeGen/X86/pr49028.ll
  llvm/test/CodeGen/X86/setcc-logic.ll
  llvm/test/CodeGen/X86/vector-compare-any_of.ll
  llvm/test/CodeGen/X86/vector-reduce-and-cmp.ll
  llvm/test/CodeGen/X86/vector-reduce-or-bool.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100491.337476.patch
Type: text/x-patch
Size: 14774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210414/32ad8050/attachment.bin>


More information about the llvm-commits mailing list