[PATCH] D42424: [InstCombine] Allow common type conversions to i8/i16
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 09:23:14 PST 2018
spatel added a comment.
I added a different transform that is guarded by shouldChangeType() at https://reviews.llvm.org/rL323437 .
The tests added in that patch will be affected by this patch, so please rebase. I don't have any other suggestions, so if there are no other comments, let's try it?
I think the difference in AArch64 code with this patch for the examples in PR35792 would be:
$ ./opt 35792.ll -S | ./llc -o - -mtriple=aarch64
julia_a_62828: // @julia_a_62828
mov w8, w0
sub w9, w0, #1 // =1
and x0, x9, x8
ret
bad: // @bad
orr w8, wzr, #0xffff
add w8, w0, w8
and w0, w0, w8
ret
vs. after this patch:
$ ./opt -instcombine 35792.ll -S | ./llc -o - -mtriple=aarch64
julia_a_62828: // @julia_a_62828
sub w8, w0, #1 // =1
and w0, w8, w0
ret
bad: // @bad
sub w8, w0, #1 // =1
and w0, w8, w0
ret
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:147
/// because i1 is a fundamental type in IR, and there are many specialized
-/// optimizations for i1 types.
+/// optimizations for i1 types. Widths or 8, 16 or 32 are equally treated as
+/// legal to convert to, in order to open up more combining opportunities.
----------------
or -> of ?
https://reviews.llvm.org/D42424
More information about the llvm-commits
mailing list