[PATCH] D61517: [InstCombine] Add new combine to add folding.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 08:52:20 PDT 2019


lebedev.ri added a comment.

Needs some negative tests (non-matching scalar constants; non-matching vector constants; vector with undef; matching vector constants, but non-splat (i.e. not all constants in vector are identical); ..)



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:899
+  const APInt *C2;
+  if (match(Op0, m_c_Or(m_Value(), m_APInt(C2))) &&
+      *C2 == -*C)
----------------
Constant is guaranteed to be on the rhs


================
Comment at: llvm/test/Transforms/InstCombine/add.ll:998
+;
+  %B = or i32 123, %A
+  %C = add i32 %B, -123
----------------
This will already be canonicalized to the `@test44`.


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

https://reviews.llvm.org/D61517





More information about the llvm-commits mailing list