[PATCH] D142546: [ConstraintElimination] Decompose or instruction if the constant operand < 2^known_zero_bits of the first operand.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 00:59:34 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/ConstraintElimination.cpp:353
+    if (CI->getZExtValue() < pow(2, KnownBits.Zero.getZExtValue()))
+      return MergeResults(Op0, CI, IsSigned);
+  }
----------------
goldstein.w.n wrote:
> Is it more useful to have an `add` than an `or`?
For this pass, yes, as it only handles adds. If this was a more generic question: We currently canonicalize add -> or if no common bits, and then undo that in various places. It's hard to say whether switching to the reverse direction or -> add would be more beneficial. We have both many `or` folds and many `add` folds. I've never tried it, though I did wonder about it in the past.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142546



More information about the llvm-commits mailing list