2017-03-01 07:37:04 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -disable-block-placement -verify-machineinstrs -fast-isel=false -machine-sink-split-probability-threshold=0 -cgp-freq-ratio-to-skip-merge=1000 | FileCheck %s
|
|
|
|
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals -tail-dup-placement=0 -verify-machineinstrs -fast-isel=false -machine-sink-split-probability-threshold=0 -cgp-freq-ratio-to-skip-merge=1000 | FileCheck -check-prefix=OPT %s
|
2015-09-17 00:51:30 +08:00
|
|
|
|
|
|
|
; Test the CFG stackifier pass.
|
|
|
|
|
2016-05-11 01:39:48 +08:00
|
|
|
; Explicitly disable fast-isel, since it gets implicitly enabled in the
|
|
|
|
; optnone test.
|
|
|
|
|
2016-01-07 11:19:23 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
2017-03-01 07:37:04 +08:00
|
|
|
target triple = "wasm32-unknown-unknown-wasm"
|
2015-09-17 00:51:30 +08:00
|
|
|
|
|
|
|
declare void @something()
|
|
|
|
|
|
|
|
; Test that loops are made contiguous, even in the presence of split backedges.
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: test0:
|
|
|
|
; CHECK: loop
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: block
|
2016-05-18 04:19:47 +08:00
|
|
|
; CHECK: i32.lt_s
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NEXT: br_if
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: return
|
|
|
|
; CHECK-NEXT: .LBB0_3:
|
|
|
|
; CHECK-NEXT: end_block
|
2016-08-16 02:51:42 +08:00
|
|
|
; CHECK-NEXT: i32.const
|
|
|
|
; CHECK-NEXT: i32.add
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: call
|
|
|
|
; CHECK-NEXT: br
|
|
|
|
; CHECK-NEXT: .LBB0_4:
|
|
|
|
; CHECK-NEXT: end_loop
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: test0:
|
|
|
|
; OPT: loop
|
2016-05-18 04:19:47 +08:00
|
|
|
; OPT: i32.ge_s
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: br_if
|
2016-08-16 02:51:42 +08:00
|
|
|
; OPT-NEXT: i32.const
|
|
|
|
; OPT-NEXT: i32.add
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-NOT: br
|
|
|
|
; OPT: call
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT: br 0{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT: return{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define void @test0(i32 %n) {
|
|
|
|
entry:
|
|
|
|
br label %header
|
|
|
|
|
|
|
|
header:
|
|
|
|
%i = phi i32 [ 0, %entry ], [ %i.next, %back ]
|
|
|
|
%i.next = add i32 %i, 1
|
|
|
|
|
|
|
|
%c = icmp slt i32 %i.next, %n
|
|
|
|
br i1 %c, label %back, label %exit
|
|
|
|
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
|
|
|
|
back:
|
|
|
|
call void @something()
|
|
|
|
br label %header
|
|
|
|
}
|
|
|
|
|
|
|
|
; Same as test0, but the branch condition is reversed.
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: test1:
|
|
|
|
; CHECK: loop
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: block
|
2016-05-18 04:19:47 +08:00
|
|
|
; CHECK: i32.lt_s
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NEXT: br_if
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: return
|
|
|
|
; CHECK-NEXT: .LBB1_3:
|
|
|
|
; CHECK-NEXT: end_block
|
2016-08-16 02:51:42 +08:00
|
|
|
; CHECK-NEXT: i32.const
|
|
|
|
; CHECK-NEXT: i32.add
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: call
|
|
|
|
; CHECK-NEXT: br
|
|
|
|
; CHECK-NEXT: .LBB1_4:
|
|
|
|
; CHECK-NEXT: end_loop
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: test1:
|
|
|
|
; OPT: loop
|
2016-05-18 04:19:47 +08:00
|
|
|
; OPT: i32.ge_s
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: br_if
|
2016-08-16 02:51:42 +08:00
|
|
|
; OPT-NEXT: i32.const
|
|
|
|
; OPT-NEXT: i32.add
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-NOT: br
|
|
|
|
; OPT: call
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT: br 0{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT: return{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define void @test1(i32 %n) {
|
|
|
|
entry:
|
|
|
|
br label %header
|
|
|
|
|
|
|
|
header:
|
|
|
|
%i = phi i32 [ 0, %entry ], [ %i.next, %back ]
|
|
|
|
%i.next = add i32 %i, 1
|
|
|
|
|
|
|
|
%c = icmp sge i32 %i.next, %n
|
|
|
|
br i1 %c, label %exit, label %back
|
|
|
|
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
|
|
|
|
back:
|
|
|
|
call void @something()
|
|
|
|
br label %header
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test that a simple loop is handled as expected.
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: test2:
|
2016-01-07 02:29:35 +08:00
|
|
|
; CHECK-NOT: local
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; CHECK: .LBB2_{{[0-9]+}}:
|
2016-05-18 04:19:47 +08:00
|
|
|
; CHECK: loop
|
|
|
|
; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; CHECK: .LBB2_{{[0-9]+}}:
|
2016-05-18 04:19:47 +08:00
|
|
|
; CHECK: end_loop
|
|
|
|
; CHECK: end_block
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK: return{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: test2:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NOT: local
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; OPT: .LBB2_{{[0-9]+}}:
|
2016-05-18 04:19:47 +08:00
|
|
|
; OPT: loop
|
|
|
|
; OPT: br_if 0, $pop{{[0-9]+}}{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; OPT: .LBB2_{{[0-9]+}}:
|
2016-05-18 04:19:47 +08:00
|
|
|
; OPT: end_loop
|
|
|
|
; OPT: end_block
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT: return{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define void @test2(double* nocapture %p, i32 %n) {
|
|
|
|
entry:
|
|
|
|
%cmp.4 = icmp sgt i32 %n, 0
|
|
|
|
br i1 %cmp.4, label %for.body.preheader, label %for.end
|
|
|
|
|
|
|
|
for.body.preheader:
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
for.body:
|
|
|
|
%i.05 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
|
|
|
|
%arrayidx = getelementptr inbounds double, double* %p, i32 %i.05
|
|
|
|
%0 = load double, double* %arrayidx, align 8
|
|
|
|
%mul = fmul double %0, 3.200000e+00
|
|
|
|
store double %mul, double* %arrayidx, align 8
|
|
|
|
%inc = add nuw nsw i32 %i.05, 1
|
|
|
|
%exitcond = icmp eq i32 %inc, %n
|
|
|
|
br i1 %exitcond, label %for.end.loopexit, label %for.body
|
|
|
|
|
|
|
|
for.end.loopexit:
|
|
|
|
br label %for.end
|
|
|
|
|
|
|
|
for.end:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: doublediamond:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, ${{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 1{{$}}
|
|
|
|
; CHECK: .LBB3_2:
|
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, ${{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB3_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB3_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-01-20 00:59:23 +08:00
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: doublediamond:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 0, ${{[^,]+}}{{$}}
|
|
|
|
; OPT: br_if 1, ${{[^,]+}}{{$}}
|
|
|
|
; OPT: br 2{{$}}
|
|
|
|
; OPT-NEXT: .LBB3_3:
|
|
|
|
; OPT-NEXT: end_block
|
|
|
|
; OPT: br 1{{$}}
|
|
|
|
; OPT-NEXT: .LBB3_4:
|
|
|
|
; OPT: .LBB3_5:
|
|
|
|
; OPT-NEXT: end_block
|
|
|
|
; OPT: return $pop{{[0-9]+}}{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @doublediamond(i32 %a, i32 %b, i32* %p) {
|
|
|
|
entry:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
%d = icmp eq i32 %b, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br i1 %c, label %true, label %false
|
|
|
|
true:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br label %exit
|
|
|
|
false:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
br i1 %d, label %ft, label %ff
|
|
|
|
ft:
|
|
|
|
store volatile i32 3, i32* %p
|
|
|
|
br label %exit
|
|
|
|
ff:
|
|
|
|
store volatile i32 4, i32* %p
|
|
|
|
br label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 5, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: triangle:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB4_2:
|
2016-08-19 01:51:27 +08:00
|
|
|
; CHECK: return
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: triangle:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB4_2:
|
2016-08-19 01:51:27 +08:00
|
|
|
; OPT: return
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @triangle(i32* %p, i32 %a) {
|
|
|
|
entry:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br i1 %c, label %true, label %exit
|
|
|
|
true:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: diamond:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $1{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB5_2:
|
|
|
|
; CHECK: .LBB5_3:
|
2016-01-20 00:59:23 +08:00
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: diamond:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
|
|
|
; OPT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB5_2:
|
|
|
|
; OPT: .LBB5_3:
|
2016-01-20 00:59:23 +08:00
|
|
|
; OPT: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; OPT-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @diamond(i32* %p, i32 %a) {
|
|
|
|
entry:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br i1 %c, label %true, label %false
|
|
|
|
true:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br label %exit
|
|
|
|
false:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
br label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 3, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: single_block:
|
2015-09-17 00:51:30 +08:00
|
|
|
; CHECK-NOT: br
|
2015-11-26 00:55:01 +08:00
|
|
|
; CHECK: return $pop{{[0-9]+}}{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: single_block:
|
|
|
|
; OPT-NOT: br
|
|
|
|
; OPT: return $pop{{[0-9]+}}{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @single_block(i32* %p) {
|
|
|
|
entry:
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: minimal_loop:
|
2015-09-17 00:51:30 +08:00
|
|
|
; CHECK-NOT: br
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB7_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: loop i32
|
2016-10-07 06:08:28 +08:00
|
|
|
; CHECK: i32.store 0($0), $pop{{[0-9]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 0{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB7_2:
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: minimal_loop:
|
|
|
|
; OPT-NOT: br
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB7_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: loop i32
|
2016-10-07 06:08:28 +08:00
|
|
|
; OPT: i32.store 0($0), $pop{{[0-9]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT: br 0{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB7_2:
|
2016-10-07 06:29:32 +08:00
|
|
|
define i32 @minimal_loop(i32* %p) {
|
2015-09-17 00:51:30 +08:00
|
|
|
entry:
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br label %loop
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: simple_loop:
|
2015-09-17 00:51:30 +08:00
|
|
|
; CHECK-NOT: br
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB8_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: loop {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2016-01-20 00:59:23 +08:00
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: simple_loop:
|
|
|
|
; OPT-NOT: br
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB8_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: loop {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2016-01-20 00:59:23 +08:00
|
|
|
; OPT: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; OPT-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @simple_loop(i32* %p, i32 %a) {
|
|
|
|
entry:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br i1 %c, label %loop, label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: doubletriangle:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $0{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB9_3:
|
|
|
|
; CHECK: .LBB9_4:
|
2016-08-19 01:51:27 +08:00
|
|
|
; CHECK: return
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: doubletriangle:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $0{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB9_3:
|
|
|
|
; OPT: .LBB9_4:
|
2016-08-19 01:51:27 +08:00
|
|
|
; OPT: return
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @doubletriangle(i32 %a, i32 %b, i32* %p) {
|
|
|
|
entry:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
%d = icmp eq i32 %b, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br i1 %c, label %true, label %exit
|
|
|
|
true:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
br i1 %d, label %tt, label %tf
|
|
|
|
tt:
|
|
|
|
store volatile i32 3, i32* %p
|
|
|
|
br label %tf
|
|
|
|
tf:
|
|
|
|
store volatile i32 4, i32* %p
|
|
|
|
br label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 5, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: ifelse_earlyexits:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $0{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB10_2:
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB10_4:
|
2016-01-20 00:59:23 +08:00
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: ifelse_earlyexits:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
|
|
|
; OPT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
|
|
|
; OPT: br_if 1, $1{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB10_3:
|
|
|
|
; OPT: .LBB10_4:
|
2016-01-20 00:59:23 +08:00
|
|
|
; OPT: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; OPT-NEXT: return $pop{{[0-9]+}}{{$}}
|
2015-09-17 00:51:30 +08:00
|
|
|
define i32 @ifelse_earlyexits(i32 %a, i32 %b, i32* %p) {
|
|
|
|
entry:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
%d = icmp eq i32 %b, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br i1 %c, label %true, label %false
|
|
|
|
true:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br label %exit
|
|
|
|
false:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
br i1 %d, label %ft, label %exit
|
|
|
|
ft:
|
|
|
|
store volatile i32 3, i32* %p
|
|
|
|
br label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 4, i32* %p
|
|
|
|
ret i32 0
|
|
|
|
}
|
2015-10-03 05:11:36 +08:00
|
|
|
|
2015-11-24 00:19:56 +08:00
|
|
|
; CHECK-LABEL: doublediamond_in_a_loop:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB11_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: loop i32{{$}}
|
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $0{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB11_3:
|
2016-05-10 12:24:02 +08:00
|
|
|
; CHECK: end_block{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $1{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB11_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 0{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; CHECK: .LBB11_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2015-12-05 11:03:35 +08:00
|
|
|
; OPT-LABEL: doublediamond_in_a_loop:
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: .LBB11_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: loop i32{{$}}
|
|
|
|
; OPT: block {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br 2{{$}}
|
|
|
|
; OPT-NEXT: .LBB11_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br 1{{$}}
|
|
|
|
; OPT: .LBB11_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br 0{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; OPT: .LBB11_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
define i32 @doublediamond_in_a_loop(i32 %a, i32 %b, i32* %p) {
|
2015-11-24 00:19:56 +08:00
|
|
|
entry:
|
|
|
|
br label %header
|
|
|
|
header:
|
|
|
|
%c = icmp eq i32 %a, 0
|
|
|
|
%d = icmp eq i32 %b, 0
|
|
|
|
store volatile i32 0, i32* %p
|
|
|
|
br i1 %c, label %true, label %false
|
|
|
|
true:
|
|
|
|
store volatile i32 1, i32* %p
|
|
|
|
br label %exit
|
|
|
|
false:
|
|
|
|
store volatile i32 2, i32* %p
|
|
|
|
br i1 %d, label %ft, label %ff
|
|
|
|
ft:
|
|
|
|
store volatile i32 3, i32* %p
|
|
|
|
br label %exit
|
|
|
|
ff:
|
|
|
|
store volatile i32 4, i32* %p
|
|
|
|
br label %exit
|
|
|
|
exit:
|
|
|
|
store volatile i32 5, i32* %p
|
|
|
|
br label %header
|
|
|
|
}
|
|
|
|
|
2015-10-03 05:11:36 +08:00
|
|
|
; Test that nested loops are handled.
|
|
|
|
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-LABEL: test3:
|
|
|
|
; CHECK: loop
|
|
|
|
; CHECK-NEXT: br_if
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NEXT: loop
|
|
|
|
; OPT-LABEL: test3:
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: block
|
|
|
|
; OPT: br_if
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT: .LBB{{[0-9]+}}_{{[0-9]+}}:
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT-NEXT: loop
|
|
|
|
; OPT-NEXT: block
|
|
|
|
; OPT-NEXT: block
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: br_if
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: loop
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if
|
|
|
|
; OPT-NEXT: br
|
|
|
|
; OPT-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
|
|
|
|
; OPT-NEXT: end_loop
|
|
|
|
; OPT-NEXT: end_block
|
|
|
|
; OPT-NEXT: unreachable
|
|
|
|
; OPT-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
|
|
|
|
; OPT-NEXT: end_block
|
|
|
|
; OPT: br
|
|
|
|
; OPT-NEXT: .LBB{{[0-9]+}}_{{[0-9]+}}:
|
|
|
|
; OPT-NEXT: end_loop
|
2015-10-03 05:11:36 +08:00
|
|
|
declare void @bar()
|
|
|
|
define void @test3(i32 %w) {
|
|
|
|
entry:
|
|
|
|
br i1 undef, label %outer.ph, label %exit
|
|
|
|
|
|
|
|
outer.ph:
|
|
|
|
br label %outer
|
|
|
|
|
|
|
|
outer:
|
|
|
|
%tobool = icmp eq i32 undef, 0
|
|
|
|
br i1 %tobool, label %inner, label %unreachable
|
|
|
|
|
|
|
|
unreachable:
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
inner:
|
|
|
|
%c = icmp eq i32 undef, %w
|
|
|
|
br i1 %c, label %if.end, label %inner
|
|
|
|
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
|
|
|
|
if.end:
|
|
|
|
call void @bar()
|
|
|
|
br label %outer
|
|
|
|
}
|
2015-12-15 06:51:54 +08:00
|
|
|
|
|
|
|
; Test switch lowering and block placement.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: .param i32{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK: br_if 1, $pop{{[0-9]+}}{{$}}
|
|
|
|
; CHECK: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB13_3:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK: br_if 0, $pop{{[0-9]+}}{{$}}
|
|
|
|
; CHECK: br_if 1, $pop{{[0-9]+}}{{$}}
|
|
|
|
; CHECK-NEXT: .LBB13_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NEXT: return{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK-NEXT: .LBB13_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NEXT: return{{$}}
|
|
|
|
; OPT-LABEL: test4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: .param i32{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $pop{{[0-9]+}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT: br_if 1, $pop{{[0-9]+}}{{$}}
|
|
|
|
; OPT: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB13_3:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $pop{{[0-9]+}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT: br_if 1, $pop{{[0-9]+}}{{$}}
|
|
|
|
; OPT-NEXT: .LBB13_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: return{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT-NEXT: .LBB13_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: return{{$}}
|
|
|
|
define void @test4(i32 %t) {
|
|
|
|
entry:
|
|
|
|
switch i32 %t, label %default [
|
|
|
|
i32 0, label %bb2
|
|
|
|
i32 2, label %bb2
|
|
|
|
i32 4, label %bb1
|
|
|
|
i32 622, label %bb0
|
|
|
|
]
|
|
|
|
|
|
|
|
bb0:
|
|
|
|
ret void
|
|
|
|
|
|
|
|
bb1:
|
|
|
|
ret void
|
|
|
|
|
|
|
|
bb2:
|
|
|
|
ret void
|
|
|
|
|
|
|
|
default:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a case where the BLOCK needs to be placed before the LOOP in the
|
|
|
|
; same basic block.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test5:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB14_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: loop {{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB14_4:
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK: return{{$}}
|
|
|
|
; OPT-LABEL: test5:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB14_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: loop {{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB14_4:
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT: return{{$}}
|
|
|
|
define void @test5(i1 %p, i1 %q) {
|
|
|
|
entry:
|
|
|
|
br label %header
|
|
|
|
|
|
|
|
header:
|
|
|
|
store volatile i32 0, i32* null
|
|
|
|
br i1 %p, label %more, label %alt
|
|
|
|
|
|
|
|
more:
|
|
|
|
store volatile i32 1, i32* null
|
|
|
|
br i1 %q, label %header, label %return
|
|
|
|
|
|
|
|
alt:
|
|
|
|
store volatile i32 2, i32* null
|
|
|
|
ret void
|
|
|
|
|
|
|
|
return:
|
|
|
|
store volatile i32 3, i32* null
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test an interesting case of a loop with multiple exits, which
|
|
|
|
; aren't to layout successors of the loop, and one of which is to a successors
|
|
|
|
; which has another predecessor.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test6:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB15_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 2, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB15_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB15_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: return{{$}}
|
|
|
|
; OPT-LABEL: test6:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB15_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 2, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB15_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB15_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: return{{$}}
|
|
|
|
define void @test6(i1 %p, i1 %q) {
|
|
|
|
entry:
|
|
|
|
br label %header
|
|
|
|
|
|
|
|
header:
|
|
|
|
store volatile i32 0, i32* null
|
|
|
|
br i1 %p, label %more, label %second
|
|
|
|
|
|
|
|
more:
|
|
|
|
store volatile i32 1, i32* null
|
|
|
|
br i1 %q, label %evenmore, label %first
|
|
|
|
|
|
|
|
evenmore:
|
|
|
|
store volatile i32 1, i32* null
|
|
|
|
br i1 %q, label %header, label %return
|
|
|
|
|
|
|
|
return:
|
|
|
|
store volatile i32 2, i32* null
|
|
|
|
ret void
|
|
|
|
|
|
|
|
first:
|
|
|
|
store volatile i32 3, i32* null
|
|
|
|
br label %second
|
|
|
|
|
|
|
|
second:
|
|
|
|
store volatile i32 4, i32* null
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a case where there are multiple backedges and multiple loop exits
|
|
|
|
; that end in unreachable.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test7:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB16_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: unreachable
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: .LBB16_4:
|
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: unreachable
|
|
|
|
; OPT-LABEL: test7:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB16_1:
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT-NEXT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT: br 2{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT-NEXT: .LBB16_3:
|
|
|
|
; OPT-NEXT: end_block
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT-NEXT: end_loop
|
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: unreachable
|
|
|
|
; OPT-NEXT: .LBB16_5:
|
|
|
|
; OPT-NEXT: end_block
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: unreachable
|
|
|
|
define void @test7(i1 %tobool2, i1 %tobool9) {
|
|
|
|
entry:
|
|
|
|
store volatile i32 0, i32* null
|
|
|
|
br label %loop
|
|
|
|
|
|
|
|
loop:
|
|
|
|
store volatile i32 1, i32* null
|
|
|
|
br i1 %tobool2, label %l1, label %l0
|
|
|
|
|
|
|
|
l0:
|
|
|
|
store volatile i32 2, i32* null
|
|
|
|
br i1 %tobool9, label %loop, label %u0
|
|
|
|
|
|
|
|
l1:
|
|
|
|
store volatile i32 3, i32* null
|
|
|
|
br i1 %tobool9, label %loop, label %u1
|
|
|
|
|
|
|
|
u0:
|
|
|
|
store volatile i32 4, i32* null
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
u1:
|
|
|
|
store volatile i32 5, i32* null
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test an interesting case using nested loops and switches.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test8:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB17_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop i32{{$}}
|
2016-01-20 13:55:09 +08:00
|
|
|
; CHECK-NEXT: i32.const $push{{[^,]+}}, 0{{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK-NEXT: br_if 0, {{[^,]+}}{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; CHECK-NEXT: br 0{{$}}
|
|
|
|
; CHECK-NEXT: .LBB17_2:
|
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-LABEL: test8:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB17_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: loop i32{{$}}
|
2016-01-20 13:55:09 +08:00
|
|
|
; OPT-NEXT: i32.const $push{{[^,]+}}, 0{{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT-NEXT: br_if 0, {{[^,]+}}{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; OPT-NEXT: br 0{{$}}
|
|
|
|
; OPT-NEXT: .LBB17_2:
|
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
define i32 @test8() {
|
2015-12-15 06:51:54 +08:00
|
|
|
bb:
|
|
|
|
br label %bb1
|
|
|
|
|
|
|
|
bb1:
|
|
|
|
br i1 undef, label %bb2, label %bb3
|
|
|
|
|
|
|
|
bb2:
|
|
|
|
switch i8 undef, label %bb1 [
|
|
|
|
i8 44, label %bb2
|
|
|
|
]
|
|
|
|
|
|
|
|
bb3:
|
|
|
|
switch i8 undef, label %bb1 [
|
|
|
|
i8 44, label %bb2
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test an interesting case using nested loops that share a bottom block.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test9:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB18_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB18_2:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: br_if 2, {{[^,]+}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK-NEXT: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB18_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK-NEXT: br 0{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB18_5:
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: end_block
|
|
|
|
; CHECK-NOT: block
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK: return{{$}}
|
|
|
|
; OPT-LABEL: test9:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB18_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB18_2:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT-NEXT: br 2{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB18_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT-NEXT: br 1{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB18_5:
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT: end_block
|
|
|
|
; OPT-NOT: block
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT: return{{$}}
|
|
|
|
declare i1 @a()
|
|
|
|
define void @test9() {
|
|
|
|
entry:
|
|
|
|
store volatile i32 0, i32* null
|
|
|
|
br label %header
|
|
|
|
|
|
|
|
header:
|
|
|
|
store volatile i32 1, i32* null
|
|
|
|
%call4 = call i1 @a()
|
|
|
|
br i1 %call4, label %header2, label %end
|
|
|
|
|
|
|
|
header2:
|
|
|
|
store volatile i32 2, i32* null
|
|
|
|
%call = call i1 @a()
|
|
|
|
br i1 %call, label %if.then, label %if.else
|
|
|
|
|
|
|
|
if.then:
|
|
|
|
store volatile i32 3, i32* null
|
|
|
|
%call3 = call i1 @a()
|
|
|
|
br i1 %call3, label %header2, label %header
|
|
|
|
|
|
|
|
if.else:
|
|
|
|
store volatile i32 4, i32* null
|
|
|
|
%call2 = call i1 @a()
|
|
|
|
br i1 %call2, label %header2, label %header
|
|
|
|
|
|
|
|
end:
|
|
|
|
store volatile i32 5, i32* null
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test an interesting case involving nested loops sharing a loop bottom,
|
|
|
|
; and loop exits to a block with unreachable.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test10:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB19_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; CHECK: .LBB19_3:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-04-06 01:01:52 +08:00
|
|
|
; CHECK: .LBB19_4:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: br_if 3, {{[^,]+}}{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK: br_table {{[^,]+}}, 1, 0, 4, 2, 3, 1{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; CHECK-NEXT: .LBB19_6:
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NEXT: return{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; CHECK-NEXT: .LBB19_7:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 0{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; CHECK-NEXT: .LBB19_8:
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-LABEL: test10:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB19_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; OPT: .LBB19_3:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-04-06 01:01:52 +08:00
|
|
|
; OPT: .LBB19_4:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT: br_if 3, {{[^,]+}}{{$}}
|
|
|
|
; OPT: block
|
|
|
|
; OPT: br_table {{[^,]+}}, 1, 0, 4, 2, 3, 1{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; OPT-NEXT: .LBB19_6:
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_loop{{$}}
|
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NEXT: return{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; OPT-NEXT: .LBB19_7:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT: br 0{{$}}
|
2016-04-06 01:01:52 +08:00
|
|
|
; OPT-NEXT: .LBB19_8:
|
2015-12-15 06:51:54 +08:00
|
|
|
define void @test10() {
|
|
|
|
bb0:
|
|
|
|
br label %bb1
|
|
|
|
|
|
|
|
bb1:
|
|
|
|
%tmp = phi i32 [ 2, %bb0 ], [ 3, %bb3 ]
|
|
|
|
%tmp3 = phi i32 [ undef, %bb0 ], [ %tmp11, %bb3 ]
|
|
|
|
%tmp4 = icmp eq i32 %tmp3, 0
|
|
|
|
br i1 %tmp4, label %bb4, label %bb2
|
|
|
|
|
|
|
|
bb2:
|
|
|
|
br label %bb3
|
|
|
|
|
|
|
|
bb3:
|
|
|
|
%tmp11 = phi i32 [ 1, %bb5 ], [ 0, %bb2 ]
|
|
|
|
br label %bb1
|
|
|
|
|
|
|
|
bb4:
|
|
|
|
%tmp6 = phi i32 [ %tmp9, %bb5 ], [ 4, %bb1 ]
|
|
|
|
%tmp7 = phi i32 [ %tmp6, %bb5 ], [ %tmp, %bb1 ]
|
|
|
|
br label %bb5
|
|
|
|
|
|
|
|
bb5:
|
|
|
|
%tmp9 = phi i32 [ %tmp6, %bb5 ], [ %tmp7, %bb4 ]
|
|
|
|
switch i32 %tmp9, label %bb2 [
|
|
|
|
i32 0, label %bb5
|
|
|
|
i32 1, label %bb6
|
|
|
|
i32 3, label %bb4
|
|
|
|
i32 4, label %bb3
|
|
|
|
]
|
|
|
|
|
|
|
|
bb6:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test a CFG DAG with interesting merging.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test11:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-08-19 01:51:27 +08:00
|
|
|
; CHECK-NEXT: i32.const
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK-NEXT: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 2, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB20_3:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB20_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: br_if 2, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB20_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB20_7:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB20_8:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
|
|
|
; CHECK: return{{$}}
|
|
|
|
; OPT-LABEL: test11:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $pop{{[0-9]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-08-19 01:51:27 +08:00
|
|
|
; OPT-NEXT: i32.const
|
|
|
|
; OPT-NEXT: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 2, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB20_3:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB20_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $pop{{[0-9]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB20_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, $pop{{[0-9]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: return{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB20_8:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
|
|
|
; OPT: return{{$}}
|
|
|
|
define void @test11() {
|
|
|
|
bb0:
|
|
|
|
store volatile i32 0, i32* null
|
|
|
|
br i1 undef, label %bb1, label %bb4
|
|
|
|
bb1:
|
|
|
|
store volatile i32 1, i32* null
|
|
|
|
br i1 undef, label %bb3, label %bb2
|
|
|
|
bb2:
|
|
|
|
store volatile i32 2, i32* null
|
|
|
|
br i1 undef, label %bb3, label %bb7
|
|
|
|
bb3:
|
|
|
|
store volatile i32 3, i32* null
|
|
|
|
ret void
|
|
|
|
bb4:
|
|
|
|
store volatile i32 4, i32* null
|
|
|
|
br i1 undef, label %bb8, label %bb5
|
|
|
|
bb5:
|
|
|
|
store volatile i32 5, i32* null
|
|
|
|
br i1 undef, label %bb6, label %bb7
|
|
|
|
bb6:
|
|
|
|
store volatile i32 6, i32* null
|
|
|
|
ret void
|
|
|
|
bb7:
|
|
|
|
store volatile i32 7, i32* null
|
|
|
|
ret void
|
|
|
|
bb8:
|
|
|
|
store volatile i32 8, i32* null
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: test12:
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK: .LBB21_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 1, {{[^,]+}}{{$}}
|
|
|
|
; CHECK-NEXT: br 3{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB21_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 2, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; CHECK-NEXT: .LBB21_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; CHECK-NOT: block
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK: br 0{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: .LBB21_7:
|
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: return{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-LABEL: test12:
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT: .LBB21_1:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: loop {{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 1, {{[^,]+}}{{$}}
|
|
|
|
; OPT-NEXT: br 3{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB21_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 0, {{[^,]+}}{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
; OPT-NOT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 2, {{[^,]+}}{{$}}
|
2016-01-08 02:49:53 +08:00
|
|
|
; OPT-NEXT: .LBB21_6:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
|
|
|
; OPT: br 0{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT-NEXT: .LBB21_7:
|
|
|
|
; OPT-NEXT: end_loop{{$}}
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT-NEXT: return{{$}}
|
2015-12-15 06:51:54 +08:00
|
|
|
define void @test12(i8* %arg) {
|
|
|
|
bb:
|
|
|
|
br label %bb1
|
|
|
|
|
|
|
|
bb1:
|
|
|
|
%tmp = phi i32 [ 0, %bb ], [ %tmp5, %bb4 ]
|
|
|
|
%tmp2 = getelementptr i8, i8* %arg, i32 %tmp
|
|
|
|
%tmp3 = load i8, i8* %tmp2
|
|
|
|
switch i8 %tmp3, label %bb7 [
|
|
|
|
i8 42, label %bb4
|
|
|
|
i8 76, label %bb4
|
|
|
|
i8 108, label %bb4
|
|
|
|
i8 104, label %bb4
|
|
|
|
]
|
|
|
|
|
|
|
|
bb4:
|
|
|
|
%tmp5 = add i32 %tmp, 1
|
|
|
|
br label %bb1
|
|
|
|
|
|
|
|
bb7:
|
|
|
|
ret void
|
|
|
|
}
|
2015-12-17 03:06:41 +08:00
|
|
|
|
|
|
|
; A block can be "branched to" from another even if it is also reachable via
|
|
|
|
; fallthrough from the other. This would normally be optimized away, so use
|
|
|
|
; optnone to disable optimizations to test this case.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test13:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 0, $pop0{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK: block {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 0, $pop3{{$}}
|
|
|
|
; CHECK: .LBB22_3:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 1, $pop{{[0-9]+}}{{$}}
|
|
|
|
; CHECK-NEXT: br 1{{$}}
|
|
|
|
; CHECK-NEXT: .LBB22_4:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: return{{$}}
|
|
|
|
; CHECK-NEXT: .LBB22_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2015-12-17 03:06:41 +08:00
|
|
|
; CHECK-NEXT: unreachable{{$}}
|
|
|
|
; OPT-LABEL: test13:
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT-NEXT: block {{$}}
|
|
|
|
; OPT-NEXT: block {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 0, $pop0{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; OPT: block {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 0, $pop3{{$}}
|
|
|
|
; OPT: .LBB22_3:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; OPT: br_if 1, $pop{{[0-9]+}}{{$}}
|
|
|
|
; OPT-NEXT: br 1{{$}}
|
|
|
|
; OPT-NEXT: .LBB22_4:
|
|
|
|
; OPT-NEXT: end_block
|
|
|
|
; OPT-NEXT: return
|
|
|
|
; OPT-NEXT: .LBB22_5:
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; OPT-NEXT: end_block{{$}}
|
2015-12-17 03:06:41 +08:00
|
|
|
; OPT-NEXT: unreachable{{$}}
|
|
|
|
define void @test13() noinline optnone {
|
|
|
|
bb:
|
|
|
|
br i1 undef, label %bb5, label %bb2
|
|
|
|
bb1:
|
|
|
|
unreachable
|
|
|
|
bb2:
|
|
|
|
br i1 undef, label %bb3, label %bb4
|
|
|
|
bb3:
|
|
|
|
br label %bb4
|
|
|
|
bb4:
|
|
|
|
%tmp = phi i1 [ false, %bb2 ], [ false, %bb3 ]
|
|
|
|
br i1 %tmp, label %bb1, label %bb1
|
|
|
|
bb5:
|
|
|
|
ret void
|
|
|
|
}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
|
|
|
|
; Test a case with a single-block loop that has another loop
|
|
|
|
; as a successor. The end_loop for the first loop should go
|
|
|
|
; before the loop for the second.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test14:
|
|
|
|
; CHECK-NEXT: .LBB23_1:{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop {{$}}
|
2016-01-20 00:59:23 +08:00
|
|
|
; CHECK-NEXT: i32.const $push0=, 0{{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK-NEXT: br_if 0, $pop0{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2016-05-10 12:24:02 +08:00
|
|
|
; CHECK-NEXT: .LBB23_3:{{$}}
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: loop {{$}}
|
2016-01-20 00:59:23 +08:00
|
|
|
; CHECK-NEXT: i32.const $push1=, 0{{$}}
|
2016-02-09 05:50:13 +08:00
|
|
|
; CHECK-NEXT: br_if 0, $pop1{{$}}
|
[WebAssembly] Make CFG stackification independent of basic-block labels.
This patch changes the way labels are referenced. Instead of referencing the
basic-block label name (eg. .LBB0_0), instructions now just have an immediate
which indicates the depth in the control-flow stack to find a label to jump to.
This makes them much closer to what we expect to have in the binary encoding,
and avoids the problem of basic-block label names not being explicit in the
binary encoding.
Also, it terminates blocks and loops with end_block and end_loop instructions,
rather than basic-block label names, for similar reasons.
This will also fix problems where two constructs appear to have the same label,
because we no longer explicitly use labels, so consumers that need labels will
presumably create their own labels, and presumably they won't reuse labels
when they do.
This patch does make the code a little more awkward to read; as a partial
mitigation, this patch also introduces comments showing where the labels are,
and comments on each branch showing where it's branching to.
llvm-svn: 257505
2016-01-13 03:14:46 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
|
|
|
; CHECK-NEXT: return{{$}}
|
|
|
|
define void @test14() {
|
|
|
|
bb:
|
|
|
|
br label %bb1
|
|
|
|
|
|
|
|
bb1:
|
|
|
|
%tmp = bitcast i1 undef to i1
|
|
|
|
br i1 %tmp, label %bb3, label %bb1
|
|
|
|
|
|
|
|
bb3:
|
|
|
|
br label %bb4
|
|
|
|
|
|
|
|
bb4:
|
|
|
|
br i1 undef, label %bb7, label %bb48
|
|
|
|
|
|
|
|
bb7:
|
|
|
|
br i1 undef, label %bb12, label %bb12
|
|
|
|
|
|
|
|
bb12:
|
|
|
|
br i1 undef, label %bb17, label %bb17
|
|
|
|
|
|
|
|
bb17:
|
|
|
|
br i1 undef, label %bb22, label %bb22
|
|
|
|
|
|
|
|
bb22:
|
|
|
|
br i1 undef, label %bb27, label %bb27
|
|
|
|
|
|
|
|
bb27:
|
|
|
|
br i1 undef, label %bb30, label %bb30
|
|
|
|
|
|
|
|
bb30:
|
|
|
|
br i1 undef, label %bb35, label %bb35
|
|
|
|
|
|
|
|
bb35:
|
|
|
|
br i1 undef, label %bb38, label %bb38
|
|
|
|
|
|
|
|
bb38:
|
|
|
|
br i1 undef, label %bb48, label %bb48
|
|
|
|
|
|
|
|
bb48:
|
|
|
|
%tmp49 = bitcast i1 undef to i1
|
|
|
|
br i1 %tmp49, label %bb3, label %bb50
|
|
|
|
|
|
|
|
bb50:
|
|
|
|
ret void
|
|
|
|
}
|
2016-02-13 05:19:25 +08:00
|
|
|
|
|
|
|
; Test that a block boundary which ends one block, begins another block, and
|
|
|
|
; also begins a loop, has the markers placed in the correct order.
|
|
|
|
|
|
|
|
; CHECK-LABEL: test15:
|
|
|
|
; CHECK: block
|
|
|
|
; CHECK-NEXT: block
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 0, $pop{{.*}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK: .LBB24_2:
|
2016-10-07 06:29:32 +08:00
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: block {{$}}
|
|
|
|
; CHECK-NEXT: loop {{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK: br_if 1, $pop{{.*}}{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK: br_if 0, ${{.*}}{{$}}
|
|
|
|
; CHECK-NEXT: br 2{{$}}
|
|
|
|
; CHECK-NEXT: .LBB24_4:
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: end_loop{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK: .LBB24_5:
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: end_block{{$}}
|
|
|
|
; CHECK: br_if 1, $pop{{.*}}{{$}}
|
|
|
|
; CHECK: return{{$}}
|
|
|
|
; CHECK: .LBB24_7:
|
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; CHECK: .LBB24_8:
|
|
|
|
; CHECK-NEXT: end_block{{$}}
|
2016-02-17 00:22:41 +08:00
|
|
|
; CHECK-NEXT: return{{$}}
|
2016-02-13 05:19:25 +08:00
|
|
|
; OPT-LABEL: test15:
|
|
|
|
; OPT: block
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT: block
|
2016-02-13 05:19:25 +08:00
|
|
|
; OPT-NEXT: i32.const $push
|
2016-05-17 02:59:34 +08:00
|
|
|
; OPT-NEXT: i32.eqz $push{{.*}}=, $pop{{.*}}{{$}}
|
2016-02-13 05:19:25 +08:00
|
|
|
; OPT-NEXT: br_if 0, $pop{{.*}}{{$}}
|
|
|
|
; OPT-NEXT: call test15_callee1@FUNCTION{{$}}
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT-NEXT: br 1{{$}}
|
2016-02-13 05:19:25 +08:00
|
|
|
; OPT-NEXT: .LBB24_2:
|
|
|
|
; OPT-NEXT: end_block
|
2016-02-18 14:32:53 +08:00
|
|
|
; OPT-NEXT: i32.const
|
|
|
|
; OPT-NEXT: .LBB24_3:
|
2016-02-13 05:19:25 +08:00
|
|
|
; OPT-NEXT: block
|
2016-10-07 06:10:23 +08:00
|
|
|
; OPT-NEXT: block
|
2016-02-13 05:19:25 +08:00
|
|
|
; OPT-NEXT: loop
|
|
|
|
%0 = type { i8, i32 }
|
|
|
|
declare void @test15_callee0()
|
|
|
|
declare void @test15_callee1()
|
|
|
|
define void @test15() {
|
|
|
|
bb:
|
|
|
|
%tmp1 = icmp eq i8 1, 0
|
|
|
|
br i1 %tmp1, label %bb2, label %bb14
|
|
|
|
|
|
|
|
bb2:
|
|
|
|
%tmp3 = phi %0** [ %tmp6, %bb5 ], [ null, %bb ]
|
|
|
|
%tmp4 = icmp eq i32 0, 11
|
|
|
|
br i1 %tmp4, label %bb5, label %bb8
|
|
|
|
|
|
|
|
bb5:
|
|
|
|
%tmp = bitcast i8* null to %0**
|
|
|
|
%tmp6 = getelementptr %0*, %0** %tmp3, i32 1
|
|
|
|
%tmp7 = icmp eq %0** %tmp6, null
|
|
|
|
br i1 %tmp7, label %bb10, label %bb2
|
|
|
|
|
|
|
|
bb8:
|
|
|
|
%tmp9 = icmp eq %0** null, undef
|
|
|
|
br label %bb10
|
|
|
|
|
|
|
|
bb10:
|
|
|
|
%tmp11 = phi %0** [ null, %bb8 ], [ %tmp, %bb5 ]
|
|
|
|
%tmp12 = icmp eq %0** null, %tmp11
|
|
|
|
br i1 %tmp12, label %bb15, label %bb13
|
|
|
|
|
|
|
|
bb13:
|
|
|
|
call void @test15_callee0()
|
|
|
|
ret void
|
|
|
|
|
|
|
|
bb14:
|
|
|
|
call void @test15_callee1()
|
|
|
|
ret void
|
|
|
|
|
|
|
|
bb15:
|
|
|
|
ret void
|
|
|
|
}
|