[PATCH] D158510: [InstCombine] Propagate nsw flag when negating
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 06:43:27 PDT 2023
nikic created this revision.
nikic added a reviewer: goldstein.w.n.
Herald added subscribers: StephenFan, lebedev.ri, hiraditya.
Herald added a reviewer: lebedev.ri.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When pushing a `sub nsw 0, %x` negation into an expression, try to preserve the `nsw` flag for the cases where this is possible. Do this by passing the flag through recursive `Negator::negate()` calls.
Proofs: https://alive2.llvm.org/ce/z/QTTc6r
https://reviews.llvm.org/D158510
Files:
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
llvm/test/Transforms/InstCombine/abs-intrinsic.ll
llvm/test/Transforms/InstCombine/nsw.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158510.552334.patch
Type: text/x-patch
Size: 18208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230822/5406bfcc/attachment.bin>
More information about the llvm-commits
mailing list