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
5 ; ModuleID = 'check-line-and-variables.mir'
6 source_filename = "check-line-and-variables.ll"
8 @ga = dso_local global i32 2, align 4
10 ; Function Attrs: noinline nounwind optnone uwtable
11 define dso_local i32 @foo(i32 %a, i32 %b) {
13 %a.addr = alloca i32, align 4
14 %b.addr = alloca i32, align 4
15 %c = alloca i32, align 4
16 store i32 %a, i32* %a.addr, align 4
17 store i32 %b, i32* %b.addr, align 4
18 %0 = load i32, i32* %a.addr, align 4
19 %1 = load i32, i32* %b.addr, align 4
20 %add = add nsw i32 %0, %1
21 store i32 %add, i32* %c, align 4
22 %2 = load i32, i32* %c, align 4
23 %mul = mul nsw i32 %2, 2
24 store i32 %mul, i32* @ga, align 4
25 %3 = load i32, i32* %c, align 4
26 ; dead-mi-elimination will remove %4 = ...
27 %4 = load i32, i32* %a.addr, align 4
36 - { id: 0, name: a.addr, type: default, offset: 0, size: 4, alignment: 4,
37 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
38 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
39 - { id: 1, name: b.addr, type: default, offset: 0, size: 4, alignment: 4,
40 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
41 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
42 - { id: 2, name: c, type: default, offset: 0, size: 4, alignment: 4,
43 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
44 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
51 %1:gr32 = COPY killed %0
52 %3:gr32 = COPY killed %2
53 MOV32mr %stack.0.a.addr, 1, $noreg, 0, $noreg, %1 :: (store (s32) into %ir.a.addr)
54 MOV32mr %stack.1.b.addr, 1, $noreg, 0, $noreg, %3 :: (store (s32) into %ir.b.addr)
55 %14:gr32 = MOV32rm %stack.0.a.addr, 1, $noreg, 0, $noreg :: (load (s32) from %ir.a.addr)
56 %13:gr32 = ADD32rm killed %14, %stack.1.b.addr, 1, $noreg, 0, $noreg, implicit-def $eflags :: (load (s32) from %ir.b.addr)
57 ; dead-mi-elimination will remove %15:gr32 = ...
58 %15:gr32 = MOV32rm %stack.0.a.addr, 1, $noreg, 0, $noreg :: (load (s32) from %ir.a.addr)
59 MOV32mr %stack.2.c, 1, $noreg, 0, $noreg, killed %13 :: (store (s32) into %ir.c)
60 %9:gr32 = MOV32rm %stack.2.c, 1, $noreg, 0, $noreg :: (load (s32) from %ir.c)
61 %8:gr32 = SHL32ri killed %9, 1, implicit-def $eflags
62 MOV32mr $noreg, 1, $noreg, @ga, $noreg, killed %8 :: (store (s32) into @ga)
63 %5:gr32 = MOV32rm %stack.2.c, 1, $noreg, 0, $noreg :: (load (s32) from %ir.c)
67 ;CHECK: WARNING: Missing line 9
68 ;CHECK-NEXT: Machine IR debug info check: FAIL
69 ;CHECK-PASS: Machine IR debug info check: PASS