blob: 56777090ad515924a38238a461c4e256bca4a8db [file] [log] [blame]
Heejin Ahn777d01c2019-01-03 23:10:11 +00001; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-block-placement -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
2
3target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
4target triple = "wasm32-unknown-unknown"
5
6
7; Test an interesting pattern of nested irreducibility.
8; Just check we resolve all the irreducibility here (if not we'd crash).
9
10; CHECK-LABEL: tre_parse:
11
12define void @tre_parse() {
13entry:
14 br label %for.cond.outer
15
16for.cond.outer: ; preds = %do.body14, %entry
17 br label %for.cond
18
19for.cond: ; preds = %for.cond.backedge, %for.cond.outer
20 %nbranch.0 = phi i32* [ null, %for.cond.outer ], [ %call188, %for.cond.backedge ]
21 switch i8 undef, label %if.else [
22 i8 40, label %do.body14
23 i8 41, label %if.then63
24 ]
25
26do.body14: ; preds = %for.cond
27 br label %for.cond.outer
28
29if.then63: ; preds = %for.cond
30 unreachable
31
32if.else: ; preds = %for.cond
33 switch i8 undef, label %if.then84 [
34 i8 92, label %if.end101
35 i8 42, label %if.end101
36 ]
37
38if.then84: ; preds = %if.else
39 switch i8 undef, label %cleanup.thread [
40 i8 43, label %if.end101
41 i8 63, label %if.end101
42 i8 123, label %if.end101
43 ]
44
45if.end101: ; preds = %if.then84, %if.then84, %if.then84, %if.else, %if.else
46 unreachable
47
48cleanup.thread: ; preds = %if.then84
49 %call188 = tail call i32* undef(i32* %nbranch.0)
50 switch i8 undef, label %for.cond.backedge [
51 i8 92, label %land.lhs.true208
52 i8 0, label %if.else252
53 ]
54
55land.lhs.true208: ; preds = %cleanup.thread
56 unreachable
57
58for.cond.backedge: ; preds = %cleanup.thread
59 br label %for.cond
60
61if.else252: ; preds = %cleanup.thread
62 unreachable
63}