[PATCH] D154791: [InstCombine] Transform bitwise (A >> C - 1, zext(icmp)) -> zext (bitwise(A < 0, icmp)) fold.

Hongyu Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 05:28:43 PDT 2023


XChy updated this revision to Diff 539971.
XChy marked 2 inline comments as done.
XChy added a comment.

I update the diff to ensure that we fold exactly what can be folded by **foldXorOfICmps** and **foldAndOrOfICmps**.

However, I'm not sure what unexpected result the code below may bring.

  // remove the deferred 2 instructions : 
  // icmp slt A, 0
  // bitwise (A < 0, icmp) 
  // otherwise there will be infinite loops of combining
  Worklist.popDeferred()->eraseFromParent();
  Worklist.popDeferred()->eraseFromParent();


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

https://reviews.llvm.org/D154791

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/and-or-icmps.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154791.539971.patch
Type: text/x-patch
Size: 11005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230713/f5070226/attachment.bin>


More information about the llvm-commits mailing list