brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 6e02730 Raw
58 lines · plain
1; This test demonstrates how identical instruction sequences are handled during global outlining.2; Currently, we do not attempt to share an outlined function for identical sequences.3; Instead, each instruction sequence that matches against the global outlined hash tree4; is outlined into its own unique function.5 6; RUN: split-file %s %t7 8; First, we generate the cgdata file from a local outline instance present in local-two.ll.9; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-generate=true -filetype=obj %t/local-two.ll -o %t_write10; RUN: llvm-cgdata --merge %t_write -o %t_cgdata11; RUN: llvm-cgdata --show %t_cgdata | FileCheck %s --check-prefix=SHOW12 13; SHOW: Outlined hash tree:14; SHOW-NEXT:  Total Node Count: 415; SHOW-NEXT:  Terminal Node Count: 116; SHOW-NEXT:  Depth: 317 18; Now, we read the cgdata for local-two-another.ll and proceed to optimistically outline19; each instruction sequence that matches against the global outlined hash tree.20; Since each matching sequence is considered a candidate, we expect to generate two21; unique outlined functions. These functions, although unique, will be identical in code,22; and thus, will be folded by the linker.23 24; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-use-path=%t_cgdata -filetype=obj %t/local-two-another.ll -o %t_read25; RUN: llvm-objdump -d %t_read | FileCheck %s26 27; CHECK: _OUTLINED_FUNCTION_{{.*}}:28; CHECK-NEXT:  mov29; CHECK-NEXT:  mov30; CHECK-NEXT:  b31 32; CHECK: _OUTLINED_FUNCTION_{{.*}}:33; CHECK-NEXT:  mov34; CHECK-NEXT:  mov35; CHECK-NEXT:  b36 37;--- local-two.ll38declare i32 @g(i32, i32, i32)39define i32 @f1() minsize {40  %1 = call i32 @g(i32 10, i32 1, i32 2);41  ret i32 %142}43define i32 @f2() minsize {44  %1 = call i32 @g(i32 20, i32 1, i32 2);45  ret i32 %146}47 48;--- local-two-another.ll49declare i32 @g(i32, i32, i32)50define i32 @f3() minsize {51  %1 = call i32 @g(i32 30, i32 1, i32 2);52  ret i32 %153}54define i32 @f4() minsize {55  %1 = call i32 @g(i32 40, i32 1, i32 2);56  ret i32 %157}58