]> git.ipfire.org Git - thirdparty/gcc.git/commit
graphite: Add runtime alias checking
authorFrederik Harwath <frederik@codesourcery.com>
Tue, 16 Nov 2021 15:15:08 +0000 (16:15 +0100)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 21 Jun 2022 13:11:47 +0000 (14:11 +0100)
commitf7643da2684126397a3161abfc9b292146bb8ad5
treec36aae2a55b03210972748a62ee99efdd06a7b89
parent5a7dd46fcf1d7611bd0ef284419c69567a2c0b27
graphite: Add runtime alias checking

Graphite rejects a SCoP if it contains a pair of data references for
which it cannot determine statically if they may alias. This happens
very often, for instance in C code which does not use explicit
"restrict".  This commit adds the possibility to analyze a SCoP
nevertheless and perform an alias check at runtime.  Then, if aliasing
is detected, the execution will fall back to the unoptimized SCoP.

TODO This needs more testing on non-OpenACC code.

gcc/ChangeLog:

        * common.opt: Add fgraphite-runtime-alias-checks.
        * graphite-isl-ast-to-gimple.cc
        (generate_alias_cond): New function.
        (graphite_regenerate_ast_isl): Use from here.
        * graphite-poly.cc (new_scop): Create unhandled_alias_ddrs vec ...
(free_scop): and release here.
        * graphite-scop-detection.cc (dr_defs_outside_region): New function.
        (dr_well_analyzed_for_runtime_alias_check_p): New function.
        (graphite_runtime_alias_check_p): New function.
        (build_alias_set): Record unhandled alias ddrs for later alias check
        creation if flag_graphite_runtime_alias_checks is true instead
        of failing.
        * graphite.h (struct scop): Add field unhandled_alias_ddrs.
        * sese.h (has_operands_from_region_p): New function.

gcc/testsuite/ChangeLog:

        * gcc.dg/graphite/alias-1.c: New test.
gcc/ChangeLog.omp
gcc/common.opt
gcc/graphite-isl-ast-to-gimple.cc
gcc/graphite-poly.cc
gcc/graphite-scop-detection.cc
gcc/graphite.h
gcc/sese.h
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gcc.dg/graphite/alias-1.c [new file with mode: 0644]