[PATCH] D157598: [InstCombine] Transform sub(sext(add(X, Y)), sext(add(X, Z))) to sub(Y, Z) given nsw adds
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 03:43:15 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2477
+ Value *S2 = Builder.CreateSExt(Z, Ty);
+ return BinaryOperator::CreateSub(S1, S2);
+ }
----------------
nikic wrote:
> It looks like it's legal to transfer the nsw flag to the sub here (https://alive2.llvm.org/ce/z/cYJh4x). But not in the nuw case (https://alive2.llvm.org/ce/z/jHsEcP).
Okay, I see in the tests that the nsw will get inferred anyway, so I guess there's no need to make it explicit.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157598/new/
https://reviews.llvm.org/D157598
More information about the llvm-commits
mailing list