1 # REQUIRES: x86-registered-target
2 # RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=mir-debugify,dead-mi-elimination,mir-check-debugify -o - %s 2>&1 | FileCheck %s
3 # RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=mir-debugify,mir-check-debugify -o - %s 2>&1 | FileCheck %s --check-prefix=CHECK-PASS
4 # RUN: llc --experimental-debuginfo-iterators=false -mtriple=x86_64-unknown-linux-gnu -run-pass=mir-debugify,dead-mi-elimination,mir-check-debugify -o - %s 2>&1 | FileCheck %s
5 # RUN: llc --experimental-debuginfo-iterators=false -mtriple=x86_64-unknown-linux-gnu -run-pass=mir-debugify,mir-check-debugify -o - %s 2>&1 | FileCheck %s --check-prefix=CHECK-PASS
7 ; ModuleID = 'check-line-and-variables.mir'
8 source_filename = "check-line-and-variables.ll"
10 @ga = dso_local global i32 2, align 4
12 ; Function Attrs: noinline nounwind optnone uwtable
13 define dso_local i32 @foo(i32 %a, i32 %b) {
15 %a.addr = alloca i32, align 4
16 %b.addr = alloca i32, align 4
17 %c = alloca i32, align 4
18 store i32 %a, ptr %a.addr, align 4
19 store i32 %b, ptr %b.addr, align 4
20 %0 = load i32, ptr %a.addr, align 4
21 %1 = load i32, ptr %b.addr, align 4
22 %add = add nsw i32 %0, %1
23 store i32 %add, ptr %c, align 4
24 %2 = load i32, ptr %c, align 4
25 %mul = mul nsw i32 %2, 2
26 store i32 %mul, ptr @ga, align 4
27 %3 = load i32, ptr %c, align 4
28 ; dead-mi-elimination will remove %4 = ...
29 %4 = load i32, ptr %a.addr, align 4
38 - { id: 0, name: a.addr, type: default, offset: 0, size: 4, alignment: 4,
39 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
40 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
41 - { id: 1, name: b.addr, type: default, offset: 0, size: 4, alignment: 4,
42 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
43 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
44 - { id: 2, name: c, type: default, offset: 0, size: 4, alignment: 4,
45 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
46 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
53 %1:gr32 = COPY killed %0
54 %3:gr32 = COPY killed %2
55 MOV32mr %stack.0.a.addr, 1, $noreg, 0, $noreg, %1 :: (store (s32) into %ir.a.addr)
56 MOV32mr %stack.1.b.addr, 1, $noreg, 0, $noreg, %3 :: (store (s32) into %ir.b.addr)
57 %14:gr32 = MOV32rm %stack.0.a.addr, 1, $noreg, 0, $noreg :: (load (s32) from %ir.a.addr)
58 %13:gr32 = ADD32rm killed %14, %stack.1.b.addr, 1, $noreg, 0, $noreg, implicit-def $eflags :: (load (s32) from %ir.b.addr)
59 ; dead-mi-elimination will remove %15:gr32 = ...
60 %15:gr32 = MOV32rm %stack.0.a.addr, 1, $noreg, 0, $noreg :: (load (s32) from %ir.a.addr)
61 MOV32mr %stack.2.c, 1, $noreg, 0, $noreg, killed %13 :: (store (s32) into %ir.c)
62 %9:gr32 = MOV32rm %stack.2.c, 1, $noreg, 0, $noreg :: (load (s32) from %ir.c)
63 %8:gr32 = SHL32ri killed %9, 1, implicit-def $eflags
64 MOV32mr $noreg, 1, $noreg, @ga, $noreg, killed %8 :: (store (s32) into @ga)
65 %5:gr32 = MOV32rm %stack.2.c, 1, $noreg, 0, $noreg :: (load (s32) from %ir.c)
69 ;CHECK: WARNING: Missing line 9
70 ;CHECK-NEXT: Machine IR debug info check: FAIL
71 ;CHECK-PASS: Machine IR debug info check: PASS