[PATCH] D132777: [InstCombine] Propagate the nuw for combine of add+mul

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 28 06:06:05 PDT 2022


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM - see inline comment for minor change.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:237
+          dyn_cast<BinaryOperator>(NewMul)) {
+        cast<BinaryOperator>(NewMul)->setHasNoUnsignedWrap();
+        BO->setHasNoUnsignedWrap();
----------------
It is better to use the normal LLVM code pattern instead of using both dyn_cast and cast:
  if (auto *NewMulBO = dyn_cast<BinaryOperator>(NewMul))
    NewMulBO->setHasNoUnsignedWrap();


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

https://reviews.llvm.org/D132777



More information about the llvm-commits mailing list