[PATCH] D156499: [InstCombine] Fold abs of known sign operand when source is sub
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 04:19:22 PDT 2023
Allen marked 2 inline comments as done.
Allen added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1032
+ isImpliedByDomCondition(ICmpInst::ICMP_SLE, X, Y, CxtI, DL))
+ return Known;
+ }
----------------
nikic wrote:
> This looks incorrect from the perspective of the getKnownSign() API. You are returning sign 1 for value 0, which is incorrect. It does work out for the abs optimization because -0 == 0, but it may matter in other cases.
thanks, I move it out of the getKnownSign() API.
================
Comment at: llvm/test/Transforms/InstCombine/abs-intrinsic.ll:533
+ ret i32 %r
+}
+
----------------
goldstein.w.n wrote:
> Can you split the new tests to a separate commit?
Done on https://reviews.llvm.org/D156521, thanks
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156499/new/
https://reviews.llvm.org/D156499
More information about the llvm-commits
mailing list