[PATCH] D132658: [InstCombine] Distributive or+mul with const operand

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 00:13:16 PDT 2022


bcl5980 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:235
+      auto *BO = BinaryOperator::CreateAdd(Builder.CreateMul(X, Op1), Mul);
+      if (I.hasNoUnsignedWrap())
+        BO->setHasNoUnsignedWrap();
----------------
Only check nuw for mul works for pattern `or`.
But for the pattern `add`, we need check both instructions are nuw then can keep the flag. 
And target pattern can be nuw for both instruction also.


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

https://reviews.llvm.org/D132658



More information about the llvm-commits mailing list