retagged by
2,814 views

1 Answer

Best answer
7 votes
7 votes
Initially the code without any Optimization is :

a = b * c

d = b

e = d * c

b = e

f = b + c

g = f + d

DAG for this can be drawn like :

This DAG consists of $6$ Nodes and $8$ Edges.



If some Optimization is done on the code, then I can write the final code as :

a = b * c

e = b * c

f = e + c

g = f + b

(Either 1st or 2nd instruction can be removed. If anyone of them is not removed, then it won't affect)

DAG for this can be drawn like :

This DAG consists of $5$ Nodes and $6$ Edges.

selected by

Related questions

2 votes
2 votes
1 answer
1
0 votes
0 votes
1 answer
2
phprashanthans asked Dec 3, 2017
848 views
What will be the DAG representation of a=b+c , b= b+c
6 votes
6 votes
1 answer
3
set2018 asked Sep 28, 2017
3,047 views
A) 2B)3C) 4D) 5
0 votes
0 votes
1 answer
4
thor asked Jan 22, 2017
638 views
How does answer change when it is in SSA form? does answer remains 4 or 5