diff options
| author | Tobias Grosser <tobias@grosser.es> | 2014-12-17 21:13:55 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2014-12-17 21:13:55 +0000 |
| commit | 11e3873516fa5dbb63bbe7c2d2614ec2bf5bc851 (patch) | |
| tree | 352833d192cc56bd34b5138c497bab8a17b3d25b | |
| parent | 303011a0059039a9635db856e0b4bb5d4df12347 (diff) | |
| download | bcm5719-llvm-11e3873516fa5dbb63bbe7c2d2614ec2bf5bc851.tar.gz bcm5719-llvm-11e3873516fa5dbb63bbe7c2d2614ec2bf5bc851.zip | |
Dead code elimination: Update dependences after eliminating code
Without updating dependences we may lose implicit transitive dependences for
which all explicit dependences have gone through the statement iterations we
have just eliminated.
No test case. We should probably implement a -verify-dependences option.
This fixes llvm.org/PR21227
llvm-svn: 224459
| -rw-r--r-- | polly/include/polly/Dependences.h | 5 | ||||
| -rw-r--r-- | polly/lib/Analysis/Dependences.cpp | 8 | ||||
| -rw-r--r-- | polly/lib/Transform/DeadCodeElimination.cpp | 8 |
3 files changed, 18 insertions, 3 deletions
diff --git a/polly/include/polly/Dependences.h b/polly/include/polly/Dependences.h index d0fb96d335e..df03d2ca4a2 100644 --- a/polly/include/polly/Dependences.h +++ b/polly/include/polly/Dependences.h @@ -121,12 +121,17 @@ public: return ReductionDependences; } + /// @brief Recompute dependences from schedule and memory accesses. + void recomputeDependences(); + bool runOnScop(Scop &S); void printScop(raw_ostream &OS) const; virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; private: + Scop *S; + /// @brief The different kinds of dependences we calculate. isl_union_map *RAW; isl_union_map *WAR; diff --git a/polly/lib/Analysis/Dependences.cpp b/polly/lib/Analysis/Dependences.cpp index c9cc7780bb5..d4d092ad30b 100644 --- a/polly/lib/Analysis/Dependences.cpp +++ b/polly/lib/Analysis/Dependences.cpp @@ -432,10 +432,14 @@ void Dependences::calculateDependences(Scop &S) { DEBUG(printScop(dbgs())); } -bool Dependences::runOnScop(Scop &S) { +void Dependences::recomputeDependences() { releaseMemory(); - calculateDependences(S); + calculateDependences(*S); +} +bool Dependences::runOnScop(Scop &ScopVar) { + S = &ScopVar; + recomputeDependences(); return false; } diff --git a/polly/lib/Transform/DeadCodeElimination.cpp b/polly/lib/Transform/DeadCodeElimination.cpp index c5cd57913da..497999faee8 100644 --- a/polly/lib/Transform/DeadCodeElimination.cpp +++ b/polly/lib/Transform/DeadCodeElimination.cpp @@ -151,7 +151,13 @@ bool DeadCodeElim::eliminateDeadCode(Scop &S, int PreciseSteps) { isl_union_map_free(Dep); isl_union_set_free(OriginalDomain); - return S.restrictDomains(isl_union_set_coalesce(Live)); + bool Changed = S.restrictDomains(isl_union_set_coalesce(Live)); + + // FIXME: We can probably avoid the recomputation of all dependences by + // updating them explicitly. + if (Changed) + D->recomputeDependences(); + return Changed; } bool DeadCodeElim::runOnScop(Scop &S) { |

