[PATCH] D87188: [InstCombine] Canonicalize SPF to abs intrinc
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 23 13:06:54 PST 2020
lebedev.ri added a comment.
In D87188#2467915 <https://reviews.llvm.org/D87188#2467915>, @nlopes wrote:
> This patch regressed the following test of Transforms/InstCombine/abs-1.ll:
> (need to drop NSW in this case).
>
> define i8 @nabs_canonical_3(i8 %x) {
> %0:
> %cmp = icmp slt i8 %x, 0
> %neg = sub nsw i8 0, %x
> %abs = select i1 %cmp, i8 %x, i8 %neg
> ret i8 %abs
> }
> =>
> define i8 @nabs_canonical_3(i8 %x) {
> %0:
> %1 = abs i8 %x, 1
> %abs = sub nsw i8 0, %1
> ret i8 %abs
> }
> Transformation doesn't verify!
> ERROR: Target is more poisonous than source
>
> Example:
> i8 %x = #x80 (128, -128)
>
> Source:
> i1 %cmp = #x1 (1)
> i8 %neg = poison
> i8 %abs = #x80 (128, -128)
>
> Target:
> i8 %1 = poison
> i8 %abs = poison
> Source value: #x80 (128, -128)
> Target value: poison
>
> (same bug occurs with @nabs_nabs_x01 in Transforms/InstCombine/abs_abs.ll)
Thanks, fixed in rGf8079355c604fead0f8538548bd7eb51fcc81e31 <https://reviews.llvm.org/rGf8079355c604fead0f8538548bd7eb51fcc81e31>.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87188/new/
https://reviews.llvm.org/D87188
More information about the llvm-commits
mailing list