| OLD | NEW |
| (Empty) | |
| 1 ; This is a smoke test of function reordering. |
| 2 |
| 3 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 4 ; RUN: -sz-seed=1 -reorder-functions \ |
| 5 ; RUN: | FileCheck %s --check-prefix=DEFAULTWINDOWSIZE |
| 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 7 ; RUN: -sz-seed=1 -reorder-functions \ |
| 8 ; RUN: -reorder-functions-window-size=1 \ |
| 9 ; RUN: | FileCheck %s --check-prefix=WINDOWSIZE1 |
| 10 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 11 ; RUN: -sz-seed=1 -reorder-functions \ |
| 12 ; RUN: -threads=0 \ |
| 13 ; RUN: | FileCheck %s --check-prefix=SEQUENTIAL |
| 14 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 15 ; RUN: -sz-seed=1 -reorder-functions \ |
| 16 ; RUN: -reorder-functions-window-size=0xffffffff \ |
| 17 ; RUN: | FileCheck %s --check-prefix=WINDOWSIZEMAX |
| 18 |
| 19 |
| 20 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 21 ; RUN: -sz-seed=1 -reorder-functions \ |
| 22 ; RUN: | FileCheck %s --check-prefix=DEFAULTWINDOWSIZE |
| 23 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 24 ; RUN: -sz-seed=1 -reorder-functions \ |
| 25 ; RUN: -reorder-functions-window-size=1 \ |
| 26 ; RUN: | FileCheck %s --check-prefix=WINDOWSIZE1 |
| 27 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 28 ; RUN: -sz-seed=1 -reorder-functions \ |
| 29 ; RUN: -threads=0 \ |
| 30 ; RUN: | FileCheck %s --check-prefix=SEQUENTIAL |
| 31 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 32 ; RUN: -sz-seed=1 -reorder-functions \ |
| 33 ; RUN: -reorder-functions-window-size=0xffffffff \ |
| 34 ; RUN: | FileCheck %s --check-prefix=WINDOWSIZEMAX |
| 35 |
| 36 define i32 @first_function(i32 %arg) { |
| 37 entry: |
| 38 %res = add i32 200000, %arg |
| 39 ret i32 %res |
| 40 } |
| 41 |
| 42 define float @second_function(float* %arg) { |
| 43 entry: |
| 44 %arg.int = ptrtoint float* %arg to i32 |
| 45 %addr.int = add i32 %arg.int, 200000 |
| 46 %addr.ptr = inttoptr i32 %addr.int to float* |
| 47 %addr.load = load float, float* %addr.ptr, align 4 |
| 48 ret float %addr.load |
| 49 } |
| 50 |
| 51 define i64 @third_function(i32 %arg) { |
| 52 entry: |
| 53 %0 = sext i32 %arg to i64 |
| 54 %res = add i64 90000000000, %0 |
| 55 ret i64 %res |
| 56 } |
| 57 |
| 58 define i64 @fourth_function(i64* %arg) { |
| 59 entry: |
| 60 %arg.int = ptrtoint i64* %arg to i32 |
| 61 %arg.new = add i32 %arg.int, 90000 |
| 62 %arg.ptr = inttoptr i32 %arg.new to i64* |
| 63 %arg.load = load i64, i64* %arg.ptr, align 1 |
| 64 ret i64 %arg.load |
| 65 } |
| 66 |
| 67 define internal i32 @fifth_function(i32 %a) { |
| 68 entry: |
| 69 %a_8 = trunc i32 %a to i8 |
| 70 %add = add i8 %a_8, 123 |
| 71 %ret = zext i8 %add to i32 |
| 72 ret i32 %ret |
| 73 } |
| 74 |
| 75 define internal i32 @sixth_function(i32 %a) { |
| 76 entry: |
| 77 %a_16 = trunc i32 %a to i16 |
| 78 %add = add i16 %a_16, 32766 |
| 79 %ret = zext i16 %add to i32 |
| 80 ret i32 %ret |
| 81 } |
| 82 |
| 83 ; DEFAULTWINDOWSIZE-LABEL: fourth_function |
| 84 ; DEFAULTWINDOWSIZE-LABEL: first_function |
| 85 ; DEFAULTWINDOWSIZE-LABEL: third_function |
| 86 ; DEFAULTWINDOWSIZE-LABEL: sixth_function |
| 87 ; DEFAULTWINDOWSIZE-LABEL: fifth_function |
| 88 ; DEFAULTWINDOWSIZE-LABEL: second_function |
| 89 |
| 90 ; WINDOWSIZE1-LABEL: first_function |
| 91 ; WINDOWSIZE1-LABEL: second_function |
| 92 ; WINDOWSIZE1-LABEL: third_function |
| 93 ; WINDOWSIZE1-LABEL: fourth_function |
| 94 ; WINDOWSIZE1-LABEL: fifth_function |
| 95 ; WINDOWSIZE1-LABEL: sixth_function |
| 96 |
| 97 ; SEQUENTIAL-LABEL: first_function |
| 98 ; SEQUENTIAL-LABEL: second_function |
| 99 ; SEQUENTIAL-LABEL: third_function |
| 100 ; SEQUENTIAL-LABEL: fourth_function |
| 101 ; SEQUENTIAL-LABEL: fifth_function |
| 102 ; SEQUENTIAL-LABEL: sixth_function |
| 103 |
| 104 ; WINDOWSIZEMAX-LABEL: fourth_function |
| 105 ; WINDOWSIZEMAX-LABEL: first_function |
| 106 ; WINDOWSIZEMAX-LABEL: third_function |
| 107 ; WINDOWSIZEMAX-LABEL: sixth_function |
| 108 ; WINDOWSIZEMAX-LABEL: fifth_function |
| 109 ; WINDOWSIZEMAX-LABEL: second_function |
| 110 |
| OLD | NEW |