Fold
%A = icmp ne i8 %X, %V1 %B = icmp ne i8 %X, %V2 %C = or i1 %A, %B %D = select i1 %C, i8 %X, i8 %V1 ret i8 %D => ret i8 %X Fixes https://bugs.llvm.org/show_bug.cgi?id=38334 Proof: https://rise4fun.com/Alive/plI8
Differential D49919
[InstCombine] Fold Select with AND/OR condition xbolva00 on Jul 27 2018, 9:25 AM. Authored by
Details Fold %A = icmp ne i8 %X, %V1 %B = icmp ne i8 %X, %V2 %C = or i1 %A, %B %D = select i1 %C, i8 %X, i8 %V1 ret i8 %D => ret i8 %X Fixes https://bugs.llvm.org/show_bug.cgi?id=38334 Proof: https://rise4fun.com/Alive/plI8
Diff Detail Event TimelineComment Actions There should be an opposite version with and instead of or and the compare condition inverted. We should handle that too.
Comment Actions Can we handle even more cases? Any ideas how to easily extend this patch to handle them? Nevermind, maybe for now TODO. Let's do this simple case.
Comment Actions In general, looks ok, but i would like to see better test coverage
Comment Actions +
Not sure what other cases would be valuable to check against. Comment Actions Thank you. Comment Actions Ok, i think this looks good, other than nits.
|
Maybe something like