brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 09b0253 Raw
97 lines · plain
1; This tests the order in which functions are outlined in MachineOutliner2; There are TWO key OutlinedFunction in FunctionList3;4; ===================== First One =====================5;   ```6;     mov     w0, #17;     mov     w1, #28;     mov     w2, #39;     mov     w3, #410;     mov     w4, #511;   ```12; It has:13;   - `SequenceSize=20` and `OccurrenceCount=6`14;   - each Candidate has `CallOverhead=12` and `FrameOverhead=4`15;   - `NotOutlinedCost=20*6=120` and `OutliningCost=12*6+20+4=96`16;   - `Benefit=120-96=24` and `Priority=120/96=1.25`17;18; ===================== Second One =====================19;   ```20;     mov     w6, #621;     mov     w7, #722;     b23;   ```24; It has:25;   - `SequenceSize=12` and `OccurrenceCount=4`26;   - each Candidate has `CallOverhead=4` and `FrameOverhead=0`27;   - `NotOutlinedCost=12*4=48` and `OutliningCost=4*4+12+0=28`28;   - `Benefit=48-28=20` and `Priority=48/28=1.71`29;30; Note that the first one has higher benefit, but lower priority.31; Hence, when outlining per priority, the second one will be outlined first.32 33; RUN: llc %s -enable-machine-outliner=always -filetype=obj -o %t34; RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=CHECK-SORT-BY-PRIORITY35 36; RUN: llc %s -enable-machine-outliner=always -outliner-benefit-threshold=22 -filetype=obj -o %t37; RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=CHECK-THRESHOLD38 39 40target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"41target triple = "arm64-apple-macosx14.0.0"42 43declare i32 @_Z3fooiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef)44 45define i32 @_Z2f1v() minsize {46  %1 = tail call i32 @_Z3fooiiii(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, i32 noundef 11, i32 noundef 6, i32 noundef 7)47  ret i32 %148}49 50define i32 @_Z2f2v() minsize {51  %1 = tail call i32 @_Z3fooiiii(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, i32 noundef 12, i32 noundef 6, i32 noundef 7)52  ret i32 %153}54 55define i32 @_Z2f3v() minsize {56  %1 = tail call i32 @_Z3fooiiii(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, i32 noundef 13, i32 noundef 6, i32 noundef 7)57  ret i32 %158}59 60define i32 @_Z2f4v() minsize {61  %1 = tail call i32 @_Z3fooiiii(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, i32 noundef 14, i32 noundef 6, i32 noundef 7)62  ret i32 %163}64 65define i32 @_Z2f5v() minsize {66  %1 = tail call i32 @_Z3fooiiii(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, i32 noundef 15, i32 noundef 8, i32 noundef 9)67  ret i32 %168}69 70define i32 @_Z2f6v() minsize {71  %1 = tail call i32 @_Z3fooiiii(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, i32 noundef 16, i32 noundef 9, i32 noundef 8)72  ret i32 %173}74 75; CHECK-SORT-BY-PRIORITY: <_OUTLINED_FUNCTION_0>:76; CHECK-SORT-BY-PRIORITY-NEXT: mov     w6, #0x677; CHECK-SORT-BY-PRIORITY-NEXT: mov     w7, #0x778; CHECK-SORT-BY-PRIORITY-NEXT: b79 80; CHECK-SORT-BY-PRIORITY: <_OUTLINED_FUNCTION_1>:81; CHECK-SORT-BY-PRIORITY-NEXT: mov     w0, #0x182; CHECK-SORT-BY-PRIORITY-NEXT: mov     w1, #0x283; CHECK-SORT-BY-PRIORITY-NEXT: mov     w2, #0x384; CHECK-SORT-BY-PRIORITY-NEXT: mov     w3, #0x485; CHECK-SORT-BY-PRIORITY-NEXT: mov     w4, #0x586; CHECK-SORT-BY-PRIORITY-NEXT: ret87 88; CHECK-THRESHOLD: <_OUTLINED_FUNCTION_0>:89; CHECK-THRESHOLD-NEXT: mov     w0, #0x190; CHECK-THRESHOLD-NEXT: mov     w1, #0x291; CHECK-THRESHOLD-NEXT: mov     w2, #0x392; CHECK-THRESHOLD-NEXT: mov     w3, #0x493; CHECK-THRESHOLD-NEXT: mov     w4, #0x594; CHECK-THRESHOLD-NEXT: ret95 96; CHECK-THRESHOLD-NOT: <_OUTLINED_FUNCTION_1>:97