Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: tests_lit/llvm2ice_tests/reorder-functions.ll

Issue 1206723003: Function Layout, Global Variable Layout and Pooled Constants Layout Reordering (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fixed some comments in patch set 1 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests_lit/llvm2ice_tests/reorder-functions.ll
diff --git a/tests_lit/llvm2ice_tests/reorder-functions.ll b/tests_lit/llvm2ice_tests/reorder-functions.ll
new file mode 100644
index 0000000000000000000000000000000000000000..886eb865d4a7ada219d7b7ed165217cd67d50a64
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/reorder-functions.ll
@@ -0,0 +1,110 @@
+; This is a smoke test of function reordering.
+
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: | FileCheck %s --check-prefix=DEFAULTWINDOWSIZE
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: -reorder-functions-window-size=1 \
+; RUN: | FileCheck %s --check-prefix=WINDOWSIZE1
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: -threads=0 \
+; RUN: | FileCheck %s --check-prefix=SEQUENTIAL
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: -reorder-functions-window-size=0xffffffff \
+; RUN: | FileCheck %s --check-prefix=WINDOWSIZEMAX
+
+
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: | FileCheck %s --check-prefix=DEFAULTWINDOWSIZE
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: -reorder-functions-window-size=1 \
+; RUN: | FileCheck %s --check-prefix=WINDOWSIZE1
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: -threads=0 \
+; RUN: | FileCheck %s --check-prefix=SEQUENTIAL
+; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
+; RUN: -sz-seed=1 -reorder-functions \
+; RUN: -reorder-functions-window-size=0xffffffff \
+; RUN: | FileCheck %s --check-prefix=WINDOWSIZEMAX
+
+define i32 @first_function(i32 %arg) {
+entry:
+ %res = add i32 200000, %arg
+ ret i32 %res
+}
+
+define float @second_function(float* %arg) {
+entry:
+ %arg.int = ptrtoint float* %arg to i32
+ %addr.int = add i32 %arg.int, 200000
+ %addr.ptr = inttoptr i32 %addr.int to float*
+ %addr.load = load float, float* %addr.ptr, align 4
+ ret float %addr.load
+}
+
+define i64 @third_function(i32 %arg) {
+entry:
+ %0 = sext i32 %arg to i64
+ %res = add i64 90000000000, %0
+ ret i64 %res
+}
+
+define i64 @fourth_function(i64* %arg) {
+entry:
+ %arg.int = ptrtoint i64* %arg to i32
+ %arg.new = add i32 %arg.int, 90000
+ %arg.ptr = inttoptr i32 %arg.new to i64*
+ %arg.load = load i64, i64* %arg.ptr, align 1
+ ret i64 %arg.load
+}
+
+define internal i32 @fifth_function(i32 %a) {
+entry:
+ %a_8 = trunc i32 %a to i8
+ %add = add i8 %a_8, 123
+ %ret = zext i8 %add to i32
+ ret i32 %ret
+}
+
+define internal i32 @sixth_function(i32 %a) {
+entry:
+ %a_16 = trunc i32 %a to i16
+ %add = add i16 %a_16, 32766
+ %ret = zext i16 %add to i32
+ ret i32 %ret
+}
+
+; DEFAULTWINDOWSIZE-LABEL: fourth_function
+; DEFAULTWINDOWSIZE-LABEL: first_function
+; DEFAULTWINDOWSIZE-LABEL: third_function
+; DEFAULTWINDOWSIZE-LABEL: sixth_function
+; DEFAULTWINDOWSIZE-LABEL: fifth_function
+; DEFAULTWINDOWSIZE-LABEL: second_function
+
+; WINDOWSIZE1-LABEL: first_function
+; WINDOWSIZE1-LABEL: second_function
+; WINDOWSIZE1-LABEL: third_function
+; WINDOWSIZE1-LABEL: fourth_function
+; WINDOWSIZE1-LABEL: fifth_function
+; WINDOWSIZE1-LABEL: sixth_function
+
+; SEQUENTIAL-LABEL: first_function
+; SEQUENTIAL-LABEL: second_function
+; SEQUENTIAL-LABEL: third_function
+; SEQUENTIAL-LABEL: fourth_function
+; SEQUENTIAL-LABEL: fifth_function
+; SEQUENTIAL-LABEL: sixth_function
+
+; WINDOWSIZEMAX-LABEL: fourth_function
+; WINDOWSIZEMAX-LABEL: first_function
+; WINDOWSIZEMAX-LABEL: third_function
+; WINDOWSIZEMAX-LABEL: sixth_function
+; WINDOWSIZEMAX-LABEL: fifth_function
+; WINDOWSIZEMAX-LABEL: second_function
+

Powered by Google App Engine
This is Rietveld 408576698