|
3 | 3 |
|
4 | 4 | ; RUN: split-file %s %t |
5 | 5 |
|
6 | | -; Check if the outlined function is created locally. |
7 | | -; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-generate=true -aarch64-enable-collect-loh=false -filetype=obj %t/local-two.ll -o %t_write_base |
8 | | -; RUN: llvm-objdump -d %t_write_base | FileCheck %s |
| 6 | +; The outlined function is created locally. |
| 7 | +; Note that `.str.3` is commonly used in both `f1()` and `f2()`. |
| 8 | +; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-generate -aarch64-enable-collect-loh=false \ |
| 9 | +; RUN: %t/local-two.ll -o - | FileCheck %s --check-prefix=WRITE |
9 | 10 |
|
| 11 | +; WRITE-LABEL: _OUTLINED_FUNCTION_{{.*}}: |
| 12 | +; WRITE: adrp x1, l_.str.3 |
| 13 | +; WRITE-NEXT: add x1, x1, l_.str.3 |
| 14 | +; WRITE-NEXT: mov w2 |
| 15 | +; WRITE-NEXT: mov w3 |
| 16 | +; WRITE-NEXT: mov w4 |
| 17 | +; WRITE-NEXT: b |
| 18 | + |
| 19 | +; Create an object file and merge it into the cgdata. |
| 20 | +; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-generate -aarch64-enable-collect-loh=false \ |
| 21 | +; RUN: -filetype=obj %t/local-two.ll -o %t_write_base |
10 | 22 | ; RUN: llvm-cgdata --merge %t_write_base -o %t_cgdata_base |
11 | 23 |
|
12 | 24 | ; Read the cgdata in the machine outliner for optimistically outlining in local-one.ll. |
13 | | -; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-use-path=%t_cgdata_base -aarch64-enable-collect-loh=false -append-content-hash-outlined-name=false -filetype=obj %t/local-one.ll -o %t_read_base |
14 | | -; RUN: llvm-objdump -d %t_read_base | FileCheck %s |
15 | | - |
16 | | -; The names of globals `.str` and `.str.4` are different, but their initial contents are identical. |
17 | | -; The outlined function now starts with a reference to that global ("hello\00"). |
18 | | -; CHECK: _OUTLINED_FUNCTION_{{.*}}: |
19 | | -; CHECK-NEXT: adrp x1 |
20 | | -; CHECK-NEXT: add x1, x1 |
21 | | -; CHECK-NEXT: mov w2 |
22 | | -; CHECK-NEXT: mov w3 |
23 | | -; CHECK-NEXT: mov w4 |
24 | | -; CHECK-NEXT: b |
| 25 | +; Note that the hash of `.str.5` in local-one.ll matches that of `.str.3` in an outlined tree in the cgdata. |
| 26 | + |
| 27 | +; RUN: llc -mtriple=arm64-apple-darwin -enable-machine-outliner -codegen-data-use-path=%t_cgdata_base -aarch64-enable-collect-loh=false \ |
| 28 | +; RUN: %t/local-one.ll -o - | FileCheck %s --check-prefix=READ |
| 29 | + |
| 30 | +; READ-LABEL: _OUTLINED_FUNCTION_{{.*}}: |
| 31 | +; READ: adrp x1, l_.str.5 |
| 32 | +; READ-NEXT: add x1, x1, l_.str.5 |
| 33 | +; READ-NEXT: mov w2 |
| 34 | +; READ-NEXT: mov w3 |
| 35 | +; READ-NEXT: mov w4 |
| 36 | +; READ-NEXT: b |
25 | 37 |
|
26 | 38 | ;--- local-two.ll |
27 | | -@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1 |
28 | 39 | @.str.1 = private unnamed_addr constant [3 x i8] c"f1\00", align 1 |
29 | 40 | @.str.2 = private unnamed_addr constant [3 x i8] c"f2\00", align 1 |
| 41 | +@.str.3 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 |
30 | 42 |
|
31 | 43 | declare noundef i32 @goo(ptr noundef, ptr noundef, i32, i32, i32) |
32 | 44 | define i32 @f1() minsize { |
33 | 45 | entry: |
34 | | - %call = tail call noundef i32 @goo(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str, i32 1, i32 2, i32 3) |
| 46 | + %call = tail call noundef i32 @goo(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.3, i32 1, i32 2, i32 3) |
35 | 47 | ret i32 %call |
36 | 48 | } |
37 | 49 | define i32 @f2() minsize { |
38 | 50 | entry: |
39 | | - %call = tail call noundef i32 @goo(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, i32 1, i32 2, i32 3) |
| 51 | + %call = tail call noundef i32 @goo(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 1, i32 2, i32 3) |
40 | 52 | ret i32 %call |
41 | 53 | } |
42 | 54 |
|
43 | 55 | ;--- local-one.ll |
44 | | -@.str.3 = private unnamed_addr constant [3 x i8] c"f3\00", align 1 |
45 | | -@.str.4 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 |
| 56 | +@.str.4 = private unnamed_addr constant [3 x i8] c"f3\00", align 1 |
| 57 | +@.str.5 = private unnamed_addr constant [6 x i8] c"hello\00", align 1 |
46 | 58 |
|
47 | 59 | declare noundef i32 @goo(ptr noundef, ptr noundef, i32, i32, i32) |
48 | 60 | define i32 @f1() minsize { |
49 | 61 | entry: |
50 | | - %call = tail call noundef i32 @goo(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 1, i32 2, i32 3) |
| 62 | + %call = tail call noundef i32 @goo(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 1, i32 2, i32 3) |
51 | 63 | ret i32 %call |
52 | 64 | } |
0 commit comments