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 }
Paths
| Differential D154574
[InstCombine] Fold `(icmp eq/ne (zext i1 X) (sext i1 Y))`-> `(icmp eq/ne (or X, Y), 0)` ClosedPublic Authored by goldstein.w.n on Jul 6 2023, 12:30 AM.
Details Summary 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 }
Diff Detail
Event TimelineThis revision is now accepted and ready to land.Jul 6 2023, 12:38 AM This revision was landed with ongoing or failed builds.Jul 12 2023, 3:18 PM Closed by commit rGd50c1fcb5d3c: [InstCombine] Fold `(icmp eq/ne (zext i1 X) (sext i1 Y))`-> `(icmp eq/ne (or X… (authored by goldstein.w.n). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 539760 llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-ext-ext.ll
|
and -> are