1 ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -stop-after=x86-optimize-LEAs -experimental-debug-variable-locations=false < %s \
2 ; RUN: | FileCheck %s --check-prefix=NORMAL
3 ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -stop-after=x86-optimize-LEAs -experimental-debug-variable-locations < %s \
4 ; RUN: | FileCheck %s --check-prefix=INSTRREF
6 ; The LEA optimization pass used to crash on this testcase.
8 ; This test case used to trigger:
10 ; assert(MRI->use_empty(LastVReg) &&
11 ; "The LEA's def register must have no uses");
15 ; NORMAL: DBG_VALUE_LIST
16 ; INSTRREF: DBG_INSTR_REF
18 target triple = "x86_64-unknown-linux-gnu"
20 %t10 = type { ptr, [32 x i8] }
24 %tmp11 = alloca [0 x [0 x i32]], i32 0, align 4
25 %i = alloca %t10, align 8
26 %i1 = alloca %t10, align 8
29 bb_8: ; preds = %bb_last, %bb_entry
30 br i1 undef, label %bb_last, label %bb_mid
32 bb_mid: ; preds = %bb_8
33 %i4 = getelementptr inbounds %t10, ptr %i1, i64 0, i32 1, i64 32
34 %i6 = getelementptr inbounds %t10, ptr %i, i64 0, i32 1, i64 32
35 call void @llvm.lifetime.start.p0(i64 0, ptr nonnull %i1)
36 %v21 = call i64 @llvm.ctlz.i64(i64 undef, i1 false)
37 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull dereferenceable(16) null, ptr noundef nonnull align 8 dereferenceable(16) %i4, i64 16, i1 false)
38 call void @llvm.dbg.value(metadata !DIArgList(ptr %i4, ptr %i4), metadata !4, metadata !DIExpression(DW_OP_LLVM_arg, 0)), !dbg !9
39 call void @llvm.lifetime.end.p0(i64 0, ptr nonnull %i1)
40 call void @llvm.lifetime.start.p0(i64 0, ptr nonnull %i)
41 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull dereferenceable(16) null, ptr noundef nonnull align 8 dereferenceable(16) %i6, i64 16, i1 false)
42 call void @llvm.lifetime.end.p0(i64 0, ptr nonnull %i)
45 bb_last: ; preds = %bb_mid, %bb_8
46 call void @llvm.lifetime.start.p0(i64 0, ptr nonnull %tmp11)
47 call void undef(ptr null, ptr null, ptr null, i32 0, ptr nonnull %tmp11)
48 call void @llvm.lifetime.end.p0(i64 0, ptr nonnull %tmp11)
52 declare i64 @llvm.ctlz.i64(i64, i1 immarg)
53 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
54 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
55 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
56 declare void @llvm.dbg.value(metadata, metadata, metadata)
59 !llvm.module.flags = !{!2}
61 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
62 !1 = !DIFile(filename: "n", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "e588179fedd8fcdfada963f2434cb950")
63 !2 = !{i32 2, !"Debug Info Version", i32 3}
64 !3 = !{!"function_entry_count", i64 2423}
65 !4 = !DILocalVariable(name: "r", scope: !5, file: !6, line: 93)
66 !5 = distinct !DISubprogram(name: "c", scope: !7, file: !6, line: 92, spFlags: DISPFlagDefinition, unit: !0)
67 !6 = !DIFile(filename: "a", directory: "/proc/self/cwd")
68 !7 = !DINamespace(name: "u", scope: !8)
69 !8 = !DINamespace(name: "s", scope: null)
70 !9 = !DILocation(line: 0, scope: !5)