diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2020-07-04 17:39:48 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2020-07-04 18:12:04 +0300 |
commit | c3b8bd1eea5b74b6cd4a89f3c221bc2dfa891248 (patch) | |
tree | c6205f8584f1f2a1ca5ec3c7fa35c8c717cf2855 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | ef70cc9d1ac69125f38910d4c66388536f49f4dc (diff) | |
download | llvm-c3b8bd1eea5b74b6cd4a89f3c221bc2dfa891248.zip llvm-c3b8bd1eea5b74b6cd4a89f3c221bc2dfa891248.tar.gz llvm-c3b8bd1eea5b74b6cd4a89f3c221bc2dfa891248.tar.bz2 |
[InstCombine] Always try to invert non-canonical predicate of an icmp
Summary:
The actual transform i was going after was:
https://rise4fun.com/Alive/Tp9H
```
Name: zz
Pre: isPowerOf2(C0) && isPowerOf2(C1) && C1 == C0
%t0 = and i8 %x, C0
%r = icmp eq i8 %t0, C1
=>
%t = icmp eq i8 %t0, 0
%r = xor i1 %t, -1
Name: zz
Pre: isPowerOf2(C0)
%t0 = and i8 %x, C0
%r = icmp ne i8 %t0, 0
=>
%t = icmp eq i8 %t0, 0
%r = xor i1 %t, -1
```
but as it can be seen from the current tests, we already canonicalize most of it,
and we are only missing handling multi-use non-canonical icmp predicates.
If we have both `!=0` and `==0`, even though we can CSE them,
we end up being stuck with them. We should canonicalize to the `==0`.
I believe this is one of the cleanup steps i'll need after `-scalarizer`
if i end up proceeding with my WIP alloca promotion helper pass.
Reviewers: spatel, jdoerfert, nikic
Reviewed By: nikic
Subscribers: zzheng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83139
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions