[PATCH] D157187: [InstCombine] Propagate the nuw/nsw for instruction neg-sub

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 5 20:56:18 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2069
+        if (I.hasNoSignedWrap() && Op1Inst->hasNoSignedWrap())
+          InstOp1->setHasNoSignedWrap();
+      }
----------------
I don't think its okay to modify NegOp1 inplace like this. the flag propagation works in the context of the transform at hand but might not be applicable to all users.

Also this desperately needs some comments.


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

https://reviews.llvm.org/D157187



More information about the llvm-commits mailing list