Page MenuHomePhabricator

[PATCH 17/27] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation.
Needs ReviewPublic

Authored by jeroen.dobbelaere on Oct 4 2019, 3:08 PM.

Details

Reviewers
hfinkel
jdoerfert
Summary

This is part of the series started by D68484.

When a restrict variable is declared in the loop body, and the loop is
rotated, care must be taken to clone the llvm.noalias.decl and the noalias
scopes to ensure that the local restrict scope does not spill over the
iterations.

Note: this is a stable point and tests should run fine with the patches applied up to this point.

Diff Detail

Unit TestsFailed

TimeTest
8,840 msx64 debian > libarcher.races::lock-unrelated.c
Script: -- : 'RUN: at line 13'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang -fopenmp -pthread -fno-experimental-isel -g -O1 -fsanitize=thread -I /var/lib/buildkite-agent/builds/llvm-project/openmp/tools/archer/tests -I /var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/src -L /var/lib/buildkite-agent/builds/llvm-project/build/lib -Wl,-rpath,/var/lib/buildkite-agent/builds/llvm-project/build/lib /var/lib/buildkite-agent/builds/llvm-project/openmp/tools/archer/tests/races/lock-unrelated.c -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp -latomic && env TSAN_OPTIONS='ignore_noninstrumented_modules=0:ignore_noninstrumented_modules=1' /var/lib/buildkite-agent/builds/llvm-project/openmp/tools/archer/tests/deflake.bash /var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp 2>&1 | tee /var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/tools/archer/tests/races/Output/lock-unrelated.c.tmp.log | /var/lib/buildkite-agent/builds/llvm-project/build/./bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/openmp/tools/archer/tests/races/lock-unrelated.c

Event Timeline

jeroen.dobbelaere retitled this revision from [PATCH 28/38] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation. to [PATCH 17/26] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation..
jeroen.dobbelaere retitled this revision from [PATCH 17/26] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation. to [PATCH 17/27] [noalias] Clone scopes and llvm.noalias.decl as needed during loop rotation..

Rebased to 9fb46a452d4e5666828c95610ceac8dcd9e4ce16 (September 7, 2020)

barannikov88 added inline comments.
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
415
568

Compared to the (2) above, the U element has disappeared. Is it intended?

llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
568

Yes. in (2), U'' is already referring to a different iteration. It must be cloned, to make sure that it is treated different from load/stores that were hoisted outside the loop body (by a different pass). Those will still have the original 'D' dependency and 'U' related scope.

Of course, there is the situation that you have :

(1+2) ... { D U U } 
-> ... D' U' { U D U }
-> ... D' U' { D U D'' U '' }