1 ; RUN: opt -passes=argpromotion -S %s -o - | FileCheck %s
3 ; Fix for PR33641. ArgumentPromotion removed the argument to bar but left the call to
4 ; dbg.value which still used the removed argument.
6 ; The %p argument should be removed, and the use of it in dbg.value should be
12 call void @bar(ptr %a)
16 define internal void @bar(ptr %p) {
17 ; CHECK-LABEL: define {{.*}}void @bar()
18 ; CHECK-NEXT: #dbg_value(ptr undef, !3, !DIExpression(), !5
19 call void @llvm.dbg.value(metadata ptr %p, metadata !3, metadata !DIExpression()), !dbg !5
23 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
25 attributes #0 = { nofree nosync nounwind readnone speculatable willreturn }
28 !llvm.module.flags = !{!2}
30 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
31 !1 = !DIFile(filename: "test.c", directory: "")
32 !2 = !{i32 2, !"Debug Info Version", i32 3}
33 !3 = !DILocalVariable(name: "p", scope: !4)
34 !4 = distinct !DISubprogram(name: "bar", scope: null, spFlags: DISPFlagDefinition, unit: !0)
35 !5 = !DILocation(line: 1, column: 1, scope: !4)