simple_dead_code.adl
1 /* 2 namespace = "Compile" 3 expectation = "Pass" 4 */ 5 6 program test.alpha { 7 transition main(public x: field, y: field, a: u8, b: u8) -> field { 8 // This line is dead and should be eliminated by DCE. 9 let z: field = BHP256::hash_to_field(x); 10 11 // This line should not be eliminated, as it may halt. 12 let w: u8 = a + b; 13 14 // This line should be eliminated, as it will not halt. 15 let u: u8 = a.sub_wrapped(b); 16 17 // Guards on conditionals will generate an extra `not` 18 // expression that should be eliminated by DCE. 19 if y == 0field { 20 return x; 21 } else { 22 return x / y; 23 } 24 } 25 }