arporter / habakkuk

Fortran code analysis for performance prediction
11 stars 0 forks source link

Sub-expressions within array-index expressions not handled correctly #40

Closed arporter closed 7 years ago

arporter commented 7 years ago

Somewhere along the line Habakkuk's ability to handle indirect array accesses (e.g. my_array(map(i) + 1) has been broken. Similarly, we now fail to handle e.g. my_array(2*i). We will fix these problems in this issue.

arporter commented 7 years ago

Created ind_array_access branch for this work.

arporter commented 7 years ago

My original code in differ_by_constant() was somewhat fragile and only worked for expressions like ji+1. In order to improve things I've had to make the code considerably heavier-weight. If a few simple checks cannot determine whether two expressions differ only by a constant then we engage the new prune_constants() routine which takes a tree and removes any +/- constant branches from it. Having done the pruning we then check to see whether the remaining trees are the same. I'm pretty sure this still won't solve the problem of trees having a different structure if the same expression is coded differently, e.g.:

my_array((ji + jj) + 2) = 1.0
my_array((ji + 2) + jj) = 1.0
arporter commented 7 years ago

PR #42 has been merged to master. Closing issue.