1; RUN: opt -S -callsite-splitting -o - < %s | FileCheck %s 2; RUN: opt -S -strip-debug -callsite-splitting -o - < %s | FileCheck %s 3 4define internal i16 @bar(i16 %p1, i16 %p2) { 5 %_tmp3 = mul i16 %p2, %p1 6 ret i16 %_tmp3 7} 8 9define i16 @foo(i16 %in) { 10bb0: 11 br label %bb1 12 13bb1: 14 %0 = icmp ne i16 %in, 0 15 br i1 %0, label %bb2, label %CallsiteBB 16 17bb2: 18 br label %CallsiteBB 19 20CallsiteBB: 21 %1 = phi i16 [ 0, %bb1 ], [ 1, %bb2 ] 22 %c = phi i16 [ 2, %bb1 ], [ 3, %bb2 ] 23 call void @llvm.dbg.value(metadata i16 %c, metadata !7, metadata !DIExpression()), !dbg !8 24 %2 = call i16 @bar(i16 %1, i16 5) 25 ret i16 %2 26} 27 28; Function Attrs: nounwind readnone speculatable 29declare void @llvm.dbg.value(metadata, metadata, metadata) #0 30 31attributes #0 = { nounwind readnone speculatable } 32 33!llvm.dbg.cu = !{!0} 34!llvm.module.flags = !{!2, !3} 35!llvm.ident = !{!4} 36 37!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "My Compiler") 38!1 = !DIFile(filename: "foo.c", directory: "/bar") 39!2 = !{i32 2, !"Dwarf Version", i32 4} 40!3 = !{i32 2, !"Debug Info Version", i32 3} 41!4 = !{!"My Compiler"} 42!5 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed) 43!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, unit: !0) 44!7 = !DILocalVariable(name: "c", scope: !6, line: 5, type: !5) 45!8 = !DILocation(line: 5, column: 7, scope: !6) 46 47; The optimization should trigger even in the presence of the dbg.value in 48; CallSiteBB. 49 50; CHECK-LABEL: @foo 51; CHECK-LABEL: bb1.split: 52; CHECK: [[TMP1:%[0-9]+]] = call i16 @bar(i16 0, i16 5) 53; CHECK-LABEL: bb2.split: 54; CHECK: [[TMP2:%[0-9]+]] = call i16 @bar(i16 1, i16 5) 55; CHECK-LABEL: CallsiteBB 56; CHECK: %phi.call = phi i16 [ [[TMP2]], %bb2.split ], [ [[TMP1]], %bb1.split 57