[PATCH] D44416: [InstCombine] [NFC] Add tests for peeking through unsigned FP casts for zero-equality compares (PR36682)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 04:38:09 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, majnemer, efriedma, arsenm.
Herald added a subscriber: wdng.

This pattern came up in PR36682 / https://reviews.llvm.org/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 alive-nj <https://github.com/rutgers-apl/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` can be dropped:

- `eq 0`
- `ne 0`

I did not check vectors, but i'm guessing it's the same there.
F5889189: alive-eq.txt <https://reviews.llvm.org/F5889189>

      

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.

Generated with 
F5889196: bitcast.cpp <https://reviews.llvm.org/F5889196>


Repository:
  rL LLVM

https://reviews.llvm.org/D44416

Files:
  test/Transforms/InstCombine/cast-unsigned-icmp-eqcmp-0.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44416.138150.patch
Type: text/x-patch
Size: 18506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180313/3c1e37ce/attachment.bin>


More information about the llvm-commits mailing list