[PATCH] D46336: [InstCombine] Apply binary operator simplifications to associative/commutative cases.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 7 16:14:54 PDT 2018
lebedev.ri added a comment.
In https://reviews.llvm.org/D46336#1090644, @yamauchi wrote:
> After -instcombine -reassociate -instcombine -reassociate -instcombine with https://reviews.llvm.org/D45842
>
> define i1 @bit-check-combine1(i32 %a, i32 %b) {
> entry:
> %0 = and i32 %b, 8
> %1 = and i32 %a, 7
> %2 = or i32 %0, %1
> %3 = and i32 %b, 48
> %4 = or i32 %2, %3
> %5 = icmp eq i32 %4, 0
> ret i1 %5
> }
>
So it seems https://reviews.llvm.org/D45842 did what it was supposed to, but the instcombine can't fold that down into
define i1 @bit-check-combine1(i32 %a, i32 %b) {
entry:
%0 = and i32 %a, 7
%1 = and i32 %b, 56
%2 = or i32 %0, %1
%3 = icmp eq i32 %2, 0
ret i1 %3
}
I'd guess something in instcombine does not use commutative matchers.
(I did not analyse this at all yet, just 'saving' it as one comment)
Repository:
rL LLVM
https://reviews.llvm.org/D46336
More information about the llvm-commits
mailing list