mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
300cd7b42b
In some cases, we can rename a store operand, in order to enable pairing of stores. For store pairs, that cannot be merged because the first tored register is defined in between the second store, we try to find suitable rename register. First, we check if we can rename the given register: 1. The first store register must be killed at the store, which means we do not have to rename instructions after the first store. 2. We scan backwards from the first store, to find the definition of the stored register and check all uses in between are renamable. Along they way, we collect the minimal register classes of the uses for overlapping (sub/super)registers. Second, we try to find an available register from the minimal physical register class of the original register. A suitable register must not be 1. defined before FirstMI 2. between the previous definition of the register to rename 3. a callee saved register. We use KILL flags to clear defined registers while scanning from the beginning to the end of the block. This triggers quite often, here are the top changes for MultiSource, SPEC2000, SPEC2006 compiled with -O3 for iOS: Metric: aarch64-ldst-opt.NumPairCreated Program base patch diff test-suite...nch/fourinarow/fourinarow.test 2.00 39.00 1850.0% test-suite...s/ASC_Sequoia/IRSmk/IRSmk.test 46.00 80.00 73.9% test-suite...chmarks/Olden/power/power.test 70.00 96.00 37.1% test-suite...cations/hexxagon/hexxagon.test 29.00 39.00 34.5% test-suite...nchmarks/McCat/05-eks/eks.test 100.00 132.00 32.0% test-suite.../Trimaran/enc-rc4/enc-rc4.test 46.00 59.00 28.3% test-suite...T2006/473.astar/473.astar.test 160.00 200.00 25.0% test-suite.../Trimaran/enc-md5/enc-md5.test 8.00 10.00 25.0% test-suite...telecomm-gsm/telecomm-gsm.test 113.00 139.00 23.0% test-suite...ediabench/gsm/toast/toast.test 113.00 139.00 23.0% test-suite...Source/Benchmarks/sim/sim.test 91.00 111.00 22.0% test-suite...C/CFP2000/179.art/179.art.test 41.00 49.00 19.5% test-suite...peg2/mpeg2dec/mpeg2decode.test 245.00 279.00 13.9% test-suite...marks/Olden/health/health.test 16.00 18.00 12.5% test-suite...ks/Prolangs-C/cdecl/cdecl.test 90.00 101.00 12.2% test-suite...fice-ispell/office-ispell.test 91.00 100.00 9.9% test-suite...oxyApps-C/miniGMG/miniGMG.test 430.00 465.00 8.1% test-suite...lowfish/security-blowfish.test 39.00 42.00 7.7% test-suite.../Applications/spiff/spiff.test 42.00 45.00 7.1% test-suite...arks/mafft/pairlocalalign.test 2473.00 2646.00 7.0% test-suite.../VersaBench/ecbdes/ecbdes.test 29.00 31.00 6.9% test-suite...nch/beamformer/beamformer.test 220.00 235.00 6.8% test-suite...CFP2000/177.mesa/177.mesa.test 2110.00 2252.00 6.7% test-suite...ve-susan/automotive-susan.test 109.00 116.00 6.4% test-suite...s-C/unix-smail/unix-smail.test 65.00 69.00 6.2% test-suite...CI_Purple/SMG2000/smg2000.test 1194.00 1265.00 5.9% test-suite.../Benchmarks/nbench/nbench.test 472.00 500.00 5.9% test-suite...oxyApps-C/miniAMR/miniAMR.test 248.00 262.00 5.6% test-suite...quoia/CrystalMk/CrystalMk.test 18.00 19.00 5.6% test-suite...rks/tramp3d-v4/tramp3d-v4.test 7331.00 7710.00 5.2% test-suite.../Benchmarks/Bullet/bullet.test 5651.00 5938.00 5.1% test-suite...ternal/HMMER/hmmcalibrate.test 750.00 788.00 5.1% test-suite...T2006/456.hmmer/456.hmmer.test 764.00 802.00 5.0% test-suite...ications/JM/ldecod/ldecod.test 1028.00 1079.00 5.0% test-suite...CFP2006/444.namd/444.namd.test 1368.00 1434.00 4.8% test-suite...marks/7zip/7zip-benchmark.test 4471.00 4685.00 4.8% test-suite...6/464.h264ref/464.h264ref.test 3122.00 3271.00 4.8% test-suite...pplications/oggenc/oggenc.test 1497.00 1565.00 4.5% test-suite...T2000/300.twolf/300.twolf.test 742.00 774.00 4.3% test-suite.../Prolangs-C/loader/loader.test 24.00 25.00 4.2% test-suite...0.perlbench/400.perlbench.test 1983.00 2058.00 3.8% test-suite...ications/JM/lencod/lencod.test 4612.00 4785.00 3.8% test-suite...yApps-C++/PENNANT/PENNANT.test 995.00 1032.00 3.7% test-suite...arks/VersaBench/dbms/dbms.test 54.00 56.00 3.7% Reviewers: efriedma, thegameg, samparker, dmgreen, paquette, evandro Reviewed By: paquette Differential Revision: https://reviews.llvm.org/D70450
131 lines
5.4 KiB
LLVM
131 lines
5.4 KiB
LLVM
; RUN: llc %s -enable-machine-outliner -mtriple=aarch64-unknown-unknown -pass-remarks=machine-outliner -pass-remarks-missed=machine-outliner -o /dev/null 2>&1 | FileCheck %s
|
|
; CHECK: <unknown>:0:0:
|
|
; CHECK-SAME: Did not outline 2 instructions from 2 locations.
|
|
; CHECK-SAME: Bytes from outlining all occurrences (16) >=
|
|
; CHECK-SAME: Unoutlined instruction bytes (16)
|
|
; CHECK-SAME: (Also found at: <UNKNOWN LOCATION>)
|
|
; CHECK: remark: <unknown>:0:0: Saved 36 bytes by outlining 11 instructions
|
|
; CHECK-SAME: from 2 locations. (Found at: <UNKNOWN LOCATION>,
|
|
; CHECK-SAME: <UNKNOWN LOCATION>)
|
|
; RUN: llc %s -enable-machine-outliner -mtriple=aarch64-unknown-unknown -o /dev/null -pass-remarks-missed=machine-outliner -pass-remarks-output=%t.yaml
|
|
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
|
|
|
|
; For the YAML case, the function we pick depends on the order of the candidate
|
|
; list.
|
|
; YAML: --- !Missed
|
|
; YAML-NEXT: Pass: machine-outliner
|
|
; YAML-NEXT: Name: NotOutliningCheaper
|
|
; YAML-NEXT: Function:
|
|
; YAML-NEXT: Args:
|
|
; YAML-NEXT: - String: 'Did not outline '
|
|
; YAML-NEXT: - Length: '2'
|
|
; YAML-NEXT: - String: ' instructions'
|
|
; YAML-NEXT: - String: ' from '
|
|
; YAML-NEXT: - NumOccurrences: '2'
|
|
; YAML-NEXT: - String: ' locations.'
|
|
; YAML-NEXT: - String: ' Bytes from outlining all occurrences ('
|
|
; YAML-NEXT: - OutliningCost: '16'
|
|
; YAML-NEXT: - String: ')'
|
|
; YAML-NEXT: - String: ' >= Unoutlined instruction bytes ('
|
|
; YAML-NEXT: - NotOutliningCost: '16'
|
|
; YAML-NEXT: - String: ')'
|
|
; YAML-NEXT: - String: ' (Also found at: '
|
|
; YAML-NEXT: - OtherStartLoc1: '<UNKNOWN LOCATION>'
|
|
; YAML-NEXT: - String: ')'
|
|
; YAML: --- !Passed
|
|
; YAML-NEXT: Pass: machine-outliner
|
|
; YAML-NEXT: Name: OutlinedFunction
|
|
; YAML-NEXT: Function: OUTLINED_FUNCTION_0
|
|
; YAML-NEXT: Args:
|
|
; YAML-NEXT: - String: 'Saved '
|
|
; YAML-NEXT: - OutliningBenefit: '36'
|
|
; YAML-NEXT: - String: ' bytes by '
|
|
; YAML-NEXT: - String: 'outlining '
|
|
; YAML-NEXT: - Length: '11'
|
|
; YAML-NEXT: - String: ' instructions '
|
|
; YAML-NEXT: - String: 'from '
|
|
; YAML-NEXT: - NumOccurrences: '2'
|
|
; YAML-NEXT: - String: ' locations. '
|
|
; YAML-NEXT: - String: '(Found at: '
|
|
; YAML-NEXT: - StartLoc0: '<UNKNOWN LOCATION>'
|
|
; YAML-NEXT: - String: ', '
|
|
; YAML-NEXT: - StartLoc1: '<UNKNOWN LOCATION>'
|
|
; YAML-NEXT: - String: ')'
|
|
|
|
define void @dog() #0 !dbg !8 {
|
|
entry:
|
|
%x = alloca i32, align 4
|
|
%y = alloca i32, align 4
|
|
store i32 0, i32* %x, align 4
|
|
store i32 1, i32* %y, align 4, !dbg !12
|
|
ret void
|
|
}
|
|
|
|
define void @cat() #0 !dbg !14 {
|
|
entry:
|
|
%x = alloca i32, align 4
|
|
%y = alloca i32, align 4
|
|
store i32 0, i32* %x, align 4
|
|
store i32 1, i32* %y, align 4, !dbg !16
|
|
ret void
|
|
}
|
|
|
|
define void @foo() #0 !dbg !18 {
|
|
%1 = alloca i32, align 4
|
|
%2 = alloca i32, align 4
|
|
%3 = alloca i32, align 4
|
|
%4 = alloca i32, align 4
|
|
%5 = alloca i32, align 4
|
|
%6 = alloca i32, align 4
|
|
store i32 1, i32* %1, align 4, !dbg !24
|
|
store i32 2, i32* %2, align 4
|
|
store i32 3, i32* %3, align 4
|
|
store i32 4, i32* %4, align 4
|
|
store i32 5, i32* %5, align 4
|
|
store i32 6, i32* %6, align 4, !dbg !26
|
|
ret void
|
|
}
|
|
|
|
define void @bar() #0 !dbg !27 {
|
|
%1 = alloca i32, align 4
|
|
%2 = alloca i32, align 4
|
|
%3 = alloca i32, align 4
|
|
%4 = alloca i32, align 4
|
|
%5 = alloca i32, align 4
|
|
%6 = alloca i32, align 4
|
|
store i32 1, i32* %1, align 4, !dbg !33
|
|
store i32 2, i32* %2, align 4
|
|
store i32 3, i32* %3, align 4
|
|
store i32 4, i32* %4, align 4
|
|
store i32 5, i32* %5, align 4
|
|
store i32 6, i32* %6, align 4, !dbg !35
|
|
ret void
|
|
}
|
|
|
|
attributes #0 = { noredzone nounwind ssp uwtable "no-frame-pointer-elim"="false" "target-cpu"="cyclone" }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4, !5, !6}
|
|
!llvm.ident = !{!7}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
|
!1 = !DIFile(filename: "machine-outliner-remarks.ll", directory: "/tmp")
|
|
!2 = !{}
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{i32 1, !"wchar_size", i32 4}
|
|
!6 = !{i32 7, !"PIC Level", i32 2}
|
|
!7 = !{!""}
|
|
!8 = distinct !DISubprogram(name: "dog", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!9 = !DISubroutineType(types: !10)
|
|
!10 = !{null}
|
|
!12 = !DILocation(line: 5, column: 9, scope: !8)
|
|
!14 = distinct !DISubprogram(name: "cat", scope: !1, file: !1, line: 10, type: !9, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!16 = !DILocation(line: 13, column: 9, scope: !14)
|
|
!18 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 26, type: !9, isLocal: false, isDefinition: true, scopeLine: 26, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!24 = !DILocation(line: 27, column: 9, scope: !18)
|
|
!26 = !DILocation(line: 29, column: 9, scope: !18)
|
|
!27 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 35, type: !9, isLocal: false, isDefinition: true, scopeLine: 35, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!33 = !DILocation(line: 36, column: 1, scope: !27)
|
|
!35 = !DILocation(line: 38, column: 1, scope: !27)
|