diff options
author | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2021-11-17 12:33:31 -0800 |
---|---|---|
committer | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2021-12-09 09:48:55 -0800 |
commit | 06ca0a273308112c660dddf14c92fe14957bd468 (patch) | |
tree | dc10e69778994d106b2d006afa48b757b1b63994 /clang/lib/Analysis/ThreadSafety.cpp | |
parent | a1968d5341d7b1ec7889955f230d0375548d165b (diff) | |
download | llvm-06ca0a273308112c660dddf14c92fe14957bd468.zip llvm-06ca0a273308112c660dddf14c92fe14957bd468.tar.gz llvm-06ca0a273308112c660dddf14c92fe14957bd468.tar.bz2 |
[InstCombine] (~a & b & c) | ~(a | b | c) -> ~(a | (b ^ c))
Transform
```
(~a & b & c) | ~(a | b | c) -> ~(a | (b ^ c))
```
And swapped case:
```
(~a | b | c) & ~(a & b & c) -> ~a | (b ^ c)
```
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%or1 = or i4 %b, %a
%or2 = or i4 %or1, %c
%not1 = xor i4 %or2, 15
%not2 = xor i4 %a, 15
%and1 = and i4 %b, %not2
%and2 = and i4 %and1, %c
%or3 = or i4 %and2, %not1
ret i4 %or3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%1 = xor i4 %c, %b
%2 = or i4 %1, %a
%or3 = xor i4 %2, 15
ret i4 %or3
}
Transformation seems to be correct!
```
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%and1 = and i4 %b, %a
%and2 = and i4 %and1, %c
%not1 = xor i4 %and2, 15
%not2 = xor i4 %a, 15
%or1 = or i4 %not2, %b
%or2 = or i4 %or1, %c
%and3 = and i4 %or2, %not1
ret i4 %and3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%xor = xor i4 %b, %c
%not = xor i4 %a, 15
%or = or i4 %xor, %not
ret i4 %or
}
Transformation seems to be correct!
```
Differential Revision: https://reviews.llvm.org/D112966
Diffstat (limited to 'clang/lib/Analysis/ThreadSafety.cpp')
0 files changed, 0 insertions, 0 deletions