Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
38) PR #3311 for #3310. Small optimisation to the dependence-analysis
functionality for array indices consisting of simple References.

37) PR #3295 for #3292. Add command-line flag to permit config-file
settings to be overridden and extend possible settings for the
runtime warnings option.
Expand Down
18 changes: 16 additions & 2 deletions src/psyclone/psyir/tools/dependency_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from psyclone.errors import InternalError, LazyString
from psyclone.psyir.backend.sympy_writer import SymPyWriter
from psyclone.psyir.backend.visitor import VisitorError
from psyclone.psyir.nodes import Loop, Node, Range
from psyclone.psyir.nodes import Loop, Node, Range, Reference


# pylint: disable=too-many-lines
Expand Down Expand Up @@ -657,7 +657,21 @@ def _is_loop_carried_dependency(self, loop_variables, write_access,
return True
elif len(set_of_vars) == 1:
# One loop variable used in both accesses.
# E.g. `a(2*i+3) = a(i*i)`
# E.g. `a(2*i+3) = a(i*i)`. Add a shortcut for
# a very common case - the index is a simple reference
if (isinstance(index_write, Reference) and
isinstance(index_other, Reference) and
index_write == index_other):
if index_write.name == loop_var:
# a(j, ...) and a(j, ...) - these accesses
# will never overlap for different j, independent
# of the expressions in the other dimensions
return True
# The expression does not depend on the loop variable
# at all (dependency distance would return None),
# again no need for an explicit test, we can continue
# the outer loop
continue
distance = self._get_dependency_distance(loop_var,
index_write,
index_other)
Expand Down
Loading