[PATCH] D142783: [InstCombine][LV][WIP] Fold (add (zext (add X, -1)), 1) -> (zext X) if X is non-zero.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 12:34:52 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:982
+    if (match(Op0, m_ZExt(m_Add(m_Value(X), m_AllOnes())))) {
+      // TODO: Can we use the inner add as the context? Is that better?
+      const SimplifyQuery Q = SQ.getWithInstruction(&Add);
----------------
The outer add is better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142783



More information about the llvm-commits mailing list