[PATCH] D122013: [InstCombine] Fold abs of known negative operand when source is sub
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 11:26:32 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp:241
// it was subtracting from a constant. Otherwise, this isn't profitable.
+ if (I->hasNoSignedWrap())
+ return Builder.CreateNSWSub(I->getOperand(1), I->getOperand(0),
----------------
This change should be an independent patch with its own minimal tests:
https://alive2.llvm.org/ce/z/Ppps-u
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122013/new/
https://reviews.llvm.org/D122013
More information about the llvm-commits
mailing list