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

Side by Side Diff: tests_lit/llvm2ice_tests/branch-opt.ll

Issue 580903005: Subzero: Add branch optimization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/llvm2ice.cpp ('k') | tests_lit/llvm2ice_tests/ebp_args.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; Tests the branch optimizations under O2 (against a lack of
2 ; optimizations under Om1).
3
4 ; RUN: %llvm2ice -O2 --verbose none %s \
5 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
6 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \
7 ; RUN: | FileCheck --check-prefix=O2 %s
8 ; RUN: %llvm2ice -Om1 --verbose none %s \
9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
10 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \
11 ; RUN: | FileCheck --check-prefix=OM1 %s
12 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
13 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
14 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
15 ; RUN: | FileCheck --check-prefix=DUMP %s
16
17 declare void @dummy()
18
19 ; An unconditional branch to the next block should be removed.
20 define void @testUncondToNextBlock() {
21 entry:
22 call void @dummy()
23 br label %next
24 next:
25 call void @dummy()
26 ret void
27 }
28 ; O2-LABEL: testUncondToNextBlock
29 ; O2: call
30 ; O2-NEXT: call
31
32 ; OM1-LABEL: testUncondToNextBlock
33 ; OM1: call
34 ; OM1-NEXT: jmp
35 ; OM1-NEXT: call
36
37 ; For a conditional branch with a fallthrough to the next block, the
38 ; fallthrough branch should be removed.
39 define void @testCondFallthroughToNextBlock(i32 %arg) {
40 entry:
41 %cmp = icmp sge i32 %arg, 123
42 br i1 %cmp, label %target, label %fallthrough
43 fallthrough:
44 call void @dummy()
45 ret void
46 target:
47 call void @dummy()
48 ret void
49 }
50 ; O2-LABEL: testCondFallthroughToNextBlock
51 ; O2: cmp {{.*}}, 123
52 ; O2-NEXT: jge
53 ; O2-NEXT: call
54 ; O2: ret
55 ; O2: call
56 ; O2: ret
57
58 ; OM1-LABEL: testCondFallthroughToNextBlock
59 ; OM1: cmp {{.*}}, 123
60 ; OM1: jge
61 ; OM1: cmp
62 ; OM1: jne
63 ; OM1: jmp
64 ; OM1: call
65 ; OM1: ret
66 ; OM1: call
67 ; OM1: ret
68
69 ; For a conditional branch with the next block as the target and a
70 ; different block as the fallthrough, the branch condition should be
71 ; inverted, the fallthrough block changed to the target, and the
72 ; branch to the next block removed.
73 define void @testCondTargetNextBlock(i32 %arg) {
74 entry:
75 %cmp = icmp sge i32 %arg, 123
76 br i1 %cmp, label %fallthrough, label %target
77 fallthrough:
78 call void @dummy()
79 ret void
80 target:
81 call void @dummy()
82 ret void
83 }
84 ; O2-LABEL: testCondTargetNextBlock
85 ; O2: cmp {{.*}}, 123
86 ; O2-NEXT: jl
87 ; O2-NEXT: call
88 ; O2: ret
89 ; O2: call
90 ; O2: ret
91
92 ; OM1-LABEL: testCondTargetNextBlock
93 ; OM1: cmp {{.*}}, 123
94 ; OM1: jge
95 ; OM1: cmp
96 ; OM1: jne
97 ; OM1: jmp
98 ; OM1: call
99 ; OM1: ret
100 ; OM1: call
101 ; OM1: ret
102
103 ; ERRORS-NOT: ICE translation error
104 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « src/llvm2ice.cpp ('k') | tests_lit/llvm2ice_tests/ebp_args.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698