[all-commits] [llvm/llvm-project] 9b183a: [NFC][InstSimplify] Add miscompiled testcase from ...
Roman Lebedev via All-commits
all-commits at lists.llvm.org
Fri Dec 18 10:19:31 PST 2020
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9b183a1452c7e5091be01661188b7cb04d842a4c
https://github.com/llvm/llvm-project/commit/9b183a1452c7e5091be01661188b7cb04d842a4c
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2020-12-18 (Fri, 18 Dec 2020)
Changed paths:
M llvm/test/Transforms/InstSimplify/abs_intrinsic.ll
Log Message:
-----------
[NFC][InstSimplify] Add miscompiled testcase from D87188/D87197
Thanks to Dave Green for producing an actionable reproducer!
It is (obviously) a miscompile:
```
----------------------------------------
define i32 @select_abs_of_abs_eq_wrong(i32 %x, i32 %y) {
%0:
%abs = abs i32 %x, 0
%neg = sub i32 0, %abs
%cmp = icmp eq i32 %y, 0
%sel = select i1 %cmp, i32 %neg, i32 %abs
ret i32 %sel
}
=>
define i32 @select_abs_of_abs_eq_wrong(i32 %x, i32 %y) {
%0:
%abs = abs i32 %x, 0
ret i32 %abs
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
i32 %x = #xe0000000 (3758096384, -536870912)
i32 %y = #x00000000 (0)
Source:
i32 %abs = #x20000000 (536870912)
i32 %neg = #xe0000000 (3758096384, -536870912)
i1 %cmp = #x1 (1)
i32 %sel = #xe0000000 (3758096384, -536870912)
Target:
i32 %abs = #x20000000 (536870912)
Source value: #xe0000000 (3758096384, -536870912)
Target value: #x20000000 (536870912)
Alive2: Transform doesn't verify!
```
Commit: e9289dc25f7923abff9ac762bd3f6819c0605f20
https://github.com/llvm/llvm-project/commit/e9289dc25f7923abff9ac762bd3f6819c0605f20
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2020-12-18 (Fri, 18 Dec 2020)
Changed paths:
M llvm/lib/Analysis/InstructionSimplify.cpp
M llvm/test/Transforms/InstSimplify/abs_intrinsic.ll
Log Message:
-----------
[InstSimplify] Don't miscompile `X == 0 ? abs(X) : -abs(X) --> -abs(X)` xform
The transform wasn't checking that the LHS of the comparison
*is* the `X` in question...
This is the miscompile that was holding up D87188.
Thanks to Dave Green for producing an actionable reproducer!
Commit: 897c985e1e21927b2870f964bb07ff293bd74407
https://github.com/llvm/llvm-project/commit/897c985e1e21927b2870f964bb07ff293bd74407
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2020-12-18 (Fri, 18 Dec 2020)
Changed paths:
M clang/test/CodeGen/builtins-wasm.c
M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
M llvm/test/Transforms/InstCombine/abs-1.ll
M llvm/test/Transforms/InstCombine/abs_abs.ll
M llvm/test/Transforms/InstCombine/call-callconv.ll
M llvm/test/Transforms/InstCombine/cttz-abs.ll
M llvm/test/Transforms/InstCombine/icmp.ll
M llvm/test/Transforms/InstCombine/max-of-nots.ll
M llvm/test/Transforms/InstCombine/select_meta.ll
M llvm/test/Transforms/InstCombine/sub-of-negatible.ll
M llvm/test/Transforms/PhaseOrdering/X86/vector-reductions.ll
M llvm/test/Transforms/PhaseOrdering/min-max-abs-cse.ll
Log Message:
-----------
[InstCombine] Canonicalize SPF to abs intrinsic
This patch enables canonicalization of SPF_ABS and SPF_ABS
to the abs intrinsic.
This is a recommit, the original try was
05d4c4ebc2fb006b8a2bd05b24c6aba10dd2eef8,
but it was reverted due to an apparent miscompile,
which since then has just been fixed by the previous commit.
Differential Revision: https://reviews.llvm.org/D87188
Compare: https://github.com/llvm/llvm-project/compare/5f75dcf5719f...897c985e1e21
More information about the All-commits
mailing list