[InstCombine] Fold `(icmp eq/ne (zext i1 X) (sext i1 Y))`-> `(icmp eq/ne (or X, Y), 0)`
This comes up when adding two `bool` types in C/C++ ``` bool foo(bool a, bool b) { return a + b; } ... -> define i1 @foo(i1 %a, i1 %b) { %conv = zext i1 %a to i32 %conv3.neg = sext i1 %b to i32 %tobool4 = icmp ne i32 %conv, %conv3.neg ret i1 %tobool4 } ``` Proof: https://alive2.llvm.org/ce/z/HffWAN Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D154574
Loading
Please sign in to comment