[PATCH] D157740: [WIP] [InstCombine] Fold icmp into phi beyond the same BB.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 12:29:21 PDT 2023


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

LGTM, let's see if anyone complains.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3896
   case Instruction::PHI:
-    // Only fold icmp into the PHI if the phi and icmp are in the same
-    // block.  If in the same block, we're encouraging jump threading.  If
-    // not, we are just pessimizing the code by making an i1 phi.
-    if (LHSI->getParent() == I.getParent())
-      if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI)))
-        return NV;
+    // Fold icmp into the PHI beyond the same block to generate an i1 phi.
+    if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI)))
----------------
You can just drop this comment -- not terribly helpful now that the check is gone. (We're folding not //only// beyond the same block.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157740



More information about the llvm-commits mailing list