[polly] r262203 - ScopInfo: Remove indentation in hoistInvariantLoads
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 28 23:29:43 PST 2016
Author: grosser
Date: Mon Feb 29 01:29:42 2016
New Revision: 262203
URL: http://llvm.org/viewvc/llvm-project?rev=262203&view=rev
Log:
ScopInfo: Remove indentation in hoistInvariantLoads
We move verifyInvariantLoads out of this function to allow for an early return
without the need for code duplication. A similar transformation was suggested
by Johannes Doerfert in post commit review of r262033.
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=262203&r1=262202&r2=262203&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Feb 29 01:29:42 2016
@@ -2829,6 +2829,7 @@ void Scop::init(AliasAnalysis &AA, Assum
buildAliasChecks(AA);
hoistInvariantLoads(SD);
+ verifyInvariantLoads(SD);
simplifySCoP(false, DT, LI);
}
@@ -3104,30 +3105,29 @@ void Scop::verifyInvariantLoads(ScopDete
}
void Scop::hoistInvariantLoads(ScopDetection &SD) {
- if (PollyInvariantLoadHoisting) {
- isl_union_map *Writes = getWrites();
- for (ScopStmt &Stmt : *this) {
- MemoryAccessList InvariantAccesses;
-
- for (MemoryAccess *Access : Stmt)
- if (isHoistableAccess(Access, Writes))
- InvariantAccesses.push_front(Access);
-
- // We inserted invariant accesses always in the front but need them to be
- // sorted in a "natural order". The statements are already sorted in
- // reverse post order and that suffices for the accesses too. The reason
- // we require an order in the first place is the dependences between
- // invariant loads that can be caused by indirect loads.
- InvariantAccesses.reverse();
-
- // Transfer the memory access from the statement to the SCoP.
- Stmt.removeMemoryAccesses(InvariantAccesses);
- addInvariantLoads(Stmt, InvariantAccesses);
- }
- isl_union_map_free(Writes);
- }
+ if (!PollyInvariantLoadHoisting)
+ return;
- verifyInvariantLoads(SD);
+ isl_union_map *Writes = getWrites();
+ for (ScopStmt &Stmt : *this) {
+ MemoryAccessList InvariantAccesses;
+
+ for (MemoryAccess *Access : Stmt)
+ if (isHoistableAccess(Access, Writes))
+ InvariantAccesses.push_front(Access);
+
+ // We inserted invariant accesses always in the front but need them to be
+ // sorted in a "natural order". The statements are already sorted in
+ // reverse post order and that suffices for the accesses too. The reason
+ // we require an order in the first place is the dependences between
+ // invariant loads that can be caused by indirect loads.
+ InvariantAccesses.reverse();
+
+ // Transfer the memory access from the statement to the SCoP.
+ Stmt.removeMemoryAccesses(InvariantAccesses);
+ addInvariantLoads(Stmt, InvariantAccesses);
+ }
+ isl_union_map_free(Writes);
}
const ScopArrayInfo *
More information about the llvm-commits
mailing list