aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYingchi Long <i@lyc.dev>2023-01-24 21:25:50 +0800
committerYingchi Long <i@lyc.dev>2023-02-10 12:50:39 +0800
commitf9e2fb9d8e59e5a6428727d984c95753d57c3bb8 (patch)
treee91563b4b955c28a585300b000c7a8179ad274af /clang/lib/Frontend/CompilerInvocation.cpp
parent942c4cdac435530ad7bc85319a6279b7ee07193e (diff)
downloadllvm-f9e2fb9d8e59e5a6428727d984c95753d57c3bb8.zip
llvm-f9e2fb9d8e59e5a6428727d984c95753d57c3bb8.tar.gz
llvm-f9e2fb9d8e59e5a6428727d984c95753d57c3bb8.tar.bz2
[InstCombine] combine intersection for inequality icmps
``` define i1 @src(i32 %A) { %mask1 = and i32 %A, 15 ; 0x0f %tst1 = icmp eq i32 %mask1, 3 ; 0x03 %mask2 = and i32 %A, 255 ; 0xff %tst2 = icmp eq i32 %mask2, 243; 0xf3 %res = or i1 %tst1, %tst2 ret i1 %res } ``` -> ``` define i1 @tgt(i32 %A) { %1 = and i32 %A, 15 %res = icmp eq i32 %1, 3 ret i1 %res } ``` Proof: https://alive2.llvm.org/ce/z/4AyvcE Assume that `(B & D) & (C ^ E) == 0`, and `(B & D) == D || (B & D) == B`, transforms: ``` (icmp ne (A & B), C) & (icmp ne (A & D), E) -> (icmp ne (A & (B&D)), (C&E)) ``` Fixes: https://github.com/llvm/llvm-project/issues/59680 Reviewed By: spatel, bcl5980 Differential Revision: https://reviews.llvm.org/D140666
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions