[AArch64][GlobalISel] Add undef combines to postlegalizer combiner.

This commit is contained in:
Amara Emerson 2022-05-05 09:09:51 -07:00
parent 199dfb4d0c
commit 87e3646a1f
2 changed files with 25 additions and 4 deletions

View File

@ -217,7 +217,7 @@ def AArch64PostLegalizerLoweringHelper
// Post-legalization combines which are primarily optimizations.
def AArch64PostLegalizerCombinerHelper
: GICombinerHelper<"AArch64GenPostLegalizerCombinerHelper",
[copy_prop, erase_undef_store, combines_for_extload,
[copy_prop, combines_for_extload,
sext_trunc_sextload, mutate_anyext_to_zext,
hoist_logic_op_with_same_opcode_hands,
redundant_and, xor_of_and_with_same_reg,
@ -228,6 +228,6 @@ def AArch64PostLegalizerCombinerHelper
select_combines, fold_merge_to_zext,
constant_fold, identity_combines,
ptr_add_immed_chain, overlapping_and,
split_store_zero_128]> {
split_store_zero_128, undef_combines]> {
let DisableRuleOption = "aarch64postlegalizercombiner-disable-rule";
}

View File

@ -15,11 +15,32 @@ body: |
; CHECK-LABEL: name: delete_store_undef
; CHECK: liveins: $x0
; CHECK-NOT: G_STORE
; CHECK: RET_ReallyLR
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: RET_ReallyLR
%0:_(p0) = COPY $x0
%1:_(s32) = G_IMPLICIT_DEF
G_STORE %1(s32), %0(p0) :: (store (s32))
RET_ReallyLR
...
---
name: delete_add_undef
legalized: true
tracksRegLiveness: true
body: |
bb.1.entry:
liveins: $x0
; CHECK-LABEL: name: delete_add_undef
; CHECK: liveins: $x0
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
; CHECK-NEXT: $x0 = COPY [[DEF]](s64)
; CHECK-NEXT: RET_ReallyLR
%0:_(s64) = COPY $x0
%1:_(s64) = G_IMPLICIT_DEF
%add:_(s64) = G_ADD %0(s64), %1(s64)
$x0 = COPY %add
RET_ReallyLR
...