1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 %s -global-isel -start-before localizer \
3 # RUN: -stop-after localizer -o - | FileCheck --check-prefix=CHECK %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6 target triple = "arm64-apple-macosx12.0.0"
8 @A = global i32 1234, align 4
9 @B = global i32 5678, align 4
10 @C = global i32 9012, align 4
12 define noundef i32 @foo() !dbg !5 {
13 %1 = alloca i32, align 4
14 br i1 false, label %2, label %4
17 %3 = load i32, ptr @A, align 4, !dbg !10
18 store volatile i32 %3, ptr %1, align 4
22 br i1 false, label %5, label %8
25 %6 = load i32, ptr @B, align 4, !dbg !13
26 store volatile i32 %6, ptr %1, align 4
27 %7 = load i32, ptr @B, align 4, !dbg !16
28 store volatile i32 %7, ptr %1, align 4
32 store i32 3, ptr @C, align 4, !dbg !17
35 9: ; preds = %8, %5, %2
40 !llvm.module.flags = !{!2, !3, !4}
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)
50 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
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)
68 tracksRegLiveness: true
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: '' }
74 ; CHECK: [[ADRP3:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @A, debug-location !10
75 ; CHECK-NEXT: [[ADD_LOW3:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP3]](p0), target-flags(aarch64-pageoff, aarch64-nc) @A, debug-location !10
76 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:gpr(s32) = G_LOAD [[ADD_LOW3]](p0), debug-location !10 :: (dereferenceable load (s32))
78 ; CHECK: [[ADRP4:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @B, debug-location !DILocation(line: 0, scope: !14)
79 ; 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)
80 ; CHECK-NEXT: [[LOAD1:%[0-9]+]]:gpr(s32) = G_LOAD [[ADD_LOW4]](p0), debug-location !13 :: (dereferenceable load (s32))
82 ; CHECK: [[ADRP5:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @C, debug-location !17
83 ; CHECK-NEXT: [[ADD_LOW5:%[0-9]+]]:gpr(p0) = G_ADD_LOW [[ADRP5]](p0), target-flags(aarch64-pageoff, aarch64-nc) @C, debug-location !17
84 ; CHECK-NEXT: [[C5:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 3, debug-location !17
85 ; CHECK-NEXT: G_STORE [[C5]](s32), [[ADD_LOW5]](p0), debug-location !17 :: (store (s32) into @C)
87 successors: %bb.2(0x40000000), %bb.3(0x40000000)
89 %2:gpr(s32) = G_CONSTANT i32 3
90 %24:gpr64(p0) = ADRP target-flags(aarch64-page) @C, debug-location !DILocation(line: 0, scope: !18)
91 %3:gpr(p0) = G_ADD_LOW %24(p0), target-flags(aarch64-pageoff, aarch64-nc) @C, debug-location !DILocation(line: 0, scope: !18)
92 %23:gpr64(p0) = ADRP target-flags(aarch64-page) @B, debug-location !DILocation(line: 0, scope: !14)
93 %5:gpr(p0) = G_ADD_LOW %23(p0), target-flags(aarch64-pageoff, aarch64-nc) @B, debug-location !DILocation(line: 0, scope: !14)
94 %22:gpr64(p0) = ADRP target-flags(aarch64-page) @A, debug-location !DILocation(line: 0, scope: !11)
95 %8:gpr(p0) = G_ADD_LOW %22(p0), target-flags(aarch64-pageoff, aarch64-nc) @A, debug-location !DILocation(line: 0, scope: !11)
96 %9:gpr(s32) = G_CONSTANT i32 0
97 %0:gpr(p0) = G_FRAME_INDEX %stack.0
98 %18:gpr(s32) = COPY %9(s32)
99 %19:gpr(s32) = G_CONSTANT i32 1
100 %20:gpr(s32) = G_XOR %18, %19
101 %11:gpr(s1) = G_TRUNC %20(s32)
102 G_BRCOND %11(s1), %bb.3
106 successors: %bb.6(0x80000000)
108 %7:gpr(s32) = G_LOAD %8(p0), debug-location !10 :: (dereferenceable load (s32))
109 G_STORE %7(s32), %0(p0) :: (volatile store (s32) into %ir.1)
113 successors: %bb.4(0x40000000), %bb.5(0x40000000)
115 %14:gpr(s32) = G_CONSTANT i32 0
116 %15:gpr(s32) = G_CONSTANT i32 1
117 %16:gpr(s32) = G_XOR %14, %15
118 %13:gpr(s1) = G_TRUNC %16(s32)
119 G_BRCOND %13(s1), %bb.5
123 successors: %bb.6(0x80000000)
125 %4:gpr(s32) = G_LOAD %5(p0), debug-location !13 :: (dereferenceable load (s32))
126 G_STORE %4(s32), %0(p0) :: (volatile store (s32) into %ir.1)
127 %6:gpr(s32) = G_LOAD %5(p0), debug-location !16 :: (dereferenceable load (s32))
128 G_STORE %6(s32), %0(p0) :: (volatile store (s32) into %ir.1)
132 successors: %bb.6(0x80000000)
134 G_STORE %2(s32), %3(p0), debug-location !17 :: (store (s32) into @C)
139 RET_ReallyLR implicit $w0