summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-02-29 07:29:42 +0000
committerTobias Grosser <tobias@grosser.es>2016-02-29 07:29:42 +0000
commit0865e775bf6e9e2ceff264ccb7891bc91df933b7 (patch)
tree2a09ab2d0f2c2bfea510830667ef34b8d81120b1
parenta4835c5673cca9fe60b9e8d196083fed27aeb606 (diff)
downloadbcm5719-llvm-0865e775bf6e9e2ceff264ccb7891bc91df933b7.tar.gz
bcm5719-llvm-0865e775bf6e9e2ceff264ccb7891bc91df933b7.zip
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. llvm-svn: 262203
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index e1818e65703..e374b7b5381 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -2829,6 +2829,7 @@ void Scop::init(AliasAnalysis &AA, AssumptionCache &AC, ScopDetection &SD,
buildAliasChecks(AA);
hoistInvariantLoads(SD);
+ verifyInvariantLoads(SD);
simplifySCoP(false, DT, LI);
}
@@ -3104,30 +3105,29 @@ void Scop::verifyInvariantLoads(ScopDetection &SD) {
}
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 *
OpenPOWER on IntegriCloud