[polly] r224459 - Dead code elimination: Update dependences after eliminating code
Tobias Grosser
tobias at grosser.es
Wed Dec 17 13:13:56 PST 2014
Author: grosser
Date: Wed Dec 17 15:13:55 2014
New Revision: 224459
URL: http://llvm.org/viewvc/llvm-project?rev=224459&view=rev
Log:
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
Modified:
polly/trunk/include/polly/Dependences.h
polly/trunk/lib/Analysis/Dependences.cpp
polly/trunk/lib/Transform/DeadCodeElimination.cpp
Modified: polly/trunk/include/polly/Dependences.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Dependences.h?rev=224459&r1=224458&r2=224459&view=diff
==============================================================================
--- polly/trunk/include/polly/Dependences.h (original)
+++ polly/trunk/include/polly/Dependences.h Wed Dec 17 15:13:55 2014
@@ -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;
Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=224459&r1=224458&r2=224459&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Wed Dec 17 15:13:55 2014
@@ -432,10 +432,14 @@ void Dependences::calculateDependences(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;
}
Modified: polly/trunk/lib/Transform/DeadCodeElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeadCodeElimination.cpp?rev=224459&r1=224458&r2=224459&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeadCodeElimination.cpp (original)
+++ polly/trunk/lib/Transform/DeadCodeElimination.cpp Wed Dec 17 15:13:55 2014
@@ -151,7 +151,13 @@ bool DeadCodeElim::eliminateDeadCode(Sco
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) {
More information about the llvm-commits
mailing list