129 lines · plain
1# RUN: llc -mtriple=aarch64-linux-gnu -run-pass machine-cp -mcp-use-is-copy-instr -o - %s | FileCheck %s2# Tests for MachineCopyPropagation copy forwarding.3---4# Simple forwarding.5# CHECK-LABEL: name: test16# CHECK: $x0 = SUBXri $x0, 1, 07name: test18tracksRegLiveness: true9body: |10 bb.0:11 liveins: $x012 renamable $x1 = COPY $x013 $x0 = SUBXri renamable $x1, 1, 014...15---16# Don't forward if not renamable.17# CHECK-LABEL: name: test218# CHECK: $x0 = SUBXri $x1, 1, 019name: test220tracksRegLiveness: true21body: |22 bb.0:23 liveins: $x024 $x1 = COPY $x025 $x0 = SUBXri $x1, 1, 026...27---28# Don't forward reserved non-constant reg values.29# CHECK-LABEL: name: test430# CHECK: $x0 = SUBXri renamable $x1, 1, 031name: test432tracksRegLiveness: true33body: |34 bb.0:35 liveins: $x036 $sp = SUBXri $sp, 16, 037 renamable $x1 = COPY $sp38 $x0 = SUBXri renamable $x1, 1, 039 $sp = ADDXri $sp, 16, 040...41---42# Don't violate opcode constraints when forwarding.43# CHECK-LABEL: name: test544# CHECK: $x0 = SUBXri renamable $x1, 1, 045name: test546tracksRegLiveness: true47body: |48 bb.0:49 liveins: $x050 renamable $x1 = COPY $xzr51 $x0 = SUBXri renamable $x1, 1, 052...53---54# Test cross-class COPY forwarding.55# CHECK-LABEL: name: test656# CHECK: $x2 = COPY $x057name: test658tracksRegLiveness: true59body: |60 bb.0:61 liveins: $x062 renamable $d1 = COPY $x063 $x2 = COPY renamable $d164 RET_ReallyLR implicit $x265...66---67# Don't forward if there are overlapping implicit operands.68# CHECK-LABEL: name: test769# CHECK: $w0 = SUBWri killed renamable $w1, 1, 070name: test771tracksRegLiveness: true72body: |73 bb.0:74 liveins: $w075 renamable $w1 = COPY $w076 $w0 = SUBWri killed renamable $w1, 1, 0, implicit killed $x177...78---79# Check that kill flags are cleared.80# CHECK-LABEL: name: test881# CHECK: $x2 = ADDXri $x0, 1, 082# CHECK: $x0 = SUBXri $x0, 1, 083name: test884tracksRegLiveness: true85body: |86 bb.0:87 liveins: $x088 renamable $x1 = COPY $x089 $x2 = ADDXri killed $x0, 1, 090 $x0 = SUBXri renamable $x1, 1, 091...92---93# Don't forward if value is clobbered.94# CHECK-LABEL: name: test995# CHECK: $x2 = SUBXri renamable $x1, 1, 096name: test997tracksRegLiveness: true98body: |99 bb.0:100 liveins: $x0101 renamable $x1 = COPY $x0102 $x0 = ADDXri $x0, 1, 0103 $x2 = SUBXri renamable $x1, 1, 0104...105---106# CHECK-LABEL: name: test1_orr_as_copy107# CHECK: STRBBui $wzr, killed renamable $x8, 36108name: test1_orr_as_copy109tracksRegLiveness: true110body: |111 bb.0:112 liveins: $x8113 $w9 = ORRWrs $wzr, $wzr, 0114 STRBBui killed renamable $w9, killed renamable $x8, 36115...116---117# CHECK-LABEL: name: make_sure_w29_and_fp_isnt_removed118# CHECK: $w29 = ORRWrs $wzr, $w29, 0, implicit $fp, implicit-def $fp119name: make_sure_w29_and_fp_isnt_removed120tracksRegLiveness: true121frameInfo:122 maxCallFrameSize: 32123body: |124 bb.0:125 liveins: $x8, $fp126 $w29 = ORRWrs $wzr, $w29, 0, implicit $fp, implicit-def $fp127 renamable $q0 = LDRQroX killed renamable $x8, $fp, 0, 1128...129