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