//KT-1027 Strange selection of unreachable code

This commit is contained in:
svtk
2012-01-17 15:43:11 +04:00
parent 3a634417b9
commit e6a2b2fc0f
7 changed files with 598 additions and 342 deletions
File diff suppressed because it is too large Load Diff
+19 -16
View File
@@ -6,29 +6,32 @@ fun t1() {
}
---------------------
l0:
<START> NEXT:[r(1)] PREV:[]
r(1) NEXT:[r(2)] PREV:[<START>]
r(2) NEXT:[r(..)] PREV:[r(1)]
r(..) NEXT:[r(1..2)] PREV:[r(2)]
r(1..2) NEXT:[v(i)] PREV:[r(..)]
v(i) NEXT:[w(i)] PREV:[r(1..2)]
w(i) NEXT:[jmp?(l2)] PREV:[v(i)]
<START> NEXT:[r(for (i in 1..2) { doSmth(i..)] PREV:[]
r(for (i in 1..2) {
doSmth(i)
}) NEXT:[r(1)] PREV:[<START>]
r(1) NEXT:[r(2)] PREV:[r(for (i in 1..2) { doSmth(i..)]
r(2) NEXT:[r(..)] PREV:[r(1)]
r(..) NEXT:[r(1..2)] PREV:[r(2)]
r(1..2) NEXT:[v(i)] PREV:[r(..)]
v(i) NEXT:[w(i)] PREV:[r(1..2)]
w(i) NEXT:[jmp?(l2)] PREV:[v(i)]
l3:
jmp?(l2) NEXT:[read (Unit), r(i)] PREV:[w(i)]
jmp?(l2) NEXT:[read (Unit), r(i)] PREV:[w(i)]
l4:
l5:
r(i) NEXT:[r(doSmth)] PREV:[jmp?(l2), jmp?(l4)]
r(doSmth) NEXT:[r(doSmth(i))] PREV:[r(i)]
r(doSmth(i)) NEXT:[jmp?(l4)] PREV:[r(doSmth)]
jmp?(l4) NEXT:[r(i), read (Unit)] PREV:[r(doSmth(i))]
r(i) NEXT:[r(doSmth)] PREV:[jmp?(l2), jmp?(l4)]
r(doSmth) NEXT:[r(doSmth(i))] PREV:[r(i)]
r(doSmth(i)) NEXT:[jmp?(l4)] PREV:[r(doSmth)]
jmp?(l4) NEXT:[r(i), read (Unit)] PREV:[r(doSmth(i))]
l2:
read (Unit) NEXT:[<END>] PREV:[jmp?(l2), jmp?(l4)]
read (Unit) NEXT:[<END>] PREV:[jmp?(l2), jmp?(l4)]
l1:
<END> NEXT:[<SINK>] PREV:[read (Unit)]
<END> NEXT:[<SINK>] PREV:[read (Unit)]
error:
<ERROR> NEXT:[] PREV:[]
<ERROR> NEXT:[] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<END>]
<SINK> NEXT:[] PREV:[<END>]
=====================
== doSmth ==
fun doSmth(i: Int) {}
@@ -6,25 +6,28 @@ fun main() {
}
---------------------
l0:
<START> NEXT:[r(1)] PREV:[]
<START> NEXT:[r(while(1 > 0) { 2 }) ] PREV:[]
r(while(1 > 0) {
2
}) NEXT:[r(1)] PREV:[<START>]
l2:
l5:
r(1) NEXT:[r(0)] PREV:[<START>, jmp(l2)]
r(0) NEXT:[r(>)] PREV:[r(1)]
r(>) NEXT:[r(1 > 0)] PREV:[r(0)]
r(1 > 0) NEXT:[jf(l3)] PREV:[r(>)]
jf(l3) NEXT:[read (Unit), r(2)] PREV:[r(1 > 0)]
r(1) NEXT:[r(0)] PREV:[r(while(1 > 0) { 2 }) , jmp(l2)]
r(0) NEXT:[r(>)] PREV:[r(1)]
r(>) NEXT:[r(1 > 0)] PREV:[r(0)]
r(1 > 0) NEXT:[jf(l3)] PREV:[r(>)]
jf(l3) NEXT:[read (Unit), r(2)] PREV:[r(1 > 0)]
l4:
r(2) NEXT:[jmp(l2)] PREV:[jf(l3)]
jmp(l2) NEXT:[r(1)] PREV:[r(2)]
r(2) NEXT:[jmp(l2)] PREV:[jf(l3)]
jmp(l2) NEXT:[r(1)] PREV:[r(2)]
l3:
read (Unit) NEXT:[<END>] PREV:[jf(l3)]
read (Unit) NEXT:[<END>] PREV:[jf(l3)]
l1:
<END> NEXT:[<SINK>] PREV:[read (Unit)]
<END> NEXT:[<SINK>] PREV:[read (Unit)]
error:
<ERROR> NEXT:[] PREV:[]
<ERROR> NEXT:[] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<END>]
<SINK> NEXT:[] PREV:[<END>]
=====================
== dowhile ==
fun dowhile() {
@@ -33,22 +36,24 @@ fun dowhile() {
}
---------------------
l0:
<START> NEXT:[ret l1] PREV:[]
<START> NEXT:[r(do {return} while(1 > 0)) ] PREV:[]
r(do {return}
while(1 > 0)) NEXT:[ret l1] PREV:[<START>]
l2:
l4:
ret l1 NEXT:[<END>] PREV:[<START>]
ret l1 NEXT:[<END>] PREV:[r(do {return} while(1 > 0)) ]
l5:
- r(1) NEXT:[r(0)] PREV:[]
- r(0) NEXT:[r(>)] PREV:[]
- r(>) NEXT:[r(1 > 0)] PREV:[]
- r(1 > 0) NEXT:[jt(l2)] PREV:[]
- jt(l2) NEXT:[read (Unit), ret l1] PREV:[]
- r(1) NEXT:[r(0)] PREV:[]
- r(0) NEXT:[r(>)] PREV:[]
- r(>) NEXT:[r(1 > 0)] PREV:[]
- r(1 > 0) NEXT:[jt(l2)] PREV:[]
- jt(l2) NEXT:[read (Unit), ret l1] PREV:[]
l3:
- read (Unit) NEXT:[<END>] PREV:[]
- read (Unit) NEXT:[<END>] PREV:[]
l1:
<END> NEXT:[<SINK>] PREV:[ret l1]
<END> NEXT:[<SINK>] PREV:[ret l1]
error:
<ERROR> NEXT:[] PREV:[]
<ERROR> NEXT:[] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<END>]
<SINK> NEXT:[] PREV:[<END>]
=====================
@@ -4,17 +4,18 @@ fun blockAndAndMismatch() : Boolean {
}
---------------------
l0:
<START> NEXT:[r(false)] PREV:[]
r(false) NEXT:[jt(l2)] PREV:[<START>]
jt(l2) NEXT:[r(false), r(false || (return false))] PREV:[r(false)]
r(false) NEXT:[ret(*) l1] PREV:[jt(l2)]
ret(*) l1 NEXT:[<END>] PREV:[r(false)]
<START> NEXT:[r(false)] PREV:[]
r(false) NEXT:[jt(l2)] PREV:[<START>]
jt(l2) NEXT:[r((return false)), r(false || (return false))] PREV:[r(false)]
r((return false)) NEXT:[r(false)] PREV:[jt(l2)]
r(false) NEXT:[ret(*) l1] PREV:[r((return false))]
ret(*) l1 NEXT:[<END>] PREV:[r(false)]
l2:
r(false || (return false)) NEXT:[<END>] PREV:[jt(l2)]
r(false || (return false)) NEXT:[<END>] PREV:[jt(l2)]
l1:
<END> NEXT:[<SINK>] PREV:[ret(*) l1, r(false || (return false))]
<END> NEXT:[<SINK>] PREV:[ret(*) l1, r(false || (return false))]
error:
<ERROR> NEXT:[] PREV:[]
<ERROR> NEXT:[] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<END>]
<SINK> NEXT:[] PREV:[<END>]
=====================