[PATCH] D42032: [LLVM][PASSES][InstCombine] Fix (a + a + ...) / a cases

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 15:01:01 PST 2018


majnemer added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:997-998
+  const APInt *C = nullptr;
+  if (((IsSigned && match(Op0, m_NSWShl(m_Value(X), m_APInt(C)))) ||
+      (!IsSigned && match(Op0, m_NUWShl(m_Value(X), m_APInt(C))))) && X == Op1)
+    return ConstantInt::get(X->getType(), APInt(C->getBitWidth(), 1).shl(*C));
----------------
Instead of using `m_Value(X)` and `X == Op1`, just use `m_Specific(Op1)`


Repository:
  rL LLVM

https://reviews.llvm.org/D42032





More information about the llvm-commits mailing list