mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-14 22:38:46 +00:00
Add deadcode examples
This commit is contained in:
39
examples/deadcode/deadcode.input.ir
Normal file
39
examples/deadcode/deadcode.input.ir
Normal file
@@ -0,0 +1,39 @@
|
||||
fun unit @sink {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
|
||||
block b0:
|
||||
%b0:p0:unit
|
||||
ret unit:unit
|
||||
}
|
||||
|
||||
fun i32 @deadcode {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
%l0:i32:x
|
||||
%l1:i32:y
|
||||
|
||||
block b0:
|
||||
%b0:i0:i32 = add 100:i32 200:i32
|
||||
%b0:i1:i32 = add %b0:i0:i32 300:i32
|
||||
%b0:i2:i32 = add %b0:i1:i32 400:i32
|
||||
%b0:i3:unit = store %l1:i32 %b0:i0:i32
|
||||
|
||||
br undef:i1 b1() b2()
|
||||
|
||||
block b1:
|
||||
%b1:i0:unit = nop
|
||||
%b1:i1:unit = call @sink(%b1:i0:unit)
|
||||
|
||||
j b3()
|
||||
|
||||
block b2:
|
||||
%b2:i0:unit = store %l1:i32 42:i32
|
||||
|
||||
j b3()
|
||||
|
||||
block b3:
|
||||
ret 0:i32
|
||||
}
|
||||
Reference in New Issue
Block a user