98 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse < %s | FileCheck %s3 4; The debug info in this test case was causing a crash because machine trace metrics5; did not correctly ignore debug instructions. The check lines ensure that the6; machine-combiner pass has run, reassociated the add operands, and therefore7; used machine trace metrics.8 9define void @PR24199(i32 %a0) {10; CHECK-LABEL: PR24199:11; CHECK: # %bb.0: # %entry12; CHECK-NEXT: pushq %rbx13; CHECK-NEXT: .cfi_def_cfa_offset 1614; CHECK-NEXT: subq $16, %rsp15; CHECK-NEXT: .cfi_def_cfa_offset 3216; CHECK-NEXT: .cfi_offset %rbx, -1617; CHECK-NEXT: movl %edi, %ebx18; CHECK-NEXT: testb %al, %al19; CHECK-NEXT: je .LBB0_220; CHECK-NEXT: # %bb.1:21; CHECK-NEXT: movss {{.*#+}} xmm0 = [4.0E+0,0.0E+0,0.0E+0,0.0E+0]22; CHECK-NEXT: jmp .LBB0_323; CHECK-NEXT: .LBB0_2: # %if.then24; CHECK-NEXT: xorps %xmm0, %xmm025; CHECK-NEXT: .LBB0_3: # %if.end26; CHECK-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill27; CHECK-NEXT: callq foo@PLT28; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero29; CHECK-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 4-byte Reload30; CHECK-NEXT: # xmm2 = mem[0],zero,zero,zero31; CHECK-NEXT: mulss %xmm0, %xmm232; CHECK-NEXT: movss {{.*#+}} xmm1 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]33; CHECK-NEXT: addss %xmm1, %xmm034; CHECK-NEXT: addss %xmm2, %xmm035; CHECK-NEXT: movss %xmm0, (%rax)36; CHECK-NEXT: testl %ebx, %ebx37; CHECK-NEXT: jne .LBB0_538; CHECK-NEXT: # %bb.4: # %if.end39; CHECK-NEXT: xorps %xmm1, %xmm140; CHECK-NEXT: .LBB0_5: # %if.end41; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero42; CHECK-NEXT: addss %xmm0, %xmm043; CHECK-NEXT: addss %xmm1, %xmm044; CHECK-NEXT: callq bar@PLT45; CHECK-NEXT: addq $16, %rsp46; CHECK-NEXT: .cfi_def_cfa_offset 1647; CHECK-NEXT: popq %rbx48; CHECK-NEXT: .cfi_def_cfa_offset 849; CHECK-NEXT: retq50 51entry:52 %i = alloca %struct.A, align 853 %tobool = icmp ne i32 %a0, 054 br i1 poison, label %if.end, label %if.then55 56if.then:57 br label %if.end58 59if.end:60 %h = phi float [ 0.0, %if.then ], [ 4.0, %entry ]61 call void @foo(ptr nonnull undef)62 tail call void @llvm.dbg.value(metadata ptr undef, i64 0, metadata !5, metadata !4), !dbg !663 tail call void @llvm.dbg.value(metadata float %h, i64 0, metadata !5, metadata !4), !dbg !664 %n0 = load float, ptr undef, align 465 %mul = fmul fast float %n0, %h66 %add = fadd fast float %mul, 1.067 tail call void @llvm.dbg.value(metadata ptr undef, i64 0, metadata !5, metadata !4), !dbg !668 tail call void @llvm.dbg.value(metadata float %add, i64 0, metadata !5, metadata !4), !dbg !669 %add.i = fadd fast float %add, %n070 store float %add.i, ptr undef, align 471 call void @llvm.lifetime.start.p0(i64 16, ptr %i)72 %n2 = load <2 x float>, ptr undef, align 873 %conv = uitofp i1 %tobool to float74 %bitcast = extractelement <2 x float> %n2, i32 075 %factor = fmul fast float %bitcast, 2.076 %add3 = fadd fast float %factor, %conv77 call void @bar(float %add3)78 ret void79}80 81%struct.A = type { float, float }82 83declare void @bar(float)84declare void @foo(ptr)85declare void @llvm.lifetime.start.p0(i64, ptr nocapture)86declare void @llvm.dbg.value(metadata, i64, metadata, metadata)87 88!llvm.dbg.cu = !{!0}89!llvm.module.flags = !{!2}90 91!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)92!1 = !DIFile(filename: "24199.cpp", directory: "/bin")93!2 = !{i32 2, !"Debug Info Version", i32 3}94!3 = distinct !DISubprogram(linkageName: "foo", file: !1, line: 18, isLocal: false, isDefinition: true, scopeLine: 18, unit: !0)95!4 = !DIExpression()96!5 = !DILocalVariable(name: "this", arg: 1, scope: !3, flags: DIFlagArtificial | DIFlagObjectPointer)97!6 = !DILocation(line: 0, scope: !3)98