[PATCH] D157187: [InstCombine] Propagate the nsw for instruction neg-sub
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 7 06:06:37 PDT 2023
Allen marked an inline comment as done.
Allen added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2069
+ // Make sure the sub and neg have the same type flag.
+ if (I.hasNoUnsignedWrap() && Op1Inst->hasNoUnsignedWrap())
+ InstOp1->setHasNoUnsignedWrap();
----------------
nikic wrote:
> You don't seem to have test coverage for the nuw case, and it seems pretty useless to boot. `sub nuw 0, %x` can only be non-poison if `%x` is zero. This is not a useful case to handle.
Thanks, I delete the nuw case.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157187/new/
https://reviews.llvm.org/D157187
More information about the llvm-commits
mailing list