brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · b2d2f99 Raw
134 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--- |5  @g = external hidden unnamed_addr global i32, align 46  define void @not_necessarily_equiv_loads() { ret void }7  define void @invariant_loads() { ret void }8  define void @both_have_to_be_invariant_1() { ret void }9  define void @both_have_to_be_invariant_2() { ret void }10  define void @both_have_to_have_same_size() { ret void }11 12...13---14name:            not_necessarily_equiv_loads15tracksRegLiveness: true16machineFunctionInfo: {}17body:             |18  bb.0:19 20    ; %load1 || %load2 == %load1 is not necessarily true, even though they21    ; both load from the same address. Whatever is in that address may be22    ; changed by another instruction which appears between them.23    ; Check that we don't remove the G_OR.24 25    ; CHECK-LABEL: name: not_necessarily_equiv_loads26    ; CHECK: %ptr:_(p0) = G_GLOBAL_VALUE @g27    ; CHECK-NEXT: %load1:_(s32) = G_LOAD %ptr(p0) :: (load (s32) from @g)28    ; CHECK-NEXT: %load2:_(s32) = G_LOAD %ptr(p0) :: (load (s32) from @g)29    ; CHECK-NEXT: %or:_(s32) = G_OR %load2, %load130    ; CHECK-NEXT: G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)31    ; CHECK-NEXT: RET_ReallyLR32    %ptr:_(p0) = G_GLOBAL_VALUE @g33    %load1:_(s32) = G_LOAD %ptr(p0) :: (load (s32) from @g)34    %load2:_(s32) = G_LOAD %ptr(p0) :: (load (s32) from @g)35    %or:_(s32) = G_OR %load2, %load136    G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)37    RET_ReallyLR38 39...40---41name:            invariant_loads42tracksRegLiveness: true43machineFunctionInfo: {}44body:             |45  bb.0:46 47    ; %load1 || %load2 == %load1 is fine here, because the loads are invariant.48    ; TODO: Loads need to be CSE'd for this to work.49 50    ; CHECK-LABEL: name: invariant_loads51    ; CHECK: %ptr:_(p0) = G_GLOBAL_VALUE @g52    ; CHECK-NEXT: %load1:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)53    ; CHECK-NEXT: %load2:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)54    ; CHECK-NEXT: %or:_(s32) = G_OR %load2, %load155    ; CHECK-NEXT: G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)56    ; CHECK-NEXT: RET_ReallyLR57    %ptr:_(p0) = G_GLOBAL_VALUE @g58    %load1:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)59    %load2:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)60    %or:_(s32) = G_OR %load2, %load161    G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)62    RET_ReallyLR63 64...65---66name:            both_have_to_be_invariant_167tracksRegLiveness: true68machineFunctionInfo: {}69body:             |70  bb.0:71 72    ; We shouldn't combine here, because the loads both have to be invariant.73 74    ; CHECK-LABEL: name: both_have_to_be_invariant_175    ; CHECK: %ptr:_(p0) = G_GLOBAL_VALUE @g76    ; CHECK-NEXT: %load1:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)77    ; CHECK-NEXT: %load2:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable load (s32) from @g)78    ; CHECK-NEXT: %or:_(s32) = G_OR %load2, %load179    ; CHECK-NEXT: G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)80    ; CHECK-NEXT: RET_ReallyLR81    %ptr:_(p0) = G_GLOBAL_VALUE @g82    %load1:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)83    %load2:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable load (s32) from @g)84    %or:_(s32) = G_OR %load2, %load185    G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)86    RET_ReallyLR87...88---89name:            both_have_to_be_invariant_290tracksRegLiveness: true91machineFunctionInfo: {}92body:             |93  bb.0:94 95    ; We shouldn't combine here, because the loads both have to be invariant.96 97    ; CHECK-LABEL: name: both_have_to_be_invariant_298    ; CHECK: %ptr:_(p0) = G_GLOBAL_VALUE @g99    ; CHECK-NEXT: %load1:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable load (s32) from @g)100    ; CHECK-NEXT: %load2:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)101    ; CHECK-NEXT: %or:_(s32) = G_OR %load2, %load1102    ; CHECK-NEXT: G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)103    ; CHECK-NEXT: RET_ReallyLR104    %ptr:_(p0) = G_GLOBAL_VALUE @g105    %load1:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable load (s32) from @g)106    %load2:_(s32) = G_LOAD %ptr(p0) :: (dereferenceable invariant load (s32) from @g)107    %or:_(s32) = G_OR %load2, %load1108    G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)109    RET_ReallyLR110...111---112name:            both_have_to_have_same_size113tracksRegLiveness: true114machineFunctionInfo: {}115body:             |116  bb.0:117 118    ; We shouldn't combine here, because the loads both have to have the same size.119 120    ; CHECK-LABEL: name: both_have_to_have_same_size121    ; CHECK: %ptr:_(p0) = G_GLOBAL_VALUE @g122    ; CHECK-NEXT: %load1:_(s32) = G_ZEXTLOAD %ptr(p0) :: (dereferenceable invariant load (s8) from @g)123    ; CHECK-NEXT: %load2:_(s32) = G_ZEXTLOAD %ptr(p0) :: (dereferenceable invariant load (s16) from @g)124    ; CHECK-NEXT: %or:_(s32) = G_OR %load2, %load1125    ; CHECK-NEXT: G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)126    ; CHECK-NEXT: RET_ReallyLR127    %ptr:_(p0) = G_GLOBAL_VALUE @g128    %load1:_(s32) = G_ZEXTLOAD %ptr(p0) :: (dereferenceable invariant load (s8) from @g)129    %load2:_(s32) = G_ZEXTLOAD %ptr(p0) :: (dereferenceable invariant load (s16) from @g)130    %or:_(s32) = G_OR %load2, %load1131    G_STORE %or(s32), %ptr(p0) :: (store (s32) into @g)132    RET_ReallyLR133...134