[PATCH] D63026: [InstCombine] Fold icmp eq/ne (and %x, signbit), 0 -> %x s>=/s< 0 earlier

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 10:53:51 PDT 2019


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

I think this looks good now, thank you for working on this!
Can you please link the patch into which you split the second fold from here?



================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:1025-1033
   unsigned MaxIter = 32; // Break cycles and bound to constant-time.
 
   SmallVector<const Use *, 32> Worklist;
   for (const Use &U : Alloca->uses()) {
     if (Worklist.size() >= MaxIter)
       return nullptr;
     Worklist.push_back(&U);
----------------
Can you please link the patch to which you split this out?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1647
 
+  if (Cmp.isEquality() && C1.isNullValue()) {
+    // Replace (and X, (1 << size(X)-1) != 0) with X s< 0
----------------
Please add a comment about the reason (PR10267) this fold is restricted to one-use `and`.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63026





More information about the llvm-commits mailing list