1 # RUN: llc -mtriple=x86_64-gnu-linux -run-pass=machine-combiner %s -o - | FileCheck %s
4 define float @reassoc_me(float %f1, float %f2, float %f3, float %f4) !dbg !4 {
5 %add = fadd reassoc nsz float %f1, %f2, !dbg !10
6 %add1 = fadd reassoc nsz float %add, %f3, !dbg !10
7 %add2 = fadd reassoc nsz float %add1, %f4, !dbg !10
8 call void @llvm.dbg.value(metadata float %add2, metadata !9, metadata !DIExpression()), !dbg !10
9 ret float %add2, !dbg !10
12 declare void @llvm.dbg.value(metadata, metadata, metadata)
15 !llvm.module.flags = !{!2, !3}
17 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "hello", isOptimized: true, emissionKind: FullDebug)
18 !1 = !DIFile(filename: "reassoc.c", directory: "blah")
19 !2 = !{i32 7, !"Dwarf Version", i32 4}
20 !3 = !{i32 2, !"Debug Info Version", i32 3}
21 !4 = distinct !DISubprogram(name: "reassoc_me", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, unit: !0, retainedNodes: !8)
22 !5 = !DISubroutineType(types: !6)
23 !6 = !{!7, !7, !7, !7, !7}
24 !7 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
26 !9 = !DILocalVariable(name: "temp3", scope: !4, file: !1, line: 4, type: !7)
27 !10 = !DILocation(line: 0, scope: !4)
36 liveins: $xmm0, $xmm1, $xmm2, $xmm3
42 %4:fr32 = nsz reassoc nofpexcept ADDSSrr %0, %1, implicit $mxcsr, debug-location !10
43 %5:fr32 = nsz reassoc nofpexcept ADDSSrr %4, %2, implicit $mxcsr, debug-location !10
44 %6:fr32 = nsz reassoc nofpexcept ADDSSrr %5, %3, implicit $mxcsr, debug-instr-number 1, debug-location !10
45 DBG_INSTR_REF !9, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !10
46 $xmm0 = COPY %6, debug-location !10
47 RET 0, $xmm0, debug-location !10
49 ; CHECK: ![[VAR:.*]] = !DILocalVariable(name: "temp3"
50 ; CHECK: %[[arg3:.*]]:fr32 = COPY $xmm3
51 ; CHECK-NEXT: %[[arg2:.*]]:fr32 = COPY $xmm2
52 ; CHECK-NEXT: %[[arg1:.*]]:fr32 = COPY $xmm1
53 ; CHECK-NEXT: %[[arg0:.*]]:fr32 = COPY $xmm0
54 ; CHECK-NEXT: %[[add1:.*]]:fr32 = {{.*}} ADDSSrr %[[arg0]], %[[arg1]]
55 ; CHECK-NEXT: %[[add2:.*]]:fr32 = {{.*}} ADDSSrr %[[arg2]], %[[arg3]]
56 ; CHECK-NEXT: ADDSSrr %[[add1]], killed %[[add2]], {{.*}} debug-instr-number 1
57 ; CHECK-NEXT: DBG_INSTR_REF ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)