brintos

brintos / llvm-project-archived public Read only

0
0
Text · 64.1 KiB · 131dcbf Raw
1709 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -debugify-and-strip-all-safe -mtriple aarch64 -O0 -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombiner-only-enable-rule="load_or_combine" -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=LITTLE3# RUN: llc -debugify-and-strip-all-safe -mtriple arm64eb -O0 -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombiner-only-enable-rule="load_or_combine" -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=BIG4 5# REQUIRES: asserts6 7# Test that we can combine patterns like8#9# s8* x = ...10# s32 y = (x[0] | (x[1] << 8)) | ((x[2] << 16) | (x[3] << 24))11#12# Into either a load, or a load with a bswap.13 14...15---16name:            s8_loads_to_s32_little_endian_pat17tracksRegLiveness: true18body:             |19  bb.0:20    liveins: $x0, $x121 22    ; s8* x = ...23    ; s32 y = (x[0] | (x[1] << 8)) | ((x[2] << 16) | (x[3] << 24))24    ; -> Little endian: Load from x[0]25    ; -> Big endian: Load from x[0] + BSWAP26 27    ; LITTLE-LABEL: name: s8_loads_to_s32_little_endian_pat28    ; LITTLE: liveins: $x0, $x129    ; LITTLE-NEXT: {{  $}}30    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x131    ; LITTLE-NEXT: %full_load:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 1)32    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)33    ; LITTLE-NEXT: RET_ReallyLR implicit $w134    ;35    ; BIG-LABEL: name: s8_loads_to_s32_little_endian_pat36    ; BIG: liveins: $x0, $x137    ; BIG-NEXT: {{  $}}38    ; BIG-NEXT: %ptr:_(p0) = COPY $x139    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 1)40    ; BIG-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]41    ; BIG-NEXT: $w1 = COPY %full_load(s32)42    ; BIG-NEXT: RET_ReallyLR implicit $w143    %cst_1:_(s64) = G_CONSTANT i64 144    %cst_2:_(s64) = G_CONSTANT i64 245    %cst_3:_(s64) = G_CONSTANT i64 346 47    %cst_8:_(s32) = G_CONSTANT i32 848    %cst_16:_(s32) = G_CONSTANT i32 1649    %cst_24:_(s32) = G_CONSTANT i32 2450 51    %ptr:_(p0) = COPY $x152    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)53    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)54    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)55 56    %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))57 58    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))59    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))60    %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))61 62    %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)63    %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)64    %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)65 66    ; Note the shape of the tree:67    ; byte byte byte  byte68    ;  \   /      \  /69    ;    OR        OR70    ;     \       /71    ;       \    /72    ;         OR73 74    %or1:_(s32) = G_OR %byte0, %byte175    %or2:_(s32) = G_OR %byte2, %byte376    %full_load:_(s32) = G_OR %or1, %or277 78    $w1 = COPY %full_load(s32)79    RET_ReallyLR implicit $w180 81...82---83name:            s8_loads_to_s32_big_endian_pat84tracksRegLiveness: true85body:             |86  bb.0:87    liveins: $x0, $x188 89    ; s8* x = ...90    ; s32 y = (x[0] << 24 | (x[1] << 16)) | ((x[2] << 8) | x[3]))91    ; -> Little endian: Load from x[0] + BSWAP92    ; -> Big endian: Load from x[0]93 94    ; LITTLE-LABEL: name: s8_loads_to_s32_big_endian_pat95    ; LITTLE: liveins: $x0, $x196    ; LITTLE-NEXT: {{  $}}97    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x198    ; LITTLE-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 1)99    ; LITTLE-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]100    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)101    ; LITTLE-NEXT: RET_ReallyLR implicit $w1102    ;103    ; BIG-LABEL: name: s8_loads_to_s32_big_endian_pat104    ; BIG: liveins: $x0, $x1105    ; BIG-NEXT: {{  $}}106    ; BIG-NEXT: %ptr:_(p0) = COPY $x1107    ; BIG-NEXT: %full_load:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 1)108    ; BIG-NEXT: $w1 = COPY %full_load(s32)109    ; BIG-NEXT: RET_ReallyLR implicit $w1110    %cst_1:_(s64) = G_CONSTANT i64 1111    %cst_2:_(s64) = G_CONSTANT i64 2112    %cst_3:_(s64) = G_CONSTANT i64 3113 114    %cst_8:_(s32) = G_CONSTANT i32 8115    %cst_16:_(s32) = G_CONSTANT i32 16116    %cst_24:_(s32) = G_CONSTANT i32 24117 118    %ptr:_(p0) = COPY $x1119    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)120    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)121    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)122 123    %elt0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))124    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))125    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))126 127    %byte0:_(s32) = nuw G_SHL %elt0, %cst_24(s32)128    %byte1:_(s32) = nuw G_SHL %elt1, %cst_16(s32)129    %byte2:_(s32) = nuw G_SHL %elt2, %cst_8(s32)130    %byte3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))131 132    %or1:_(s32) = G_OR %byte0, %byte1133    %or2:_(s32) = G_OR %byte2, %byte3134    %full_load:_(s32) = G_OR %or1, %or2135 136    $w1 = COPY %full_load(s32)137    RET_ReallyLR implicit $w1138 139...140---141name:            different_or_pattern142tracksRegLiveness: true143body:             |144  bb.0:145    liveins: $x0, $x1146 147    ; Slightly different OR tree.148    ; s8* x = ...149    ; s32 y = (((x[0] | (x[1] << 8)) | (x[2] << 16)) | (x[3] << 24))150    ; -> Little endian: Load from x[0]151    ; -> Big endian: Load from x[0] + BSWAP152 153    ; LITTLE-LABEL: name: different_or_pattern154    ; LITTLE: liveins: $x0, $x1155    ; LITTLE-NEXT: {{  $}}156    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1157    ; LITTLE-NEXT: %full_load:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 1)158    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)159    ; LITTLE-NEXT: RET_ReallyLR implicit $w1160    ;161    ; BIG-LABEL: name: different_or_pattern162    ; BIG: liveins: $x0, $x1163    ; BIG-NEXT: {{  $}}164    ; BIG-NEXT: %ptr:_(p0) = COPY $x1165    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 1)166    ; BIG-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]167    ; BIG-NEXT: $w1 = COPY %full_load(s32)168    ; BIG-NEXT: RET_ReallyLR implicit $w1169    %cst_1:_(s64) = G_CONSTANT i64 1170    %cst_2:_(s64) = G_CONSTANT i64 2171    %cst_3:_(s64) = G_CONSTANT i64 3172 173    %cst_8:_(s32) = G_CONSTANT i32 8174    %cst_16:_(s32) = G_CONSTANT i32 16175    %cst_24:_(s32) = G_CONSTANT i32 24176 177    %ptr:_(p0) = COPY $x1178    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)179    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)180    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)181 182    %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))183 184    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))185    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))186    %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))187 188    %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)189    %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)190    %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)191 192    ; Note the shape of the tree:193    ; byte   byte194    ;  \    /195    ;   OR_1   byte196    ;    \    /197    ;     OR_2198    ;       \199    ;        ...200 201    %or1:_(s32) = G_OR %byte0, %byte1202    %or2:_(s32) = G_OR %or1, %byte2203    %full_load:_(s32) = G_OR %or2, %byte3204 205    $w1 = COPY %full_load(s32)206    RET_ReallyLR implicit $w1207 208...209---210name:            s16_loads_to_s32_little_endian_pat211tracksRegLiveness: true212body:             |213  bb.0:214    liveins: $x0, $x1215 216    ; s16* x = ...217    ; s32 y = x[0] | (x[1] << 16)218    ; -> Little endian: Load from x[0]219    ; -> Big endian: Load from x[0] + BSWAP220 221    ; LITTLE-LABEL: name: s16_loads_to_s32_little_endian_pat222    ; LITTLE: liveins: $x0, $x1223    ; LITTLE-NEXT: {{  $}}224    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1225    ; LITTLE-NEXT: %full_load:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 2)226    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)227    ; LITTLE-NEXT: RET_ReallyLR implicit $w1228    ;229    ; BIG-LABEL: name: s16_loads_to_s32_little_endian_pat230    ; BIG: liveins: $x0, $x1231    ; BIG-NEXT: {{  $}}232    ; BIG-NEXT: %ptr:_(p0) = COPY $x1233    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 2)234    ; BIG-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]235    ; BIG-NEXT: $w1 = COPY %full_load(s32)236    ; BIG-NEXT: RET_ReallyLR implicit $w1237    %cst_1:_(s64) = G_CONSTANT i64 1238    %cst_16:_(s32) = G_CONSTANT i32 16239 240    %ptr:_(p0) = COPY $x1241    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)242 243    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))244    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))245    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)246 247    %full_load:_(s32) = G_OR %low_half, %high_half248    $w1 = COPY %full_load(s32)249    RET_ReallyLR implicit $w1250 251...252---253name:            s16_loads_to_s32_big_endian_pat254tracksRegLiveness: true255body:             |256  bb.0:257    liveins: $x0, $x1258 259    ; s16 *x = ...260    ; s32 y = x[1] | (x[0] << 16)261    ; -> Little endian: Load from x[0] + BSWAP262    ; -> Big endian: Load from x[0]263 264    ; LITTLE-LABEL: name: s16_loads_to_s32_big_endian_pat265    ; LITTLE: liveins: $x0, $x1266    ; LITTLE-NEXT: {{  $}}267    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1268    ; LITTLE-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 2)269    ; LITTLE-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]270    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)271    ; LITTLE-NEXT: RET_ReallyLR implicit $w1272    ;273    ; BIG-LABEL: name: s16_loads_to_s32_big_endian_pat274    ; BIG: liveins: $x0, $x1275    ; BIG-NEXT: {{  $}}276    ; BIG-NEXT: %ptr:_(p0) = COPY $x1277    ; BIG-NEXT: %full_load:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 2)278    ; BIG-NEXT: $w1 = COPY %full_load(s32)279    ; BIG-NEXT: RET_ReallyLR implicit $w1280    %cst_1:_(s64) = G_CONSTANT i64 1281    %cst_16:_(s32) = G_CONSTANT i32 16282 283    %ptr:_(p0) = COPY $x1284    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)285 286    %elt0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))287    %high_half:_(s32) = nuw G_SHL %elt0, %cst_16(s32)288    %low_half:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))289 290    %full_load:_(s32) = G_OR %low_half, %high_half291    $w1 = COPY %full_load(s32)292    RET_ReallyLR implicit $w1293 294...295---296name:            s16_loads_to_s64_little_endian_pat297tracksRegLiveness: true298body:             |299  bb.0:300    liveins: $x0, $x1301 302    ; s16 *x = ...303    ; s32 y = (x[0] | (x[1] << 16)) | ((x[2] << 32) | (x[3] << 48))304    ; -> Little endian: Load from x[0]305    ; -> Big endian: Load from x[0] + BSWAP306 307    ; LITTLE-LABEL: name: s16_loads_to_s64_little_endian_pat308    ; LITTLE: liveins: $x0, $x1309    ; LITTLE-NEXT: {{  $}}310    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1311    ; LITTLE-NEXT: %full_load:_(s64) = G_LOAD %ptr(p0) :: (load (s64), align 2)312    ; LITTLE-NEXT: $x1 = COPY %full_load(s64)313    ; LITTLE-NEXT: RET_ReallyLR implicit $x1314    ;315    ; BIG-LABEL: name: s16_loads_to_s64_little_endian_pat316    ; BIG: liveins: $x0, $x1317    ; BIG-NEXT: {{  $}}318    ; BIG-NEXT: %ptr:_(p0) = COPY $x1319    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD %ptr(p0) :: (load (s64), align 2)320    ; BIG-NEXT: %full_load:_(s64) = G_BSWAP [[LOAD]]321    ; BIG-NEXT: $x1 = COPY %full_load(s64)322    ; BIG-NEXT: RET_ReallyLR implicit $x1323    %cst_1:_(s64) = G_CONSTANT i64 1324    %cst_2:_(s64) = G_CONSTANT i64 2325    %cst_3:_(s64) = G_CONSTANT i64 3326 327    %cst_16:_(s64) = G_CONSTANT i64 16328    %cst_32:_(s64) = G_CONSTANT i64 32329    %cst_48:_(s64) = G_CONSTANT i64 48330 331    %ptr:_(p0) = COPY $x1332    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)333    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)334    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)335 336    %byte0_byte1:_(s64) = G_ZEXTLOAD %ptr(p0) :: (load (s16))337 338    %elt1:_(s64) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))339    %elt2:_(s64) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s16))340    %elt3:_(s64) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s16))341 342    %byte2_byte3:_(s64) = nuw G_SHL %elt1, %cst_16(s64)343    %byte4_byte5:_(s64) = nuw G_SHL %elt2, %cst_32(s64)344    %byte6_byte7:_(s64) = nuw G_SHL %elt3, %cst_48(s64)345 346    %or1:_(s64) = G_OR %byte0_byte1, %byte2_byte3347    %or2:_(s64) = G_OR %byte4_byte5, %byte6_byte7348    %full_load:_(s64) = G_OR %or1, %or2349 350    $x1 = COPY %full_load(s64)351    RET_ReallyLR implicit $x1352 353...354---355name:            s16_loads_to_s64_big_endian_pat356tracksRegLiveness: true357body:             |358  bb.0:359    liveins: $x0, $x1360 361    ; s16 *x = ...362    ; s64 y = (x[3] | (x[2] << 16)) | ((x[1] << 32) | (x[0] << 48))363    ; -> Little endian: Load from x[0] + BSWAP364    ; -> Big endian: Load from x[0]365 366    ; LITTLE-LABEL: name: s16_loads_to_s64_big_endian_pat367    ; LITTLE: liveins: $x0, $x1368    ; LITTLE-NEXT: {{  $}}369    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1370    ; LITTLE-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD %ptr(p0) :: (load (s64), align 2)371    ; LITTLE-NEXT: %full_load:_(s64) = G_BSWAP [[LOAD]]372    ; LITTLE-NEXT: $x1 = COPY %full_load(s64)373    ; LITTLE-NEXT: RET_ReallyLR implicit $x1374    ;375    ; BIG-LABEL: name: s16_loads_to_s64_big_endian_pat376    ; BIG: liveins: $x0, $x1377    ; BIG-NEXT: {{  $}}378    ; BIG-NEXT: %ptr:_(p0) = COPY $x1379    ; BIG-NEXT: %full_load:_(s64) = G_LOAD %ptr(p0) :: (load (s64), align 2)380    ; BIG-NEXT: $x1 = COPY %full_load(s64)381    ; BIG-NEXT: RET_ReallyLR implicit $x1382    %cst_1:_(s64) = G_CONSTANT i64 1383    %cst_2:_(s64) = G_CONSTANT i64 2384    %cst_3:_(s64) = G_CONSTANT i64 3385 386    %cst_16:_(s64) = G_CONSTANT i64 16387    %cst_32:_(s64) = G_CONSTANT i64 32388    %cst_48:_(s64) = G_CONSTANT i64 48389 390    %ptr:_(p0) = COPY $x1391    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)392    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)393    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)394 395    %elt0:_(s64) = G_ZEXTLOAD %ptr(p0) :: (load (s16))396    %elt1:_(s64) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))397    %elt2:_(s64) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s16))398 399    %byte0_byte1:_(s64) = nuw G_SHL %elt0, %cst_48(s64)400    %byte2_byte3:_(s64) = nuw G_SHL %elt1, %cst_32(s64)401    %byte4_byte5:_(s64) = nuw G_SHL %elt2, %cst_16(s64)402    %byte6_byte7:_(s64) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s16))403 404    %or1:_(s64) = G_OR %byte0_byte1, %byte2_byte3405    %or2:_(s64) = G_OR %byte4_byte5, %byte6_byte7406    %full_load:_(s64) = G_OR %or1, %or2407 408    $x1 = COPY %full_load(s64)409    RET_ReallyLR implicit $x1410 411 412...413---414name:            nonzero_start_idx_positive_little_endian_pat415tracksRegLiveness: true416body:             |417  bb.0:418    liveins: $x0, $x1419 420    ; s8* x = ...421    ; s32 y = (x[1] | (x[2] << 8)) | ((x[3] << 16) | (x[4] << 24))422    ; -> Little endian: Load from x[1]423    ; -> Big endian: Load from x[1] + BSWAP424 425    ; LITTLE-LABEL: name: nonzero_start_idx_positive_little_endian_pat426    ; LITTLE: liveins: $x0, $x1427    ; LITTLE-NEXT: {{  $}}428    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1429    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x0430    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)431    ; LITTLE-NEXT: %full_load:_(s32) = G_LOAD %ptr_elt_1(p0) :: (load (s32), align 1)432    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)433    ; LITTLE-NEXT: RET_ReallyLR implicit $w1434    ;435    ; BIG-LABEL: name: nonzero_start_idx_positive_little_endian_pat436    ; BIG: liveins: $x0, $x1437    ; BIG-NEXT: {{  $}}438    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1439    ; BIG-NEXT: %ptr:_(p0) = COPY $x0440    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)441    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr_elt_1(p0) :: (load (s32), align 1)442    ; BIG-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]443    ; BIG-NEXT: $w1 = COPY %full_load(s32)444    ; BIG-NEXT: RET_ReallyLR implicit $w1445    %cst_1:_(s64) = G_CONSTANT i64 1446    %cst_2:_(s64) = G_CONSTANT i64 2447    %cst_3:_(s64) = G_CONSTANT i64 3448    %cst_4:_(s64) = G_CONSTANT i64 4449 450    %cst_8:_(s32) = G_CONSTANT i32 8451    %cst_16:_(s32) = G_CONSTANT i32 16452    %cst_24:_(s32) = G_CONSTANT i32 24453 454    %ptr:_(p0) = COPY $x0455    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)456    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)457    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)458    %ptr_elt_4:_(p0) = G_PTR_ADD %ptr, %cst_4(s64)459 460    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))461    %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))462    %elt4:_(s32) = G_ZEXTLOAD %ptr_elt_4(p0) :: (load (s8))463 464    %byte0:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))465    %byte1:_(s32) = nuw G_SHL %elt2, %cst_8(s32)466    %byte2:_(s32) = nuw G_SHL %elt3, %cst_16(s32)467    %byte3:_(s32) = nuw G_SHL %elt4, %cst_24(s32)468 469    %or1:_(s32) = G_OR %byte0, %byte1470    %or2:_(s32) = G_OR %byte2, %byte3471    %full_load:_(s32) = G_OR %or1, %or2472 473    $w1 = COPY %full_load(s32)474    RET_ReallyLR implicit $w1475 476...477---478name:            nonzero_start_idx_positive_big_endian_pat479tracksRegLiveness: true480body:             |481  bb.0:482    liveins: $x0, $x1483 484    ; s8* x = ...485    ; s32 y = (x[4] | (x[3] << 8)) | ((x[2] << 16) | (x[1] << 24))486    ; -> Little endian: Load from x[1] + BSWAP487    ; -> Big endian: Load from x[1]488 489    ; LITTLE-LABEL: name: nonzero_start_idx_positive_big_endian_pat490    ; LITTLE: liveins: $x0, $x1491    ; LITTLE-NEXT: {{  $}}492    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1493    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x0494    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)495    ; LITTLE-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr_elt_1(p0) :: (load (s32), align 1)496    ; LITTLE-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]497    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)498    ; LITTLE-NEXT: RET_ReallyLR implicit $w1499    ;500    ; BIG-LABEL: name: nonzero_start_idx_positive_big_endian_pat501    ; BIG: liveins: $x0, $x1502    ; BIG-NEXT: {{  $}}503    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1504    ; BIG-NEXT: %ptr:_(p0) = COPY $x0505    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)506    ; BIG-NEXT: %full_load:_(s32) = G_LOAD %ptr_elt_1(p0) :: (load (s32), align 1)507    ; BIG-NEXT: $w1 = COPY %full_load(s32)508    ; BIG-NEXT: RET_ReallyLR implicit $w1509    %cst_1:_(s64) = G_CONSTANT i64 1510    %cst_2:_(s64) = G_CONSTANT i64 2511    %cst_3:_(s64) = G_CONSTANT i64 3512    %cst_4:_(s64) = G_CONSTANT i64 4513 514    %cst_8:_(s32) = G_CONSTANT i32 8515    %cst_16:_(s32) = G_CONSTANT i32 16516    %cst_24:_(s32) = G_CONSTANT i32 24517 518    %ptr:_(p0) = COPY $x0519    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)520    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)521    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)522    %ptr_elt_4:_(p0) = G_PTR_ADD %ptr, %cst_4(s64)523 524    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))525    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))526    %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))527 528    %byte0:_(s32) = G_ZEXTLOAD %ptr_elt_4(p0) :: (load (s8))529    %byte1:_(s32) = nuw G_SHL %elt3, %cst_8(s32)530    %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)531    %byte3:_(s32) = nuw G_SHL %elt1, %cst_24(s32)532 533    %or1:_(s32) = G_OR %byte0, %byte1534    %or2:_(s32) = G_OR %byte2, %byte3535    %full_load:_(s32) = G_OR %or1, %or2536 537    $w1 = COPY %full_load(s32)538    RET_ReallyLR implicit $w1539 540...541---542name:            nonzero_start_idx_negative_little_endian_pat543tracksRegLiveness: true544body:             |545  bb.0:546    liveins: $x0, $x1547 548    ; s8* x = ...549    ; s32 y = (x[-3] | (x[-2] << 8)) | ((x[-1] << 16) | (x[0] << 24))550    ; -> Little endian: Load from x[-3]551    ; -> Big endian: Load from x[-3] + BSWAP552 553    ; LITTLE-LABEL: name: nonzero_start_idx_negative_little_endian_pat554    ; LITTLE: liveins: $x0, $x1555    ; LITTLE-NEXT: {{  $}}556    ; LITTLE-NEXT: %cst_neg_3:_(s64) = G_CONSTANT i64 -3557    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x0558    ; LITTLE-NEXT: %ptr_elt_neg_3:_(p0) = G_PTR_ADD %ptr, %cst_neg_3(s64)559    ; LITTLE-NEXT: %full_load:_(s32) = G_LOAD %ptr_elt_neg_3(p0) :: (load (s32), align 1)560    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)561    ; LITTLE-NEXT: RET_ReallyLR implicit $w1562    ;563    ; BIG-LABEL: name: nonzero_start_idx_negative_little_endian_pat564    ; BIG: liveins: $x0, $x1565    ; BIG-NEXT: {{  $}}566    ; BIG-NEXT: %cst_neg_3:_(s64) = G_CONSTANT i64 -3567    ; BIG-NEXT: %ptr:_(p0) = COPY $x0568    ; BIG-NEXT: %ptr_elt_neg_3:_(p0) = G_PTR_ADD %ptr, %cst_neg_3(s64)569    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr_elt_neg_3(p0) :: (load (s32), align 1)570    ; BIG-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]571    ; BIG-NEXT: $w1 = COPY %full_load(s32)572    ; BIG-NEXT: RET_ReallyLR implicit $w1573    %cst_neg_1:_(s64) = G_CONSTANT i64 -1574    %cst_neg_2:_(s64) = G_CONSTANT i64 -2575    %cst_neg_3:_(s64) = G_CONSTANT i64 -3576 577    %cst_8:_(s32) = G_CONSTANT i32 8578    %cst_16:_(s32) = G_CONSTANT i32 16579    %cst_24:_(s32) = G_CONSTANT i32 24580 581    %ptr:_(p0) = COPY $x0582    %ptr_elt_neg_3:_(p0) = G_PTR_ADD %ptr, %cst_neg_3(s64)583    %ptr_elt_neg_2:_(p0) = G_PTR_ADD %ptr, %cst_neg_2(s64)584    %ptr_elt_neg_1:_(p0) = G_PTR_ADD %ptr, %cst_neg_1(s64)585 586    %elt_neg_2:_(s32) = G_ZEXTLOAD %ptr_elt_neg_2(p0) :: (load (s8))587    %elt_neg_1:_(s32) = G_ZEXTLOAD %ptr_elt_neg_1(p0) :: (load (s8))588    %elt_0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))589 590    %byte0:_(s32) = G_ZEXTLOAD %ptr_elt_neg_3(p0) :: (load (s8))591    %byte1:_(s32) = nuw G_SHL %elt_neg_2, %cst_8(s32)592    %byte2:_(s32) = nuw G_SHL %elt_neg_1, %cst_16(s32)593    %byte3:_(s32) = nuw G_SHL %elt_0, %cst_24(s32)594 595    %or1:_(s32) = G_OR %byte0, %byte1596    %or2:_(s32) = G_OR %byte2, %byte3597    %full_load:_(s32) = G_OR %or1, %or2598 599    $w1 = COPY %full_load(s32)600    RET_ReallyLR implicit $w1601 602...603---604name:            nonzero_start_idx_negative_big_endian_pat605tracksRegLiveness: true606body:             |607  bb.0:608    liveins: $x0, $x1609 610    ; s8* x = ...611    ; s32 y = (x[0] | (x[-1] << 8)) | ((x[-2] << 16) | (x[-3] << 24))612    ; -> Little endian: Load from x[-3] + BSWAP613    ; -> Big endian: Load from x[-3]614 615    ; LITTLE-LABEL: name: nonzero_start_idx_negative_big_endian_pat616    ; LITTLE: liveins: $x0, $x1617    ; LITTLE-NEXT: {{  $}}618    ; LITTLE-NEXT: %cst_neg_3:_(s64) = G_CONSTANT i64 -3619    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x0620    ; LITTLE-NEXT: %ptr_elt_neg_3:_(p0) = G_PTR_ADD %ptr, %cst_neg_3(s64)621    ; LITTLE-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr_elt_neg_3(p0) :: (load (s32), align 1)622    ; LITTLE-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]623    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)624    ; LITTLE-NEXT: RET_ReallyLR implicit $w1625    ;626    ; BIG-LABEL: name: nonzero_start_idx_negative_big_endian_pat627    ; BIG: liveins: $x0, $x1628    ; BIG-NEXT: {{  $}}629    ; BIG-NEXT: %cst_neg_3:_(s64) = G_CONSTANT i64 -3630    ; BIG-NEXT: %ptr:_(p0) = COPY $x0631    ; BIG-NEXT: %ptr_elt_neg_3:_(p0) = G_PTR_ADD %ptr, %cst_neg_3(s64)632    ; BIG-NEXT: %full_load:_(s32) = G_LOAD %ptr_elt_neg_3(p0) :: (load (s32), align 1)633    ; BIG-NEXT: $w1 = COPY %full_load(s32)634    ; BIG-NEXT: RET_ReallyLR implicit $w1635    %cst_neg_1:_(s64) = G_CONSTANT i64 -1636    %cst_neg_2:_(s64) = G_CONSTANT i64 -2637    %cst_neg_3:_(s64) = G_CONSTANT i64 -3638 639    %cst_8:_(s32) = G_CONSTANT i32 8640    %cst_16:_(s32) = G_CONSTANT i32 16641    %cst_24:_(s32) = G_CONSTANT i32 24642 643    %ptr:_(p0) = COPY $x0644    %ptr_elt_neg_3:_(p0) = G_PTR_ADD %ptr, %cst_neg_3(s64)645    %ptr_elt_neg_2:_(p0) = G_PTR_ADD %ptr, %cst_neg_2(s64)646    %ptr_elt_neg_1:_(p0) = G_PTR_ADD %ptr, %cst_neg_1(s64)647 648    %elt_neg_3:_(s32) = G_ZEXTLOAD %ptr_elt_neg_3(p0) :: (load (s8))649    %elt_neg_2:_(s32) = G_ZEXTLOAD %ptr_elt_neg_2(p0) :: (load (s8))650    %elt_neg_1:_(s32) = G_ZEXTLOAD %ptr_elt_neg_1(p0) :: (load (s8))651    %elt_0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))652 653    %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))654    %byte1:_(s32) = nuw G_SHL %elt_neg_1, %cst_8(s32)655    %byte2:_(s32) = nuw G_SHL %elt_neg_2, %cst_16(s32)656    %byte3:_(s32) = nuw G_SHL %elt_neg_3, %cst_24(s32)657 658    %or1:_(s32) = G_OR %byte0, %byte1659    %or2:_(s32) = G_OR %byte2, %byte3660    %full_load:_(s32) = G_OR %or1, %or2661 662    $w1 = COPY %full_load(s32)663    RET_ReallyLR implicit $w1664 665...666---667name:            dont_combine_volatile668tracksRegLiveness: true669body:             |670  bb.0:671    liveins: $x0, $x1672 673    ; Combine should only happen with unordered loads.674 675    ; LITTLE-LABEL: name: dont_combine_volatile676    ; LITTLE: liveins: $x0, $x1677    ; LITTLE-NEXT: {{  $}}678    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1679    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 16680    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1681    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)682    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))683    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (volatile load (s16))684    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)685    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half686    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)687    ; LITTLE-NEXT: RET_ReallyLR implicit $w1688    ;689    ; BIG-LABEL: name: dont_combine_volatile690    ; BIG: liveins: $x0, $x1691    ; BIG-NEXT: {{  $}}692    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1693    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 16694    ; BIG-NEXT: %ptr:_(p0) = COPY $x1695    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)696    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))697    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (volatile load (s16))698    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)699    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half700    ; BIG-NEXT: $w1 = COPY %full_load(s32)701    ; BIG-NEXT: RET_ReallyLR implicit $w1702    %cst_1:_(s64) = G_CONSTANT i64 1703    %cst_16:_(s32) = G_CONSTANT i32 16704 705    %ptr:_(p0) = COPY $x1706    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)707 708    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))709    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (volatile load (s16))710    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)711 712    %full_load:_(s32) = G_OR %low_half, %high_half713    $w1 = COPY %full_load(s32)714    RET_ReallyLR implicit $w1715 716...717---718name:            dont_wrong_memop_size719tracksRegLiveness: true720body:             |721  bb.0:722    liveins: $x0, $x1723 724    ; Combine should only happen when the loads load the same size.725 726    ; LITTLE-LABEL: name: dont_wrong_memop_size727    ; LITTLE: liveins: $x0, $x1728    ; LITTLE-NEXT: {{  $}}729    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1730    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 16731    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1732    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)733    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))734    ; LITTLE-NEXT: %wrong_size_load:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))735    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %wrong_size_load, %cst_16(s32)736    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half737    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)738    ; LITTLE-NEXT: RET_ReallyLR implicit $w1739    ;740    ; BIG-LABEL: name: dont_wrong_memop_size741    ; BIG: liveins: $x0, $x1742    ; BIG-NEXT: {{  $}}743    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1744    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 16745    ; BIG-NEXT: %ptr:_(p0) = COPY $x1746    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)747    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))748    ; BIG-NEXT: %wrong_size_load:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))749    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %wrong_size_load, %cst_16(s32)750    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half751    ; BIG-NEXT: $w1 = COPY %full_load(s32)752    ; BIG-NEXT: RET_ReallyLR implicit $w1753    %cst_1:_(s64) = G_CONSTANT i64 1754    %cst_16:_(s32) = G_CONSTANT i32 16755 756    %ptr:_(p0) = COPY $x1757    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)758 759    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))760    %wrong_size_load:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))761    %high_half:_(s32) = nuw G_SHL %wrong_size_load, %cst_16(s32)762 763    %full_load:_(s32) = G_OR %low_half, %high_half764    $w1 = COPY %full_load(s32)765    RET_ReallyLR implicit $w1766 767...768---769name:            dont_combine_wrong_offset770tracksRegLiveness: true771body:             |772  bb.0:773    liveins: $x0, $x1774 775    ; This is not equivalent to a 32-bit load with/without a BSWAP:776    ; s16 *x = ...777    ; s32 y = x[0] | (x[1] << 24)778 779    ; LITTLE-LABEL: name: dont_combine_wrong_offset780    ; LITTLE: liveins: $x0, $x1781    ; LITTLE-NEXT: {{  $}}782    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1783    ; LITTLE-NEXT: %cst_24:_(s32) = G_CONSTANT i32 24784    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1785    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)786    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))787    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))788    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_24(s32)789    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half790    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)791    ; LITTLE-NEXT: RET_ReallyLR implicit $w1792    ;793    ; BIG-LABEL: name: dont_combine_wrong_offset794    ; BIG: liveins: $x0, $x1795    ; BIG-NEXT: {{  $}}796    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1797    ; BIG-NEXT: %cst_24:_(s32) = G_CONSTANT i32 24798    ; BIG-NEXT: %ptr:_(p0) = COPY $x1799    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)800    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))801    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))802    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_24(s32)803    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half804    ; BIG-NEXT: $w1 = COPY %full_load(s32)805    ; BIG-NEXT: RET_ReallyLR implicit $w1806    %cst_1:_(s64) = G_CONSTANT i64 1807    %cst_24:_(s32) = G_CONSTANT i32 24808 809    %ptr:_(p0) = COPY $x1810    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)811 812    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))813    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))814    %high_half:_(s32) = nuw G_SHL %elt1, %cst_24(s32)815 816    %full_load:_(s32) = G_OR %low_half, %high_half817    $w1 = COPY %full_load(s32)818    RET_ReallyLR implicit $w1819 820...821---822name:            dont_combine_wrong_offset_2823tracksRegLiveness: true824body:             |825  bb.0:826    liveins: $x0, $x1827 828    ; This does not correspond to a 32-bit load with/without a BSWAP:829    ; s16 *x = ...830    ; s32 y = x[0] | (x[1] << 8)831 832    ; LITTLE-LABEL: name: dont_combine_wrong_offset_2833    ; LITTLE: liveins: $x0, $x1834    ; LITTLE-NEXT: {{  $}}835    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1836    ; LITTLE-NEXT: %cst_8:_(s32) = G_CONSTANT i32 8837    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1838    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)839    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))840    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))841    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_8(s32)842    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half843    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)844    ; LITTLE-NEXT: RET_ReallyLR implicit $w1845    ;846    ; BIG-LABEL: name: dont_combine_wrong_offset_2847    ; BIG: liveins: $x0, $x1848    ; BIG-NEXT: {{  $}}849    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1850    ; BIG-NEXT: %cst_8:_(s32) = G_CONSTANT i32 8851    ; BIG-NEXT: %ptr:_(p0) = COPY $x1852    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)853    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))854    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))855    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_8(s32)856    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half857    ; BIG-NEXT: $w1 = COPY %full_load(s32)858    ; BIG-NEXT: RET_ReallyLR implicit $w1859    %cst_1:_(s64) = G_CONSTANT i64 1860    %cst_8:_(s32) = G_CONSTANT i32 8861 862    %ptr:_(p0) = COPY $x1863    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)864 865    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))866    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))867    %high_half:_(s32) = nuw G_SHL %elt1, %cst_8(s32)868 869    %full_load:_(s32) = G_OR %low_half, %high_half870    $w1 = COPY %full_load(s32)871    RET_ReallyLR implicit $w1872 873...874---875name:            dont_combine_missing_load876tracksRegLiveness: true877body:             |878  bb.0:879    liveins: $x0, $x1880 881    ; This is missing x[2], so we shouldn't combine:882    ; s16 *x = ...883    ; s64 y = (x[0] | (x[1] << 16)) | (x[3] << 48)884 885    ; LITTLE-LABEL: name: dont_combine_missing_load886    ; LITTLE: liveins: $x0, $x1887    ; LITTLE-NEXT: {{  $}}888    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1889    ; LITTLE-NEXT: %cst_3:_(s64) = G_CONSTANT i64 3890    ; LITTLE-NEXT: %cst_16:_(s64) = G_CONSTANT i64 16891    ; LITTLE-NEXT: %cst_48:_(s64) = G_CONSTANT i64 48892    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1893    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)894    ; LITTLE-NEXT: %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)895    ; LITTLE-NEXT: %byte0_byte1:_(s64) = G_ZEXTLOAD %ptr(p0) :: (load (s16))896    ; LITTLE-NEXT: %elt1:_(s64) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))897    ; LITTLE-NEXT: %elt3:_(s64) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s16))898    ; LITTLE-NEXT: %byte2_byte3:_(s64) = nuw G_SHL %elt1, %cst_16(s64)899    ; LITTLE-NEXT: %byte6_byte7:_(s64) = nuw G_SHL %elt3, %cst_48(s64)900    ; LITTLE-NEXT: %or1:_(s64) = G_OR %byte0_byte1, %byte2_byte3901    ; LITTLE-NEXT: %full_load:_(s64) = G_OR %or1, %byte6_byte7902    ; LITTLE-NEXT: $x1 = COPY %full_load(s64)903    ; LITTLE-NEXT: RET_ReallyLR implicit $x1904    ;905    ; BIG-LABEL: name: dont_combine_missing_load906    ; BIG: liveins: $x0, $x1907    ; BIG-NEXT: {{  $}}908    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1909    ; BIG-NEXT: %cst_3:_(s64) = G_CONSTANT i64 3910    ; BIG-NEXT: %cst_16:_(s64) = G_CONSTANT i64 16911    ; BIG-NEXT: %cst_48:_(s64) = G_CONSTANT i64 48912    ; BIG-NEXT: %ptr:_(p0) = COPY $x1913    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)914    ; BIG-NEXT: %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)915    ; BIG-NEXT: %byte0_byte1:_(s64) = G_ZEXTLOAD %ptr(p0) :: (load (s16))916    ; BIG-NEXT: %elt1:_(s64) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))917    ; BIG-NEXT: %elt3:_(s64) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s16))918    ; BIG-NEXT: %byte2_byte3:_(s64) = nuw G_SHL %elt1, %cst_16(s64)919    ; BIG-NEXT: %byte6_byte7:_(s64) = nuw G_SHL %elt3, %cst_48(s64)920    ; BIG-NEXT: %or1:_(s64) = G_OR %byte0_byte1, %byte2_byte3921    ; BIG-NEXT: %full_load:_(s64) = G_OR %or1, %byte6_byte7922    ; BIG-NEXT: $x1 = COPY %full_load(s64)923    ; BIG-NEXT: RET_ReallyLR implicit $x1924    %cst_1:_(s64) = G_CONSTANT i64 1925    %cst_3:_(s64) = G_CONSTANT i64 3926 927    %cst_16:_(s64) = G_CONSTANT i64 16928    %cst_48:_(s64) = G_CONSTANT i64 48929 930    %ptr:_(p0) = COPY $x1931    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)932    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)933 934    %byte0_byte1:_(s64) = G_ZEXTLOAD %ptr(p0) :: (load (s16))935 936    %elt1:_(s64) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))937    %elt3:_(s64) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s16))938 939    %byte2_byte3:_(s64) = nuw G_SHL %elt1, %cst_16(s64)940    %byte6_byte7:_(s64) = nuw G_SHL %elt3, %cst_48(s64)941 942    %or1:_(s64) = G_OR %byte0_byte1, %byte2_byte3943    %full_load:_(s64) = G_OR %or1, %byte6_byte7944 945    $x1 = COPY %full_load(s64)946    RET_ReallyLR implicit $x1947 948...949---950name:            dont_combine_different_addr_spaces951tracksRegLiveness: true952body:             |953  bb.0:954    liveins: $x0, $x1955 956    ; When the loads are from different address spaces, don't combine.957 958    ; LITTLE-LABEL: name: dont_combine_different_addr_spaces959    ; LITTLE: liveins: $x0, $x1960    ; LITTLE-NEXT: {{  $}}961    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1962    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 16963    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x1964    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)965    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))966    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16), addrspace 1)967    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)968    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half969    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)970    ; LITTLE-NEXT: RET_ReallyLR implicit $w1971    ;972    ; BIG-LABEL: name: dont_combine_different_addr_spaces973    ; BIG: liveins: $x0, $x1974    ; BIG-NEXT: {{  $}}975    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 1976    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 16977    ; BIG-NEXT: %ptr:_(p0) = COPY $x1978    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)979    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))980    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16), addrspace 1)981    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)982    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half983    ; BIG-NEXT: $w1 = COPY %full_load(s32)984    ; BIG-NEXT: RET_ReallyLR implicit $w1985    %cst_1:_(s64) = G_CONSTANT i64 1986    %cst_16:_(s32) = G_CONSTANT i32 16987 988    %ptr:_(p0) = COPY $x1989    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)990 991    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16), addrspace 0)992    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16), addrspace 1)993    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)994 995    %full_load:_(s32) = G_OR %low_half, %high_half996    $w1 = COPY %full_load(s32)997    RET_ReallyLR implicit $w1998 999...1000---1001name:            dont_combine_duplicate_idx1002tracksRegLiveness: true1003body:             |1004  bb.0:1005    liveins: $x0, $x11006 1007    ; If two of the G_PTR_ADDs have the same index, then don't combine.1008    ; sN *x = ...1009    ; sM y = (x[i] << A) | (x[i] << B) ...1010 1011    ; LITTLE-LABEL: name: dont_combine_duplicate_idx1012    ; LITTLE: liveins: $x0, $x11013    ; LITTLE-NEXT: {{  $}}1014    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11015    ; LITTLE-NEXT: %reused_idx:_(s64) = G_CONSTANT i64 21016    ; LITTLE-NEXT: %cst_8:_(s32) = G_CONSTANT i32 81017    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161018    ; LITTLE-NEXT: %cst_24:_(s32) = G_CONSTANT i32 241019    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11020    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1021    ; LITTLE-NEXT: %uses_idx_2:_(p0) = G_PTR_ADD %ptr, %reused_idx(s64)1022    ; LITTLE-NEXT: %also_uses_idx_2:_(p0) = G_PTR_ADD %ptr, %reused_idx(s64)1023    ; LITTLE-NEXT: %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1024    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1025    ; LITTLE-NEXT: %elt2:_(s32) = G_ZEXTLOAD %uses_idx_2(p0) :: (load (s8))1026    ; LITTLE-NEXT: %elt3:_(s32) = G_ZEXTLOAD %also_uses_idx_2(p0) :: (load (s8))1027    ; LITTLE-NEXT: %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)1028    ; LITTLE-NEXT: %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)1029    ; LITTLE-NEXT: %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)1030    ; LITTLE-NEXT: %or1:_(s32) = G_OR %byte0, %byte11031    ; LITTLE-NEXT: %or2:_(s32) = G_OR %byte2, %byte31032    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %or1, %or21033    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)1034    ; LITTLE-NEXT: RET_ReallyLR implicit $w11035    ;1036    ; BIG-LABEL: name: dont_combine_duplicate_idx1037    ; BIG: liveins: $x0, $x11038    ; BIG-NEXT: {{  $}}1039    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11040    ; BIG-NEXT: %reused_idx:_(s64) = G_CONSTANT i64 21041    ; BIG-NEXT: %cst_8:_(s32) = G_CONSTANT i32 81042    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161043    ; BIG-NEXT: %cst_24:_(s32) = G_CONSTANT i32 241044    ; BIG-NEXT: %ptr:_(p0) = COPY $x11045    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1046    ; BIG-NEXT: %uses_idx_2:_(p0) = G_PTR_ADD %ptr, %reused_idx(s64)1047    ; BIG-NEXT: %also_uses_idx_2:_(p0) = G_PTR_ADD %ptr, %reused_idx(s64)1048    ; BIG-NEXT: %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1049    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1050    ; BIG-NEXT: %elt2:_(s32) = G_ZEXTLOAD %uses_idx_2(p0) :: (load (s8))1051    ; BIG-NEXT: %elt3:_(s32) = G_ZEXTLOAD %also_uses_idx_2(p0) :: (load (s8))1052    ; BIG-NEXT: %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)1053    ; BIG-NEXT: %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)1054    ; BIG-NEXT: %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)1055    ; BIG-NEXT: %or1:_(s32) = G_OR %byte0, %byte11056    ; BIG-NEXT: %or2:_(s32) = G_OR %byte2, %byte31057    ; BIG-NEXT: %full_load:_(s32) = G_OR %or1, %or21058    ; BIG-NEXT: $w1 = COPY %full_load(s32)1059    ; BIG-NEXT: RET_ReallyLR implicit $w11060    %cst_1:_(s64) = G_CONSTANT i64 11061    %reused_idx:_(s64) = G_CONSTANT i64 21062 1063    %cst_8:_(s32) = G_CONSTANT i32 81064    %cst_16:_(s32) = G_CONSTANT i32 161065    %cst_24:_(s32) = G_CONSTANT i32 241066 1067    %ptr:_(p0) = COPY $x11068    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1069    %uses_idx_2:_(p0) = G_PTR_ADD %ptr, %reused_idx(s64)1070    %also_uses_idx_2:_(p0) = G_PTR_ADD %ptr, %reused_idx(s64)1071 1072    %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1073 1074    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1075    %elt2:_(s32) = G_ZEXTLOAD %uses_idx_2(p0) :: (load (s8))1076    %elt3:_(s32) = G_ZEXTLOAD %also_uses_idx_2(p0) :: (load (s8))1077 1078    %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)1079    %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)1080    %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)1081 1082    %or1:_(s32) = G_OR %byte0, %byte11083    %or2:_(s32) = G_OR %byte2, %byte31084    %full_load:_(s32) = G_OR %or1, %or21085 1086    $w1 = COPY %full_load(s32)1087    RET_ReallyLR implicit $w11088...1089---1090name:            dont_combine_duplicate_offset1091tracksRegLiveness: true1092body:             |1093  bb.0:1094    liveins: $x0, $x11095 1096    ; If two of the G_SHLs have the same constant, then we should not combine.1097    ; sN *x = ...1098    ; sM y = (x[i] << A) | (x[i+1] << A) ...1099 1100    ; LITTLE-LABEL: name: dont_combine_duplicate_offset1101    ; LITTLE: liveins: $x0, $x11102    ; LITTLE-NEXT: {{  $}}1103    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11104    ; LITTLE-NEXT: %cst_2:_(s64) = G_CONSTANT i64 21105    ; LITTLE-NEXT: %cst_3:_(s64) = G_CONSTANT i64 31106    ; LITTLE-NEXT: %cst_8:_(s32) = G_CONSTANT i32 81107    ; LITTLE-NEXT: %duplicate_shl_cst:_(s32) = G_CONSTANT i32 161108    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11109    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1110    ; LITTLE-NEXT: %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)1111    ; LITTLE-NEXT: %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)1112    ; LITTLE-NEXT: %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1113    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1114    ; LITTLE-NEXT: %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))1115    ; LITTLE-NEXT: %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))1116    ; LITTLE-NEXT: %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)1117    ; LITTLE-NEXT: %duplicate_shl_1:_(s32) = nuw G_SHL %elt2, %duplicate_shl_cst(s32)1118    ; LITTLE-NEXT: %duplicate_shl_2:_(s32) = nuw G_SHL %elt3, %duplicate_shl_cst(s32)1119    ; LITTLE-NEXT: %or1:_(s32) = G_OR %byte0, %byte11120    ; LITTLE-NEXT: %or2:_(s32) = G_OR %duplicate_shl_1, %duplicate_shl_21121    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %or1, %or21122    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)1123    ; LITTLE-NEXT: RET_ReallyLR implicit $w11124    ;1125    ; BIG-LABEL: name: dont_combine_duplicate_offset1126    ; BIG: liveins: $x0, $x11127    ; BIG-NEXT: {{  $}}1128    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11129    ; BIG-NEXT: %cst_2:_(s64) = G_CONSTANT i64 21130    ; BIG-NEXT: %cst_3:_(s64) = G_CONSTANT i64 31131    ; BIG-NEXT: %cst_8:_(s32) = G_CONSTANT i32 81132    ; BIG-NEXT: %duplicate_shl_cst:_(s32) = G_CONSTANT i32 161133    ; BIG-NEXT: %ptr:_(p0) = COPY $x11134    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1135    ; BIG-NEXT: %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)1136    ; BIG-NEXT: %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)1137    ; BIG-NEXT: %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1138    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1139    ; BIG-NEXT: %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))1140    ; BIG-NEXT: %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))1141    ; BIG-NEXT: %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)1142    ; BIG-NEXT: %duplicate_shl_1:_(s32) = nuw G_SHL %elt2, %duplicate_shl_cst(s32)1143    ; BIG-NEXT: %duplicate_shl_2:_(s32) = nuw G_SHL %elt3, %duplicate_shl_cst(s32)1144    ; BIG-NEXT: %or1:_(s32) = G_OR %byte0, %byte11145    ; BIG-NEXT: %or2:_(s32) = G_OR %duplicate_shl_1, %duplicate_shl_21146    ; BIG-NEXT: %full_load:_(s32) = G_OR %or1, %or21147    ; BIG-NEXT: $w1 = COPY %full_load(s32)1148    ; BIG-NEXT: RET_ReallyLR implicit $w11149    %cst_1:_(s64) = G_CONSTANT i64 11150    %cst_2:_(s64) = G_CONSTANT i64 21151    %cst_3:_(s64) = G_CONSTANT i64 31152 1153    %cst_8:_(s32) = G_CONSTANT i32 81154    %duplicate_shl_cst:_(s32) = G_CONSTANT i32 161155 1156    %ptr:_(p0) = COPY $x11157    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1158    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)1159    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)1160 1161    %byte0:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1162 1163    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1164    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))1165    %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))1166 1167    %byte1:_(s32) = nuw G_SHL %elt1, %cst_8(s32)1168    %duplicate_shl_1:_(s32) = nuw G_SHL %elt2, %duplicate_shl_cst(s32)1169    %duplicate_shl_2:_(s32) = nuw G_SHL %elt3, %duplicate_shl_cst(s32)1170 1171    %or1:_(s32) = G_OR %byte0, %byte11172    %or2:_(s32) = G_OR %duplicate_shl_1, %duplicate_shl_21173    %full_load:_(s32) = G_OR %or1, %or21174 1175    $w1 = COPY %full_load(s32)1176    RET_ReallyLR implicit $w11177 1178...1179---1180name:            dont_combine_lowest_index_not_zero_offset1181tracksRegLiveness: true1182body:             |1183  bb.0:1184    liveins: $x0, $x11185 1186    ; In this case, the lowest index load (e.g. x[0]) does not end up at byte1187    ; offset 0. We shouldn't combine.1188    ; s8 *x = ...1189    ; s32 y = (x[0] << 8) | (x[1]) | (x[2] << 16) ...1190 1191    ; LITTLE-LABEL: name: dont_combine_lowest_index_not_zero_offset1192    ; LITTLE: liveins: $x0, $x11193    ; LITTLE-NEXT: {{  $}}1194    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11195    ; LITTLE-NEXT: %cst_2:_(s64) = G_CONSTANT i64 21196    ; LITTLE-NEXT: %cst_3:_(s64) = G_CONSTANT i64 31197    ; LITTLE-NEXT: %cst_8:_(s32) = G_CONSTANT i32 81198    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161199    ; LITTLE-NEXT: %cst_24:_(s32) = G_CONSTANT i32 241200    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11201    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1202    ; LITTLE-NEXT: %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)1203    ; LITTLE-NEXT: %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)1204    ; LITTLE-NEXT: %lowest_idx_load:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1205    ; LITTLE-NEXT: %byte0:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1206    ; LITTLE-NEXT: %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))1207    ; LITTLE-NEXT: %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))1208    ; LITTLE-NEXT: %byte1:_(s32) = nuw G_SHL %lowest_idx_load, %cst_8(s32)1209    ; LITTLE-NEXT: %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)1210    ; LITTLE-NEXT: %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)1211    ; LITTLE-NEXT: %or1:_(s32) = G_OR %byte0, %byte11212    ; LITTLE-NEXT: %or2:_(s32) = G_OR %byte2, %byte31213    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %or1, %or21214    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)1215    ; LITTLE-NEXT: RET_ReallyLR implicit $w11216    ;1217    ; BIG-LABEL: name: dont_combine_lowest_index_not_zero_offset1218    ; BIG: liveins: $x0, $x11219    ; BIG-NEXT: {{  $}}1220    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11221    ; BIG-NEXT: %cst_2:_(s64) = G_CONSTANT i64 21222    ; BIG-NEXT: %cst_3:_(s64) = G_CONSTANT i64 31223    ; BIG-NEXT: %cst_8:_(s32) = G_CONSTANT i32 81224    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161225    ; BIG-NEXT: %cst_24:_(s32) = G_CONSTANT i32 241226    ; BIG-NEXT: %ptr:_(p0) = COPY $x11227    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1228    ; BIG-NEXT: %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)1229    ; BIG-NEXT: %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)1230    ; BIG-NEXT: %lowest_idx_load:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1231    ; BIG-NEXT: %byte0:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1232    ; BIG-NEXT: %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))1233    ; BIG-NEXT: %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))1234    ; BIG-NEXT: %byte1:_(s32) = nuw G_SHL %lowest_idx_load, %cst_8(s32)1235    ; BIG-NEXT: %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)1236    ; BIG-NEXT: %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)1237    ; BIG-NEXT: %or1:_(s32) = G_OR %byte0, %byte11238    ; BIG-NEXT: %or2:_(s32) = G_OR %byte2, %byte31239    ; BIG-NEXT: %full_load:_(s32) = G_OR %or1, %or21240    ; BIG-NEXT: $w1 = COPY %full_load(s32)1241    ; BIG-NEXT: RET_ReallyLR implicit $w11242    %cst_1:_(s64) = G_CONSTANT i64 11243    %cst_2:_(s64) = G_CONSTANT i64 21244    %cst_3:_(s64) = G_CONSTANT i64 31245 1246    %cst_8:_(s32) = G_CONSTANT i32 81247    %cst_16:_(s32) = G_CONSTANT i32 161248    %cst_24:_(s32) = G_CONSTANT i32 241249 1250    %ptr:_(p0) = COPY $x11251    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1252    %ptr_elt_2:_(p0) = G_PTR_ADD %ptr, %cst_2(s64)1253    %ptr_elt_3:_(p0) = G_PTR_ADD %ptr, %cst_3(s64)1254 1255    ; This load is index 01256    %lowest_idx_load:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s8))1257    %byte0:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s8))1258    %elt2:_(s32) = G_ZEXTLOAD %ptr_elt_2(p0) :: (load (s8))1259    %elt3:_(s32) = G_ZEXTLOAD %ptr_elt_3(p0) :: (load (s8))1260 1261    ; ... But it ends up being shifted, so we shouldn't combine.1262    %byte1:_(s32) = nuw G_SHL %lowest_idx_load, %cst_8(s32)1263    %byte2:_(s32) = nuw G_SHL %elt2, %cst_16(s32)1264    %byte3:_(s32) = nuw G_SHL %elt3, %cst_24(s32)1265 1266    %or1:_(s32) = G_OR %byte0, %byte11267    %or2:_(s32) = G_OR %byte2, %byte31268    %full_load:_(s32) = G_OR %or1, %or21269 1270    $w1 = COPY %full_load(s32)1271    RET_ReallyLR implicit $w11272 1273...1274---1275name:            dont_combine_more_than_one_use_load1276tracksRegLiveness: true1277body:             |1278  bb.0:1279    liveins: $x0, $x11280 1281    ; If any load is used more than once, don't combine. We want to remove the1282    ; entire tree.1283 1284    ; LITTLE-LABEL: name: dont_combine_more_than_one_use_load1285    ; LITTLE: liveins: $x0, $x11286    ; LITTLE-NEXT: {{  $}}1287    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11288    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161289    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11290    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1291    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1292    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1293    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1294    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half1295    ; LITTLE-NEXT: %extra_use:_(s32) = G_AND %full_load, %low_half1296    ; LITTLE-NEXT: $w1 = COPY %extra_use(s32)1297    ; LITTLE-NEXT: RET_ReallyLR implicit $w11298    ;1299    ; BIG-LABEL: name: dont_combine_more_than_one_use_load1300    ; BIG: liveins: $x0, $x11301    ; BIG-NEXT: {{  $}}1302    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11303    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161304    ; BIG-NEXT: %ptr:_(p0) = COPY $x11305    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1306    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1307    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1308    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1309    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half1310    ; BIG-NEXT: %extra_use:_(s32) = G_AND %full_load, %low_half1311    ; BIG-NEXT: $w1 = COPY %extra_use(s32)1312    ; BIG-NEXT: RET_ReallyLR implicit $w11313    %cst_1:_(s64) = G_CONSTANT i64 11314    %cst_16:_(s32) = G_CONSTANT i32 161315 1316    %ptr:_(p0) = COPY $x11317    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1318 1319    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1320    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1321    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1322 1323    %full_load:_(s32) = G_OR %low_half, %high_half1324    %extra_use:_(s32) = G_AND %full_load, %low_half1325    $w1 = COPY %extra_use(s32)1326    RET_ReallyLR implicit $w11327 1328...1329---1330name:            dont_combine_more_than_one_use_shl1331tracksRegLiveness: true1332body:             |1333  bb.0:1334    liveins: $x0, $x11335 1336    ; If anything feeding into any of the ors is used more than once, don't1337    ; combine.1338 1339    ; LITTLE-LABEL: name: dont_combine_more_than_one_use_shl1340    ; LITTLE: liveins: $x0, $x11341    ; LITTLE-NEXT: {{  $}}1342    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11343    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161344    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11345    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1346    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1347    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1348    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1349    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half1350    ; LITTLE-NEXT: %extra_use:_(s32) = G_AND %full_load, %high_half1351    ; LITTLE-NEXT: $w1 = COPY %extra_use(s32)1352    ; LITTLE-NEXT: RET_ReallyLR implicit $w11353    ;1354    ; BIG-LABEL: name: dont_combine_more_than_one_use_shl1355    ; BIG: liveins: $x0, $x11356    ; BIG-NEXT: {{  $}}1357    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11358    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161359    ; BIG-NEXT: %ptr:_(p0) = COPY $x11360    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1361    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1362    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1363    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1364    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half1365    ; BIG-NEXT: %extra_use:_(s32) = G_AND %full_load, %high_half1366    ; BIG-NEXT: $w1 = COPY %extra_use(s32)1367    ; BIG-NEXT: RET_ReallyLR implicit $w11368    %cst_1:_(s64) = G_CONSTANT i64 11369    %cst_16:_(s32) = G_CONSTANT i32 161370 1371    %ptr:_(p0) = COPY $x11372    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1373 1374    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1375    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1376    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1377 1378    %full_load:_(s32) = G_OR %low_half, %high_half1379    %extra_use:_(s32) = G_AND %full_load, %high_half1380    $w1 = COPY %extra_use(s32)1381    RET_ReallyLR implicit $w11382 1383...1384---1385name:            dont_combine_store_between_same_mbb1386tracksRegLiveness: true1387body:             |1388  bb.0:1389    liveins: $x0, $x11390    ; If there is a store between any of the loads, then do not combine.1391 1392    ; LITTLE-LABEL: name: dont_combine_store_between_same_mbb1393    ; LITTLE: liveins: $x0, $x11394    ; LITTLE-NEXT: {{  $}}1395    ; LITTLE-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11396    ; LITTLE-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161397    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11398    ; LITTLE-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1399    ; LITTLE-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1400    ; LITTLE-NEXT: %other_ptr:_(p0) = COPY $x11401    ; LITTLE-NEXT: %some_val:_(s32) = G_CONSTANT i32 121402    ; LITTLE-NEXT: G_STORE %some_val(s32), %other_ptr(p0) :: (store (s16))1403    ; LITTLE-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1404    ; LITTLE-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1405    ; LITTLE-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half1406    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)1407    ; LITTLE-NEXT: RET_ReallyLR implicit $w11408    ;1409    ; BIG-LABEL: name: dont_combine_store_between_same_mbb1410    ; BIG: liveins: $x0, $x11411    ; BIG-NEXT: {{  $}}1412    ; BIG-NEXT: %cst_1:_(s64) = G_CONSTANT i64 11413    ; BIG-NEXT: %cst_16:_(s32) = G_CONSTANT i32 161414    ; BIG-NEXT: %ptr:_(p0) = COPY $x11415    ; BIG-NEXT: %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1416    ; BIG-NEXT: %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1417    ; BIG-NEXT: %other_ptr:_(p0) = COPY $x11418    ; BIG-NEXT: %some_val:_(s32) = G_CONSTANT i32 121419    ; BIG-NEXT: G_STORE %some_val(s32), %other_ptr(p0) :: (store (s16))1420    ; BIG-NEXT: %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1421    ; BIG-NEXT: %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1422    ; BIG-NEXT: %full_load:_(s32) = G_OR %low_half, %high_half1423    ; BIG-NEXT: $w1 = COPY %full_load(s32)1424    ; BIG-NEXT: RET_ReallyLR implicit $w11425    %cst_1:_(s64) = G_CONSTANT i64 11426    %cst_16:_(s32) = G_CONSTANT i32 161427 1428    %ptr:_(p0) = COPY $x11429    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1430    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1431 1432    ; Memory could be modified here, so don't combine!1433    %other_ptr:_(p0) = COPY $x11434    %some_val:_(s32) = G_CONSTANT i32 121435    G_STORE  %some_val, %other_ptr :: (store (s16))1436 1437    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1438    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1439 1440    %full_load:_(s32) = G_OR %low_half, %high_half1441    $w1 = COPY %full_load(s32)1442    RET_ReallyLR implicit $w11443 1444...1445---1446name:            dont_combine_store_between_different_mbb1447tracksRegLiveness: true1448body:             |1449  ; LITTLE-LABEL: name: dont_combine_store_between_different_mbb1450  ; LITTLE: bb.0:1451  ; LITTLE-NEXT:   successors: %bb.1(0x80000000)1452  ; LITTLE-NEXT:   liveins: $x0, $x11453  ; LITTLE-NEXT: {{  $}}1454  ; LITTLE-NEXT:   %cst_1:_(s64) = G_CONSTANT i64 11455  ; LITTLE-NEXT:   %cst_16:_(s32) = G_CONSTANT i32 161456  ; LITTLE-NEXT:   %ptr:_(p0) = COPY $x11457  ; LITTLE-NEXT:   %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1458  ; LITTLE-NEXT:   %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1459  ; LITTLE-NEXT: {{  $}}1460  ; LITTLE-NEXT: bb.1:1461  ; LITTLE-NEXT:   successors: %bb.2(0x80000000)1462  ; LITTLE-NEXT:   liveins: $x0, $x11463  ; LITTLE-NEXT: {{  $}}1464  ; LITTLE-NEXT:   %other_ptr:_(p0) = COPY $x11465  ; LITTLE-NEXT:   %some_val:_(s32) = G_CONSTANT i32 121466  ; LITTLE-NEXT:   G_STORE %some_val(s32), %other_ptr(p0) :: (store (s16))1467  ; LITTLE-NEXT: {{  $}}1468  ; LITTLE-NEXT: bb.2:1469  ; LITTLE-NEXT:   liveins: $x0, $x11470  ; LITTLE-NEXT: {{  $}}1471  ; LITTLE-NEXT:   %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1472  ; LITTLE-NEXT:   %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1473  ; LITTLE-NEXT:   %full_load:_(s32) = G_OR %low_half, %high_half1474  ; LITTLE-NEXT:   $w1 = COPY %full_load(s32)1475  ; LITTLE-NEXT:   RET_ReallyLR implicit $w11476  ;1477  ; BIG-LABEL: name: dont_combine_store_between_different_mbb1478  ; BIG: bb.0:1479  ; BIG-NEXT:   successors: %bb.1(0x80000000)1480  ; BIG-NEXT:   liveins: $x0, $x11481  ; BIG-NEXT: {{  $}}1482  ; BIG-NEXT:   %cst_1:_(s64) = G_CONSTANT i64 11483  ; BIG-NEXT:   %cst_16:_(s32) = G_CONSTANT i32 161484  ; BIG-NEXT:   %ptr:_(p0) = COPY $x11485  ; BIG-NEXT:   %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1486  ; BIG-NEXT:   %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1487  ; BIG-NEXT: {{  $}}1488  ; BIG-NEXT: bb.1:1489  ; BIG-NEXT:   successors: %bb.2(0x80000000)1490  ; BIG-NEXT:   liveins: $x0, $x11491  ; BIG-NEXT: {{  $}}1492  ; BIG-NEXT:   %other_ptr:_(p0) = COPY $x11493  ; BIG-NEXT:   %some_val:_(s32) = G_CONSTANT i32 121494  ; BIG-NEXT:   G_STORE %some_val(s32), %other_ptr(p0) :: (store (s16))1495  ; BIG-NEXT: {{  $}}1496  ; BIG-NEXT: bb.2:1497  ; BIG-NEXT:   liveins: $x0, $x11498  ; BIG-NEXT: {{  $}}1499  ; BIG-NEXT:   %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1500  ; BIG-NEXT:   %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1501  ; BIG-NEXT:   %full_load:_(s32) = G_OR %low_half, %high_half1502  ; BIG-NEXT:   $w1 = COPY %full_load(s32)1503  ; BIG-NEXT:   RET_ReallyLR implicit $w11504  ; There is a store between the two loads, hidden away in a different MBB.1505  ; We should not combine here.1506 1507 1508  bb.0:1509    successors: %bb.1(0x80000000)1510    liveins: $x0, $x11511    ; If there is a store between any of the loads, then do not combine.1512 1513    %cst_1:_(s64) = G_CONSTANT i64 11514    %cst_16:_(s32) = G_CONSTANT i32 161515 1516    %ptr:_(p0) = COPY $x11517    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1518    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1519 1520  bb.1:1521   liveins: $x0, $x11522    successors: %bb.2(0x80000000)1523    ; Memory could be modified here, so don't combine!1524    %other_ptr:_(p0) = COPY $x11525    %some_val:_(s32) = G_CONSTANT i32 121526    G_STORE  %some_val, %other_ptr :: (store (s16))1527 1528  bb.2:1529    liveins: $x0, $x11530    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1531    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1532 1533    %full_load:_(s32) = G_OR %low_half, %high_half1534    $w1 = COPY %full_load(s32)1535    RET_ReallyLR implicit $w11536 1537...1538---1539name:            different_mbb1540tracksRegLiveness: true1541body:             |1542  ; LITTLE-LABEL: name: different_mbb1543  ; LITTLE: bb.0:1544  ; LITTLE-NEXT:   successors: %bb.1(0x80000000)1545  ; LITTLE-NEXT:   liveins: $x0, $x11546  ; LITTLE-NEXT: {{  $}}1547  ; LITTLE-NEXT:   %cst_1:_(s64) = G_CONSTANT i64 11548  ; LITTLE-NEXT:   %cst_16:_(s32) = G_CONSTANT i32 161549  ; LITTLE-NEXT:   %ptr:_(p0) = COPY $x11550  ; LITTLE-NEXT:   %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1551  ; LITTLE-NEXT:   %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1552  ; LITTLE-NEXT: {{  $}}1553  ; LITTLE-NEXT: bb.1:1554  ; LITTLE-NEXT:   liveins: $x0, $x11555  ; LITTLE-NEXT: {{  $}}1556  ; LITTLE-NEXT:   %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1557  ; LITTLE-NEXT:   %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1558  ; LITTLE-NEXT:   %full_load:_(s32) = G_OR %low_half, %high_half1559  ; LITTLE-NEXT:   $w1 = COPY %full_load(s32)1560  ; LITTLE-NEXT:   RET_ReallyLR implicit $w11561  ;1562  ; BIG-LABEL: name: different_mbb1563  ; BIG: bb.0:1564  ; BIG-NEXT:   successors: %bb.1(0x80000000)1565  ; BIG-NEXT:   liveins: $x0, $x11566  ; BIG-NEXT: {{  $}}1567  ; BIG-NEXT:   %cst_1:_(s64) = G_CONSTANT i64 11568  ; BIG-NEXT:   %cst_16:_(s32) = G_CONSTANT i32 161569  ; BIG-NEXT:   %ptr:_(p0) = COPY $x11570  ; BIG-NEXT:   %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1571  ; BIG-NEXT:   %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1572  ; BIG-NEXT: {{  $}}1573  ; BIG-NEXT: bb.1:1574  ; BIG-NEXT:   liveins: $x0, $x11575  ; BIG-NEXT: {{  $}}1576  ; BIG-NEXT:   %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1577  ; BIG-NEXT:   %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1578  ; BIG-NEXT:   %full_load:_(s32) = G_OR %low_half, %high_half1579  ; BIG-NEXT:   $w1 = COPY %full_load(s32)1580  ; BIG-NEXT:   RET_ReallyLR implicit $w11581  ; It should be possible to combine here, but it's not supported right now.1582 1583 1584  bb.0:1585    successors: %bb.1(0x80000000)1586    liveins: $x0, $x11587 1588    %cst_1:_(s64) = G_CONSTANT i64 11589    %cst_16:_(s32) = G_CONSTANT i32 161590 1591    %ptr:_(p0) = COPY $x11592    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1593    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1594 1595  bb.1:1596    liveins: $x0, $x11597    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1598    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1599 1600    %full_load:_(s32) = G_OR %low_half, %high_half1601    $w1 = COPY %full_load(s32)1602    RET_ReallyLR implicit $w11603 1604...1605---1606name:            load_first1607tracksRegLiveness: true1608body:             |1609  bb.0:1610    liveins: $x0, $x11611    ; Test for a bug fix for predecessor-checking code.1612 1613    ; LITTLE-LABEL: name: load_first1614    ; LITTLE: liveins: $x0, $x11615    ; LITTLE-NEXT: {{  $}}1616    ; LITTLE-NEXT: %ptr:_(p0) = COPY $x11617    ; LITTLE-NEXT: %full_load:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 2)1618    ; LITTLE-NEXT: $w1 = COPY %full_load(s32)1619    ; LITTLE-NEXT: RET_ReallyLR implicit $w11620    ;1621    ; BIG-LABEL: name: load_first1622    ; BIG: liveins: $x0, $x11623    ; BIG-NEXT: {{  $}}1624    ; BIG-NEXT: %ptr:_(p0) = COPY $x11625    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD %ptr(p0) :: (load (s32), align 2)1626    ; BIG-NEXT: %full_load:_(s32) = G_BSWAP [[LOAD]]1627    ; BIG-NEXT: $w1 = COPY %full_load(s32)1628    ; BIG-NEXT: RET_ReallyLR implicit $w11629    %low_half:_(s32) = G_ZEXTLOAD %ptr(p0) :: (load (s16))1630    %cst_1:_(s64) = G_CONSTANT i64 11631    %cst_16:_(s32) = G_CONSTANT i32 161632 1633    %ptr:_(p0) = COPY $x11634    %ptr_elt_1:_(p0) = G_PTR_ADD %ptr, %cst_1(s64)1635 1636    %elt1:_(s32) = G_ZEXTLOAD %ptr_elt_1(p0) :: (load (s16))1637    %high_half:_(s32) = nuw G_SHL %elt1, %cst_16(s32)1638 1639    %full_load:_(s32) = G_OR %low_half, %high_half1640    $w1 = COPY %full_load(s32)1641    RET_ReallyLR implicit $w11642 1643...1644---1645name:            store_between_loads_and_or1646alignment:       41647tracksRegLiveness: true1648 1649liveins:1650  - { reg: '$x0' }1651  - { reg: '$x1' }1652frameInfo:1653  maxAlignment:    11654body:             |1655  bb.1:1656    liveins: $x0, $x11657    ; Check that we build the G_LOAD at the point of the last load, instead of place of the G_OR.1658    ; We could have a G_STORE in between which may not be safe to move the load across.1659  liveins: $x0, $x11660    ; LITTLE-LABEL: name: store_between_loads_and_or1661    ; LITTLE: liveins: $x0, $x1, $x0, $x11662    ; LITTLE-NEXT: {{  $}}1663    ; LITTLE-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x01664    ; LITTLE-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11665    ; LITTLE-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 11666    ; LITTLE-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s32), align 1)1667    ; LITTLE-NEXT: G_STORE [[C]](s8), [[COPY1]](p0) :: (store (s8))1668    ; LITTLE-NEXT: $w0 = COPY [[LOAD]](s32)1669    ; LITTLE-NEXT: RET_ReallyLR implicit $w01670    ;1671    ; BIG-LABEL: name: store_between_loads_and_or1672    ; BIG: liveins: $x0, $x1, $x0, $x11673    ; BIG-NEXT: {{  $}}1674    ; BIG-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x01675    ; BIG-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11676    ; BIG-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 11677    ; BIG-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s32), align 1)1678    ; BIG-NEXT: [[BSWAP:%[0-9]+]]:_(s32) = G_BSWAP [[LOAD]]1679    ; BIG-NEXT: G_STORE [[C]](s8), [[COPY1]](p0) :: (store (s8))1680    ; BIG-NEXT: $w0 = COPY [[BSWAP]](s32)1681    ; BIG-NEXT: RET_ReallyLR implicit $w01682  %0:_(p0) = COPY $x01683  %1:_(p0) = COPY $x11684  %12:_(s8) = G_CONSTANT i8 11685  %15:_(s32) = G_CONSTANT i32 81686  %19:_(s32) = G_CONSTANT i32 161687  %23:_(s32) = G_CONSTANT i32 241688  %13:_(s32) = G_ZEXTLOAD %0:_(p0) :: (load (s8))1689  %3:_(s64) = G_CONSTANT i64 11690  %4:_(p0) = G_PTR_ADD %0:_, %3:_(s64)1691  %14:_(s32) = G_ZEXTLOAD %4:_(p0) :: (load (s8))1692  %6:_(s64) = G_CONSTANT i64 21693  %7:_(p0) = G_PTR_ADD %0:_, %6:_(s64)1694  %18:_(s32) = G_ZEXTLOAD %7:_(p0) :: (load (s8))1695  %9:_(s64) = G_CONSTANT i64 31696  %10:_(p0) = G_PTR_ADD %0:_, %9:_(s64)1697  %22:_(s32) = G_ZEXTLOAD %10:_(p0) :: (load (s8))1698  G_STORE %12:_(s8), %1:_(p0) :: (store (s8))1699  %16:_(s32) = nuw nsw G_SHL %14:_, %15:_(s32)1700  %17:_(s32) = G_OR %16:_, %13:_1701  %20:_(s32) = nuw nsw G_SHL %18:_, %19:_(s32)1702  %21:_(s32) = G_OR %17:_, %20:_1703  %24:_(s32) = nuw G_SHL %22:_, %23:_(s32)1704  %25:_(s32) = G_OR %21:_, %24:_1705  $w0 = COPY %25:_(s32)1706  RET_ReallyLR implicit $w01707 1708...1709