[PATCH] D81151: [InstCombine] Simplify compare of Phi with constant inputs against a constant

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 20:56:22 PDT 2020


mkazantsev marked an inline comment as done.
mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1463
+  if (auto *Phi = dyn_cast<PHINode>(Op0))
+    if (Phi->hasOneUse() &&
+        all_of(Phi->operands(), [](Value *V) { return isa<ConstantInt>(V); })) {
----------------
lebedev.ri wrote:
> I don't think you need one-use check - you produce a single instruction,
> and root icmp from which you started matching always goes away (is replaced by new phi)
Yeah, I wasn't sure if it's ok to change icmp for a phi, but it should be (phis are free if RA makes good job).


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

https://reviews.llvm.org/D81151





More information about the llvm-commits mailing list