[PATCH] D39421: [InstCombine] Extracting common and-mask for shift operands of Or instruction
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 08:19:27 PST 2017
spatel added a comment.
Why do we canonicalize shift-left before 'and'?
Ie, shouldn't we prefer this:
define i8 @andshl(i8 %x) {
%and = and i8 %x, 1
%shl = shl i8 %and, 3
ret i8 %shl
}
instead of this:
define i8 @andshl(i8 %x) {
%and = shl i8 %x, 3
%shl = and i8 %and, 8
ret i8 %shl
}
...because doing the 'and' before the shift always uses a smaller constant?
https://reviews.llvm.org/D39421
More information about the llvm-commits
mailing list