[PATCH] D156499: [InstCombine] Fold abs of known sign operand when source is sub

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 00:57:48 PDT 2023


goldstein.w.n added a comment.

In D156499#4541684 <https://reviews.llvm.org/D156499#4541684>, @Allen wrote:

> In D156499#4541169 <https://reviews.llvm.org/D156499#4541169>, @goldstein.w.n wrote:
>
>> Can you add alive2 links?
>
> Thanks for your attention, I already put the each alive2 link before the matched cases, so do you mean I also should put that in the MR description ?

Bah sorry for not following up on this, but where are the alive2 links?



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1540
+          return replaceInstUsesWith(*II, IIOperand);
+        return BinaryOperator::CreateNeg(IIOperand);
+      }
----------------
This is incorrect if the `abs` allows INT_MIN: https://alive2.llvm.org/ce/z/YNcdRW
It needs to create a new `sub` w.o `nsw`.


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

https://reviews.llvm.org/D156499



More information about the llvm-commits mailing list