OSDN Git Service

[InstSimplify] [NFC] Add tests for peeking through unsigned FP casts for sign compare...
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 14 Mar 2018 17:31:08 +0000 (17:31 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 14 Mar 2018 17:31:08 +0000 (17:31 +0000)
commitf446c68a19af28e47b987f8eaaece9f5d721a7d6
treea8873d6eec4a876a5d3035d6c991d160c253afcb
parentdb67ae0928a25084f168d6b43095473b52f456ca
[InstSimplify] [NFC] Add tests for peeking through unsigned FP casts for sign compares (PR36682)

Summary:
This pattern came up in PR36682 / D44390
https://bugs.llvm.org/show_bug.cgi?id=36682
https://reviews.llvm.org/D44390
https://godbolt.org/g/oKvT5H

Looking at the IR pattern in question, as per [[ https://github.com/rutgers-apl/alive-nj | alive-nj ]], for all the type combinations i checked
(input: `i16`, `i32`, `i64`; intermediate: `half`/`i16`, `float`/`i32`, `double`/`i64`)
for the following `icmp` comparisons the `uitofp`+`bitcast`+`icmp` can be evaluated to a boolean:
* `slt 0`
* `sgt -1`
I did not check vectors, but i'm guessing it's the same there.
{F5889242}

Thus all these cases are in the testcase (along with the vector variant with additional `undef` element in the middle).
There are no negative patterns here (unless alive-nj lied/is broken), all of these should be optimized.

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D44421

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327535 91177308-0d34-0410-b5e6-96231b3b80d8
test/Transforms/InstSimplify/cast-unsigned-icmp-cmp-0.ll [new file with mode: 0644]