brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · 94c93ba Raw
165 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s3--- |4  declare void @foo()5  define void @self() { ret void }6  define void @self_with_copy() { ret void }7  define void @self_not_equivalent_overwrite_w0() { ret void }8  define void @self_not_equivalent_overwrite_w0_implicit() { ret void }9  define void @self_not_equivalent_different_copies() { ret void }10  define void @self_with_assert_zext() { ret void }11...12---13name:            self14tracksRegLiveness: true15body:             |16  bb.0:17    liveins: $w0, $w118    ; Optimize (cond ? %a : %a) -> %a19    ; CHECK-LABEL: name: self20    ; CHECK: liveins: $w0, $w121    ; CHECK-NEXT: {{  $}}22    ; CHECK-NEXT: %a:_(s32) = COPY $w023    ; CHECK-NEXT: $w0 = COPY %a(s32)24    ; CHECK-NEXT: RET_ReallyLR implicit $w025    %a:_(s32) = COPY $w026    %cond_wide:gpr(s32) = COPY $w127    %cond:gpr(s1) = G_TRUNC %cond_wide(s32)28    %select:_(s32) = G_SELECT %cond(s1), %a, %a29    $w0 = COPY %select(s32)30    RET_ReallyLR implicit $w031 32...33---34name:            self_with_copy35tracksRegLiveness: true36body:             |37  bb.0:38    liveins: $w0, $w139    ; Optimize (cond ? %a : %b) -> %a40    ; This shows that we are looking through copies correctly and deduce that41    ; %b is a copy from %a.42    ; CHECK-LABEL: name: self_with_copy43    ; CHECK: liveins: $w0, $w144    ; CHECK-NEXT: {{  $}}45    ; CHECK-NEXT: %a:_(s32) = COPY $w046    ; CHECK-NEXT: $w0 = COPY %a(s32)47    ; CHECK-NEXT: RET_ReallyLR implicit $w048    %a:_(s32) = COPY $w049    %b:_(s32) = COPY %a50    %cond_wide:gpr(s32) = COPY $w151    %cond:gpr(s1) = G_TRUNC %cond_wide(s32)52    %select:_(s32) = G_SELECT %cond(s1), %a, %b53    $w0 = COPY %select(s32)54    RET_ReallyLR implicit $w055 56...57---58name:            self_not_equivalent_overwrite_w059tracksRegLiveness: true60body:             |61  bb.0:62    liveins: $w0, $w163    ; $w0 is overwritten by a copy from $w1, so the copies for %a and %b are64    ; not the same.65    ; CHECK-LABEL: name: self_not_equivalent_overwrite_w066    ; CHECK: liveins: $w0, $w167    ; CHECK-NEXT: {{  $}}68    ; CHECK-NEXT: %a:_(s32) = COPY $w069    ; CHECK-NEXT: $w0 = COPY $w170    ; CHECK-NEXT: %b:_(s32) = COPY $w071    ; CHECK-NEXT: %cond_wide:gpr(s32) = COPY $w172    ; CHECK-NEXT: %cond:gpr(s1) = G_TRUNC %cond_wide(s32)73    ; CHECK-NEXT: %select:_(s32) = G_SELECT %cond(s1), %a, %b74    ; CHECK-NEXT: $w0 = COPY %select(s32)75    ; CHECK-NEXT: RET_ReallyLR implicit $w076    %a:_(s32) = COPY $w077    $w0 = COPY $w178    %b:_(s32) = COPY $w079    %cond_wide:gpr(s32) = COPY $w180    %cond:gpr(s1) = G_TRUNC %cond_wide(s32)81    %select:_(s32) = G_SELECT %cond(s1), %a, %b82    $w0 = COPY %select(s32)83    RET_ReallyLR implicit $w084 85...86---87name:            self_not_equivalent_overwrite_w0_implicit88tracksRegLiveness: true89body:             |90  bb.0:91    liveins: $w0, $w192    ; $w0 is overwritten by a call which defines it implicitly, so the copies93    ; are not the same.94    ; CHECK-LABEL: name: self_not_equivalent_overwrite_w0_implicit95    ; CHECK: liveins: $w0, $w196    ; CHECK-NEXT: {{  $}}97    ; CHECK-NEXT: %a:_(s32) = COPY $w098    ; CHECK-NEXT: BL @foo, implicit-def $w099    ; CHECK-NEXT: %b:_(s32) = COPY $w0100    ; CHECK-NEXT: %cond_wide:gpr(s32) = COPY $w1101    ; CHECK-NEXT: %cond:gpr(s1) = G_TRUNC %cond_wide(s32)102    ; CHECK-NEXT: %select:_(s32) = G_SELECT %cond(s1), %a, %b103    ; CHECK-NEXT: $w0 = COPY %select(s32)104    ; CHECK-NEXT: RET_ReallyLR implicit $w0105    %a:_(s32) = COPY $w0106    BL @foo, implicit-def $w0107    %b:_(s32) = COPY $w0108    %cond_wide:gpr(s32) = COPY $w1109    %cond:gpr(s1) = G_TRUNC %cond_wide(s32)110    %select:_(s32) = G_SELECT %cond(s1), %a, %b111    $w0 = COPY %select(s32)112    RET_ReallyLR implicit $w0113 114...115---116name:            self_not_equivalent_different_copies117tracksRegLiveness: true118body:             |119  bb.0:120    liveins: $w0, $w1121    ; In this case, the copies are not equivalent, so there is no optimization.122    ; CHECK-LABEL: name: self_not_equivalent_different_copies123    ; CHECK: liveins: $w0, $w1124    ; CHECK-NEXT: {{  $}}125    ; CHECK-NEXT: %a:_(s32) = COPY $w0126    ; CHECK-NEXT: %b:_(s32) = COPY $w1127    ; CHECK-NEXT: %cond_wide:gpr(s32) = COPY $w1128    ; CHECK-NEXT: %cond:gpr(s1) = G_TRUNC %cond_wide(s32)129    ; CHECK-NEXT: %select:_(s32) = G_SELECT %cond(s1), %a, %b130    ; CHECK-NEXT: $w0 = COPY %select(s32)131    ; CHECK-NEXT: RET_ReallyLR implicit $w0132    %a:_(s32) = COPY $w0133    %b:_(s32) = COPY $w1134    %c:_(s32) = COPY %b135    %cond_wide:gpr(s32) = COPY $w1136    %cond:gpr(s1) = G_TRUNC %cond_wide(s32)137    %select:_(s32) = G_SELECT %cond(s1), %a, %c138    $w0 = COPY %select(s32)139    RET_ReallyLR implicit $w0140 141...142---143name:            self_with_assert_zext144tracksRegLiveness: true145body:             |146  bb.0:147    liveins: $w0, $w1148    ; We should walk through G_ASSERT_ZEXT as if it's a copy, and remove the149    ; G_SELECT.150    ; CHECK-LABEL: name: self_with_assert_zext151    ; CHECK: liveins: $w0, $w1152    ; CHECK-NEXT: {{  $}}153    ; CHECK-NEXT: %a:_(s32) = COPY $w0154    ; CHECK-NEXT: %a_assert_zext:_(s32) = G_ASSERT_ZEXT %a, 16155    ; CHECK-NEXT: $w0 = COPY %a_assert_zext(s32)156    ; CHECK-NEXT: RET_ReallyLR implicit $w0157    %a:_(s32) = COPY $w0158    %a_assert_zext:_(s32) = G_ASSERT_ZEXT %a, 16159    %b:_(s32) = COPY %a_assert_zext160    %cond_wide:gpr(s32) = COPY $w1161    %cond:gpr(s1) = G_TRUNC %cond_wide(s32)162    %select:_(s32) = G_SELECT %cond(s1), %a_assert_zext, %b163    $w0 = COPY %select(s32)164    RET_ReallyLR implicit $w0165