[PATCH] D141188: [MergeICmps] Adapt to non-eq comparisons

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 06:45:03 PST 2023


Allen marked 4 inline comments as done.
Allen added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MergeICmps.cpp:352
+    const auto *const ConstBase = cast<ConstantInt>(Baseline);
+    ExpectedPredicate =
+        ConstBase->isOne() ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ;
----------------
courbet wrote:
> Let's `assert` that `ConstBase` is an `i1` here, because `isOne()` would be incorrect otherwise.
Apply your comment, thanks


================
Comment at: llvm/lib/Transforms/Scalar/MergeICmps.cpp:843
   if (Blocks.empty()) return false;
-  BCECmpChain CmpChain(Blocks, Phi, AA);
+  ICmpInst::Predicate Predicate = CmpInst::BAD_ICMP_PREDICATE;
+  BCECmpChain CmpChain(Blocks, Phi, AA, Predicate);
----------------
courbet wrote:
> `Predicate` could be a member of `BCECmpChain`. It's conceptually is a property of the chain and this would make the code simpler.
Done, thanks


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

https://reviews.llvm.org/D141188



More information about the llvm-commits mailing list