[polly] r235373 - Move to isl's new dependence analysis interface [NFC]

Tobias Grosser tobias at grosser.es
Tue Apr 21 01:47:29 PDT 2015


Author: grosser
Date: Tue Apr 21 03:47:29 2015
New Revision: 235373

URL: http://llvm.org/viewvc/llvm-project?rev=235373&view=rev
Log:
Move to isl's new dependence analysis interface [NFC]

isl_union_map_compute_flow() has been replaced by
isl_union_access_info_compute_flow(). This change does not intend to
change funcitonality, yet. However, it will allow us to pass in subsequent
changes schedule trees to the dependence analysis instead of flat schedules.
This should speed up dependence analysis for important cases significantly.

Modified:
    polly/trunk/lib/Analysis/DependenceInfo.cpp

Modified: polly/trunk/lib/Analysis/DependenceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/DependenceInfo.cpp?rev=235373&r1=235372&r2=235373&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/DependenceInfo.cpp (original)
+++ polly/trunk/lib/Analysis/DependenceInfo.cpp Tue Apr 21 03:47:29 2015
@@ -241,41 +241,71 @@ void Dependences::calculateDependences(S
         dbgs() << "MayWrite: " << MayWrite << "\n";
         dbgs() << "Schedule: " << Schedule << "\n");
 
-  // The pointers below will be set by the subsequent calls to
-  // isl_union_map_compute_flow.
   RAW = WAW = WAR = RED = nullptr;
 
   if (OptAnalysisType == VALUE_BASED_ANALYSIS) {
-    isl_union_map_compute_flow(
-        isl_union_map_copy(Read), isl_union_map_copy(Write),
-        isl_union_map_copy(MayWrite), isl_union_map_copy(Schedule), &RAW,
-        nullptr, nullptr, nullptr);
-
-    isl_union_map_compute_flow(
-        isl_union_map_copy(Write), isl_union_map_copy(Write),
-        isl_union_map_copy(Read), isl_union_map_copy(Schedule), &WAW, &WAR,
-        nullptr, nullptr);
+    isl_union_access_info *AI;
+    isl_union_flow *Flow;
+
+    AI = isl_union_access_info_from_sink(isl_union_map_copy(Read));
+    AI = isl_union_access_info_set_must_source(AI, isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_may_source(AI, isl_union_map_copy(MayWrite));
+    AI = isl_union_access_info_set_schedule_map(AI,
+                                                isl_union_map_copy(Schedule));
+    Flow = isl_union_access_info_compute_flow(AI);
+
+    RAW = isl_union_flow_get_must_dependence(Flow);
+    isl_union_flow_free(Flow);
+
+    AI = isl_union_access_info_from_sink(isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_must_source(AI, isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_may_source(AI, isl_union_map_copy(Read));
+    AI = isl_union_access_info_set_schedule_map(AI,
+                                                isl_union_map_copy(Schedule));
+    Flow = isl_union_access_info_compute_flow(AI);
+
+    WAW = isl_union_flow_get_must_dependence(Flow);
+    WAR = isl_union_flow_get_may_dependence(Flow);
+
+    // This subtraction is needed to obtain the same results as were given by
+    // isl_union_map_compute_flow. For large sets this may add some compile-time
+    // cost. As there does not seem to be a need to distinguish between WAW and
+    // WAR, refactoring Polly to only track general non-flow dependences may
+    // improve performance.
+    WAR = isl_union_map_subtract(WAR, isl_union_map_copy(WAW));
+    isl_union_flow_free(Flow);
   } else {
-    isl_union_map *Empty;
+    isl_union_access_info *AI;
+    isl_union_flow *Flow;
 
-    Empty = isl_union_map_empty(isl_union_map_get_space(Write));
     Write = isl_union_map_union(Write, isl_union_map_copy(MayWrite));
 
-    isl_union_map_compute_flow(
-        isl_union_map_copy(Read), isl_union_map_copy(Empty),
-        isl_union_map_copy(Write), isl_union_map_copy(Schedule), nullptr, &RAW,
-        nullptr, nullptr);
-
-    isl_union_map_compute_flow(
-        isl_union_map_copy(Write), isl_union_map_copy(Empty),
-        isl_union_map_copy(Read), isl_union_map_copy(Schedule), nullptr, &WAR,
-        nullptr, nullptr);
-
-    isl_union_map_compute_flow(
-        isl_union_map_copy(Write), isl_union_map_copy(Empty),
-        isl_union_map_copy(Write), isl_union_map_copy(Schedule), nullptr, &WAW,
-        nullptr, nullptr);
-    isl_union_map_free(Empty);
+    AI = isl_union_access_info_from_sink(isl_union_map_copy(Read));
+    AI = isl_union_access_info_set_may_source(AI, isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_schedule_map(AI,
+                                                isl_union_map_copy(Schedule));
+    Flow = isl_union_access_info_compute_flow(AI);
+
+    RAW = isl_union_flow_get_may_dependence(Flow);
+    isl_union_flow_free(Flow);
+
+    AI = isl_union_access_info_from_sink(isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_may_source(AI, isl_union_map_copy(Read));
+    AI = isl_union_access_info_set_schedule_map(AI,
+                                                isl_union_map_copy(Schedule));
+    Flow = isl_union_access_info_compute_flow(AI);
+
+    WAR = isl_union_flow_get_may_dependence(Flow);
+    isl_union_flow_free(Flow);
+
+    AI = isl_union_access_info_from_sink(isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_may_source(AI, isl_union_map_copy(Write));
+    AI = isl_union_access_info_set_schedule_map(AI,
+                                                isl_union_map_copy(Schedule));
+    Flow = isl_union_access_info_compute_flow(AI);
+
+    WAW = isl_union_flow_get_may_dependence(Flow);
+    isl_union_flow_free(Flow);
   }
 
   isl_union_map_free(MayWrite);





More information about the llvm-commits mailing list