197 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -O0 %s -global-isel -start-before localizer \3# RUN: -stop-after localizer -o - | FileCheck --check-prefix=CHECK %s4--- |5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"6 target triple = "arm64-apple-macosx12.0.0"7 8 @A = global i32 1234, align 49 @B = global i32 5678, align 410 @C = global i32 9012, align 411 12 define noundef i32 @foo() !dbg !5 {13 %1 = alloca i32, align 414 br i1 false, label %2, label %415 16 2: ; preds = %017 %3 = load i32, ptr @A, align 4, !dbg !1018 store volatile i32 %3, ptr %1, align 419 br label %920 21 4: ; preds = %022 br i1 false, label %5, label %823 24 5: ; preds = %425 %6 = load i32, ptr @B, align 4, !dbg !1326 store volatile i32 %6, ptr %1, align 427 %7 = load i32, ptr @B, align 4, !dbg !1628 store volatile i32 %7, ptr %1, align 429 br label %930 31 8: ; preds = %432 store i32 3, ptr @C, align 4, !dbg !1733 br label %934 35 9: ; preds = %8, %5, %236 ret i32 037 }38 39 !llvm.dbg.cu = !{!0}40 !llvm.module.flags = !{!2, !3, !4}41 42 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)43 !1 = !DIFile(filename: "tmp.ll", directory: "/")44 !2 = !{i32 7, !"Dwarf Version", i32 4}45 !3 = !{i32 2, !"Debug Info Version", i32 3}46 !4 = !{i32 1, !"wchar_size", i32 4}47 !5 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !6, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)48 !6 = !DISubroutineType(types: !7)49 !7 = !{!8}50 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)51 !9 = !{}52 !10 = !DILocation(line: 9, column: 9, scope: !11)53 !11 = distinct !DILexicalBlock(scope: !12, file: !1, line: 8, column: 15)54 !12 = distinct !DILexicalBlock(scope: !5, file: !1, line: 8, column: 7)55 !13 = !DILocation(line: 11, column: 9, scope: !14)56 !14 = distinct !DILexicalBlock(scope: !15, file: !1, line: 10, column: 22)57 !15 = distinct !DILexicalBlock(scope: !12, file: !1, line: 10, column: 14)58 !16 = !DILocation(line: 12, column: 13, scope: !14)59 !17 = !DILocation(line: 14, column: 7, scope: !18)60 !18 = distinct !DILexicalBlock(scope: !15, file: !1, line: 13, column: 10)61 62...63---64name: foo65alignment: 466legalized: true67regBankSelected: true68tracksRegLiveness: true69stack:70 - { id: 0, name: '', type: default, offset: 0, size: 4, alignment: 4,71 stack-id: default, callee-saved-register: '', callee-saved-restored: true,72 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }73body: |74 ; CHECK-LABEL: name: foo75 ; CHECK: bb.0:76 ; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)77 ; CHECK-NEXT: {{ $}}78 ; CHECK-NEXT: [[C:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 379 ; CHECK-NEXT: [[ADRP:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @C, debug-location !DILocation(line: 0, scope: !18)80 ; CHECK-NEXT: [[ADD_LOW:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP]](p0), target-flags(aarch64-pageoff, aarch64-nc) @C, debug-location !DILocation(line: 0, scope: !18)81 ; CHECK-NEXT: [[ADRP1:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @B, debug-location !DILocation(line: 0, scope: !14)82 ; CHECK-NEXT: [[ADD_LOW1:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP1]](p0), target-flags(aarch64-pageoff, aarch64-nc) @B, debug-location !DILocation(line: 0, scope: !14)83 ; CHECK-NEXT: [[ADRP2:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @A, debug-location !DILocation(line: 0, scope: !11)84 ; CHECK-NEXT: [[ADD_LOW2:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP2]](p0), target-flags(aarch64-pageoff, aarch64-nc) @A, debug-location !DILocation(line: 0, scope: !11)85 ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:gpr(p0) = G_FRAME_INDEX %stack.086 ; CHECK-NEXT: [[C1:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 087 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr(s32) = COPY [[C1]](s32)88 ; CHECK-NEXT: [[C2:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 189 ; CHECK-NEXT: [[XOR:%[0-9]+]]:gpr(s32) = G_XOR [[COPY]], [[C2]]90 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:gpr(s1) = G_TRUNC [[XOR]](s32)91 ; CHECK-NEXT: G_BRCOND [[TRUNC]](s1), %bb.292 ; CHECK-NEXT: G_BR %bb.193 ; CHECK-NEXT: {{ $}}94 ; CHECK-NEXT: bb.1:95 ; CHECK-NEXT: successors: %bb.5(0x80000000)96 ; CHECK-NEXT: {{ $}}97 ; CHECK-NEXT: [[ADRP3:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @A, debug-location !1098 ; CHECK-NEXT: [[ADD_LOW3:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP3]](p0), target-flags(aarch64-pageoff, aarch64-nc) @A, debug-location !1099 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:gpr(s32) = G_LOAD [[ADD_LOW3]](p0), debug-location !10 :: (dereferenceable load (s32))100 ; CHECK-NEXT: [[FRAME_INDEX1:%[0-9]+]]:gpr(p0) = G_FRAME_INDEX %stack.0101 ; CHECK-NEXT: G_STORE [[LOAD]](s32), [[FRAME_INDEX1]](p0) :: (volatile store (s32) into %ir.1)102 ; CHECK-NEXT: G_BR %bb.5103 ; CHECK-NEXT: {{ $}}104 ; CHECK-NEXT: bb.2:105 ; CHECK-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000)106 ; CHECK-NEXT: {{ $}}107 ; CHECK-NEXT: [[C3:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 0108 ; CHECK-NEXT: [[C4:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 1109 ; CHECK-NEXT: [[XOR1:%[0-9]+]]:gpr(s32) = G_XOR [[C3]], [[C4]]110 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:gpr(s1) = G_TRUNC [[XOR1]](s32)111 ; CHECK-NEXT: G_BRCOND [[TRUNC1]](s1), %bb.4112 ; CHECK-NEXT: G_BR %bb.3113 ; CHECK-NEXT: {{ $}}114 ; CHECK-NEXT: bb.3:115 ; CHECK-NEXT: successors: %bb.5(0x80000000)116 ; CHECK-NEXT: {{ $}}117 ; CHECK-NEXT: [[ADRP4:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @B, debug-location !DILocation(line: 0, scope: !14)118 ; CHECK-NEXT: [[ADD_LOW4:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP4]](p0), target-flags(aarch64-pageoff, aarch64-nc) @B, debug-location !DILocation(line: 0, scope: !14)119 ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:gpr(s32) = G_LOAD [[ADD_LOW4]](p0), debug-location !13 :: (dereferenceable load (s32))120 ; CHECK-NEXT: [[FRAME_INDEX2:%[0-9]+]]:gpr(p0) = G_FRAME_INDEX %stack.0121 ; CHECK-NEXT: G_STORE [[LOAD1]](s32), [[FRAME_INDEX2]](p0) :: (volatile store (s32) into %ir.1)122 ; CHECK-NEXT: [[LOAD2:%[0-9]+]]:gpr(s32) = G_LOAD [[ADD_LOW4]](p0), debug-location !16 :: (dereferenceable load (s32))123 ; CHECK-NEXT: G_STORE [[LOAD2]](s32), [[FRAME_INDEX2]](p0) :: (volatile store (s32) into %ir.1)124 ; CHECK-NEXT: G_BR %bb.5125 ; CHECK-NEXT: {{ $}}126 ; CHECK-NEXT: bb.4:127 ; CHECK-NEXT: successors: %bb.5(0x80000000)128 ; CHECK-NEXT: {{ $}}129 ; CHECK-NEXT: [[ADRP5:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @C, debug-location !17130 ; CHECK-NEXT: [[ADD_LOW5:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP5]](p0), target-flags(aarch64-pageoff, aarch64-nc) @C, debug-location !17131 ; CHECK-NEXT: [[C5:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 3, debug-location !17132 ; CHECK-NEXT: G_STORE [[C5]](s32), [[ADD_LOW5]](p0), debug-location !17 :: (store (s32) into @C)133 ; CHECK-NEXT: G_BR %bb.5134 ; CHECK-NEXT: {{ $}}135 ; CHECK-NEXT: bb.5:136 ; CHECK-NEXT: [[C6:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 0137 ; CHECK-NEXT: $w0 = COPY [[C6]](s32)138 ; CHECK-NEXT: RET_ReallyLR implicit $w0139 140 141 bb.1:142 successors: %bb.2(0x40000000), %bb.3(0x40000000)143 144 %2:gpr(s32) = G_CONSTANT i32 3145 %24:gpr64(p0) = ADRP target-flags(aarch64-page) @C, debug-location !DILocation(line: 0, scope: !18)146 %3:gpr(p0) = G_ADD_LOW %24(p0), target-flags(aarch64-pageoff, aarch64-nc) @C, debug-location !DILocation(line: 0, scope: !18)147 %23:gpr64(p0) = ADRP target-flags(aarch64-page) @B, debug-location !DILocation(line: 0, scope: !14)148 %5:gpr(p0) = G_ADD_LOW %23(p0), target-flags(aarch64-pageoff, aarch64-nc) @B, debug-location !DILocation(line: 0, scope: !14)149 %22:gpr64(p0) = ADRP target-flags(aarch64-page) @A, debug-location !DILocation(line: 0, scope: !11)150 %8:gpr(p0) = G_ADD_LOW %22(p0), target-flags(aarch64-pageoff, aarch64-nc) @A, debug-location !DILocation(line: 0, scope: !11)151 %9:gpr(s32) = G_CONSTANT i32 0152 %0:gpr(p0) = G_FRAME_INDEX %stack.0153 %18:gpr(s32) = COPY %9(s32)154 %19:gpr(s32) = G_CONSTANT i32 1155 %20:gpr(s32) = G_XOR %18, %19156 %11:gpr(s1) = G_TRUNC %20(s32)157 G_BRCOND %11(s1), %bb.3158 G_BR %bb.2159 160 bb.2:161 successors: %bb.6(0x80000000)162 163 %7:gpr(s32) = G_LOAD %8(p0), debug-location !10 :: (dereferenceable load (s32))164 G_STORE %7(s32), %0(p0) :: (volatile store (s32) into %ir.1)165 G_BR %bb.6166 167 bb.3:168 successors: %bb.4(0x40000000), %bb.5(0x40000000)169 170 %14:gpr(s32) = G_CONSTANT i32 0171 %15:gpr(s32) = G_CONSTANT i32 1172 %16:gpr(s32) = G_XOR %14, %15173 %13:gpr(s1) = G_TRUNC %16(s32)174 G_BRCOND %13(s1), %bb.5175 G_BR %bb.4176 177 bb.4:178 successors: %bb.6(0x80000000)179 180 %4:gpr(s32) = G_LOAD %5(p0), debug-location !13 :: (dereferenceable load (s32))181 G_STORE %4(s32), %0(p0) :: (volatile store (s32) into %ir.1)182 %6:gpr(s32) = G_LOAD %5(p0), debug-location !16 :: (dereferenceable load (s32))183 G_STORE %6(s32), %0(p0) :: (volatile store (s32) into %ir.1)184 G_BR %bb.6185 186 bb.5:187 successors: %bb.6(0x80000000)188 189 G_STORE %2(s32), %3(p0), debug-location !17 :: (store (s32) into @C)190 G_BR %bb.6191 192 bb.6:193 $w0 = COPY %9(s32)194 RET_ReallyLR implicit $w0195 196...197