1; RUN: opt -passes=argpromotion -S %s -o - | FileCheck %s 2 3; Fix for PR33641. ArgumentPromotion removed the argument to bar but left the call to 4; dbg.value which still used the removed argument. 5 6; The %p argument should be removed, and the use of it in dbg.value should be 7; changed to poison. 8 9%fun_t = type ptr 10define void @foo() { 11 %a = alloca i16 12 call void @bar(ptr %a) 13 ret void 14} 15 16define internal void @bar(ptr %p) { 17; CHECK-LABEL: define {{.*}}void @bar() 18; CHECK-NEXT: #dbg_value(ptr poison, !3, !DIExpression(), !5 19 call void @llvm.dbg.value(metadata ptr %p, metadata !3, metadata !DIExpression()), !dbg !5 20 ret void 21} 22 23declare void @llvm.dbg.value(metadata, metadata, metadata) #0 24 25attributes #0 = { nofree nosync nounwind readnone speculatable willreturn } 26 27!llvm.dbg.cu = !{!0} 28!llvm.module.flags = !{!2} 29 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) 36