Module 16: Data Flow Analysis in Presence of Procedure Calls
Lecture 31: Data Dependence Analysis
Example:
do I = 1, 100
X( 2I+1 ) = ....
...... = X( 2I+4 )
enddo
S
1
S
2
Is there a dependence from S
1
to S
2
?
Coarse grain analysis:
S
1
writes into X and S
2
reads from X. Therefore,
S
1
→ S
2
or S
1
S
2
Fine grain analysis:
Eqn: 2i
1
+ 1 = 2i
2
+ 4
has no integer solution
Therefore, no dependence from S
1
to S
2
DO I = 1, 50
X(I) = ....
.... = X(I+50)
ENDDO
Fine grain analysis:
Eqn. i
1
= i
2
+ 50 has integer solution.
However, no integer solution in the range
1 ≤ i
1
≤ i
2
≤ 50
therefore, no dependence from S
1
to S
2
If
are general functions, then the problem is intractable.
If
are linear functions of loop index, then to test dependence we need to find values of two integers
such that
which can be rewritten as
These are called Linear
Diophantine Equations.