[PATCH] D24565: [InstCombine] PR30366 : Teach the udiv folding logic how to handle constant expressions.

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 10:18:27 PDT 2016


andreadb added a comment.

Hi David,


================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1002
@@ +1001,3 @@
+  Value *N;
+  match(ShiftLeft, m_Shl(m_APInt(CI), m_Value(N)));
+  if (*CI != 1)
----------------
majnemer wrote:
> You should check if match fails.
In theory, this check should never fail because visitUDivOperand (see lines 1036:1040) always checks that Op1 is a left shift of a power_of_2 before adding 'foldUDivShl' to the set of folding actions.

Would it be okay if I add an assertion failure if the call to match returns false?


https://reviews.llvm.org/D24565





More information about the llvm-commits mailing list