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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 10:05:02 PST 2022


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1456-1461
+  Constant *C = dyn_cast<Constant>(Op1);
+  if (!C)
+    return nullptr;
+
+  if (auto *Phi = dyn_cast<PHINode>(Op0))
+    if (all_of(Phi->operands(), [](Value *V) { return isa<Constant>(V); })) {
----------------
Passing-by comment: i strongly suspect these don't actually want to deal with constant *expressions*,
only immediate constants. I missed that originally i guess.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81151



More information about the llvm-commits mailing list