mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[GlobalISel] Enable copy-propagation in post-legalizer combiner.
This cleans up copies that the legalizer or other combines leave around. They can occasionally end up escaping as moves. Differential Revision: https://reviews.llvm.org/D85964
This commit is contained in:
parent
8de4e46dad
commit
23bcf50ec2
@ -78,7 +78,7 @@ def shuffle_vector_pseudos : GICombineGroup<[dup, rev, ext, zip, uzp, trn]>;
|
||||
|
||||
def AArch64PostLegalizerCombinerHelper
|
||||
: GICombinerHelper<"AArch64GenPostLegalizerCombinerHelper",
|
||||
[erase_undef_store, combines_for_extload,
|
||||
[copy_prop, erase_undef_store, combines_for_extload,
|
||||
sext_trunc_sextload, shuffle_vector_pseudos,
|
||||
hoist_logic_op_with_same_opcode_hands]> {
|
||||
let DisableRuleOption = "aarch64postlegalizercombiner-disable-rule";
|
||||
|
@ -12,8 +12,7 @@ body: |
|
||||
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
|
||||
; CHECK: [[SEXTLOAD:%[0-9]+]]:_(s64) = G_SEXTLOAD [[COPY]](p0) :: (load 2)
|
||||
; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[SEXTLOAD]](s64)
|
||||
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[TRUNC]](s32)
|
||||
; CHECK: $w0 = COPY [[COPY1]](s32)
|
||||
; CHECK: $w0 = COPY [[TRUNC]](s32)
|
||||
%0:_(p0) = COPY $x0
|
||||
%1:_(s64) = G_SEXTLOAD %0:_(p0) :: (load 2)
|
||||
%2:_(s32) = G_TRUNC %1:_(s64)
|
||||
@ -31,9 +30,7 @@ body: |
|
||||
; CHECK: liveins: $x0
|
||||
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
|
||||
; CHECK: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load 2)
|
||||
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SEXTLOAD]](s32)
|
||||
; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
|
||||
; CHECK: $w0 = COPY [[COPY2]](s32)
|
||||
; CHECK: $w0 = COPY [[SEXTLOAD]](s32)
|
||||
%0:_(p0) = COPY $x0
|
||||
%1:_(s32) = G_SEXTLOAD %0:_(p0) :: (load 2)
|
||||
%2:_(s32) = COPY %1:_(s32)
|
||||
@ -52,8 +49,7 @@ body: |
|
||||
; CHECK: liveins: $x0
|
||||
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
|
||||
; CHECK: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load 2)
|
||||
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SEXTLOAD]](s32)
|
||||
; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 24
|
||||
; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SEXTLOAD]], 24
|
||||
; CHECK: $w0 = COPY [[SEXT_INREG]](s32)
|
||||
%0:_(p0) = COPY $x0
|
||||
%1:_(s32) = G_SEXTLOAD %0:_(p0) :: (load 2)
|
||||
|
@ -0,0 +1,29 @@
|
||||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
||||
# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
|
||||
|
||||
...
|
||||
---
|
||||
name: postlegalize_copy_prop
|
||||
legalized: true
|
||||
tracksRegLiveness: true
|
||||
body: |
|
||||
bb.1.entry:
|
||||
liveins: $x0, $x1
|
||||
|
||||
; CHECK-LABEL: name: postlegalize_copy_prop
|
||||
; CHECK: liveins: $x0, $x1
|
||||
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
|
||||
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
|
||||
; CHECK: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[COPY1]]
|
||||
; CHECK: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[ADD]], [[ADD]]
|
||||
; CHECK: $x0 = COPY [[ADD1]](s64)
|
||||
; CHECK: RET_ReallyLR
|
||||
%0:_(s64) = COPY $x0
|
||||
%1:_(s64) = COPY $x1
|
||||
%2:_(s64) = G_ADD %0, %1
|
||||
%3:_(s64) = COPY %2
|
||||
%4:_(s64) = G_ADD %3, %3
|
||||
$x0 = COPY %4
|
||||
RET_ReallyLR
|
||||
|
||||
...
|
Loading…
x
Reference in New Issue
Block a user