--------------------------- B-3 Value Range Propagation --------------------------- 1 #include | 2 int main () |main () 3 { |{ 4 int a, b; | int b; 5 for (a=4 ; a<100; a++) { | int a; 6 if (a < 4) | 7 b = b + 2; |: 8 else | goto ; 9 b = b * 2; | 10 } |: 11 printf ("%d%d", a, b); |Invalid sum of incoming frequencies 9897, should be 4948 12 } | # a_6 = PHI 13 | # b_13 = PHI 14 | b_7 = b_13 * 2; 15 | 16 |: 17 |Invalid sum of incoming frequencies 4948, should be 9897 18 | # b_2 = PHI 19 | a_8 = a_6 + 1; 20 | 21 |: 22 | # a_1 = PHI 23 | # b_3 = PHI 24 | if (a_1 != 100) 25 | goto ; 26 | else 27 | goto ; 28 | 29 |: 30 | # b_12 = PHI 31 | a_11 = 100; 32 | printf ("%d%d", 100, b_12); 33 | return; 34 | 35 |: 36 | # a_16 = PHI <4(2)> 37 | # b_14 = PHI 38 | goto ; 39 | 40 |} Solution -------- 1 Variable `a' can take the values 4 to 99. Since, the `if' condition will never be true for the give loop bounds, [b = b + 2] is never executed. Therefore, the optimized code has eliminated this program statement.