1 ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse -enable-unsafe-fp-math < %s | FileCheck %s 2 3 ; The debug info in this test case was causing a crash because machine trace metrics 4 ; did not correctly ignore debug instructions. The check lines ensure that the 5 ; machine-combiner pass has run, reassociated the add operands, and therefore 6 ; used machine trace metrics. 7 8 define void @PR24199() { 9 ; CHECK-LABEL: PR24199: 10 ; CHECK: addss %xmm1, %xmm0 11 ; CHECK: addss %xmm2, %xmm0 12 13 entry: 14 %i = alloca %struct.A, align 8 15 %tobool = icmp ne i32 undef, 0 16 br i1 undef, label %if.end, label %if.then 17 18 if.then: 19 br label %if.end 20 21 if.end: 22 %h = phi float [ 0.0, %if.then ], [ 4.0, %entry ] 23 call void @foo(%struct.A* nonnull undef) 24 tail call void @llvm.dbg.value(metadata %struct.A* undef, i64 0, metadata !5, metadata !4), !dbg !6 25 tail call void @llvm.dbg.value(metadata float %h, i64 0, metadata !5, metadata !4), !dbg !6 26 %n0 = load float, float* undef, align 4 27 %mul = fmul fast float %n0, %h 28 %add = fadd fast float %mul, 1.0 29 tail call void @llvm.dbg.value(metadata %struct.A* undef, i64 0, metadata !5, metadata !4), !dbg !6 30 tail call void @llvm.dbg.value(metadata float %add, i64 0, metadata !5, metadata !4), !dbg !6 31 %add.i = fadd fast float %add, %n0 32 store float %add.i, float* undef, align 4 33 %n1 = bitcast %struct.A* %i to i8* 34 call void @llvm.lifetime.start(i64 16, i8* %n1) 35 %n2 = load <2 x float>, <2 x float>* undef, align 8 36 %conv = uitofp i1 %tobool to float 37 %bitcast = extractelement <2 x float> %n2, i32 0 38 %factor = fmul fast float %bitcast, 2.0 39 %add3 = fadd fast float %factor, %conv 40 call void @bar(float %add3) 41 ret void 42 } 43 44 %struct.A = type { float, float } 45 46 declare void @bar(float) 47 declare void @foo(%struct.A*) 48 declare void @llvm.lifetime.start(i64, i8* nocapture) 49 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 50 51 !llvm.dbg.cu = !{!0} 52 !llvm.module.flags = !{!2} 53 54 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: 1) 55 !1 = !DIFile(filename: "24199.cpp", directory: "/bin") 56 !2 = !{i32 2, !"Debug Info Version", i32 3} 57 !3 = distinct !DISubprogram(linkageName: "foo", file: !1, line: 18, isLocal: false, isDefinition: true, scopeLine: 18) 58 !4 = !DIExpression() 59 !5 = !DILocalVariable(name: "this", arg: 1, scope: !3, flags: DIFlagArtificial | DIFlagObjectPointer) 60 !6 = !DILocation(line: 0, scope: !3) 61 62 63