[PATCH] D59374: [InstCombine] canonicalize funnel shift constant shift amount to be modulo bitwidth

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 11:18:38 PDT 2019


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2000
+    Constant *ShAmtC;
+    if (match(II->getArgOperand(2), m_Constant(ShAmtC))) {
+      Constant *WidthC = ConstantInt::get(II->getType(), BitWidth);
----------------
lebedev.ri wrote:
> Will `m_Constant()` also math constant expressions?
> Maybe add some test that we don't do anything stupid with them?
Yes, that'll match a ConstantExpr...and yes, we often get into trouble with those, so good catch!
I'll add some tests.


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

https://reviews.llvm.org/D59374





More information about the llvm-commits mailing list