[PATCH] D147597: [InstCombine] icmp(X | LHS, C) --> icmp(X, 0)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 02:28:18 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1957
+  const APInt *LHS;
+  // icmp(X | LHS, C) --> icmp(X, 0)
+  if (C.isNonNegative() && match(Or, m_c_Or(m_Value(X), m_APInt(LHS)))) {
----------------
junaire wrote:
> junaire wrote:
> > nikic wrote:
> > > Why is a constant that occurs on the RHS called LHS?
> > Naming is hard. `C` here should really be the `RHS` but in `foldICmpOrConstant` it's called `C` so it's kinda confusing. Maybe rename it to `RHS`?
> I'm still unsure about what should I call it, can you suggest one? 
C2, OrC, MaskC would all work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147597



More information about the llvm-commits mailing list