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

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 01:26:11 PDT 2022


Allen marked an inline comment as done.
Allen 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();
----------------
bcl5980 wrote:
> 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.
Thank you for your patient guidance.


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

https://reviews.llvm.org/D132658



More information about the llvm-commits mailing list