[polly] r245598 - Add option to control reduction detection

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 12:08:11 PDT 2015


Author: grosser
Date: Thu Aug 20 14:08:11 2015
New Revision: 245598

URL: http://llvm.org/viewvc/llvm-project?rev=245598&view=rev
Log:
Add option to control reduction detection

Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=245598&r1=245597&r2=245598&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Aug 20 14:08:11 2015
@@ -80,6 +80,11 @@ static cl::opt<std::string> UserContextS
     cl::desc("Provide additional constraints on the context parameters"),
     cl::init(""), cl::cat(PollyCategory));
 
+static cl::opt<bool> DetectReductions("polly-detect-reductions",
+                                      cl::desc("Detect and exploit reductions"),
+                                      cl::Hidden, cl::ZeroOrMore,
+                                      cl::init(true), cl::cat(PollyCategory));
+
 // Create a sequence of two schedules. Either argument may be null and is
 // interpreted as the empty schedule. Can also return null if both schedules are
 // empty.
@@ -894,7 +899,8 @@ ScopStmt::ScopStmt(Scop &parent, TempSco
     buildAccesses(tempScop, Block, Block != EntryBB);
     deriveAssumptions(Block);
   }
-  checkForReductions();
+  if (DetectReductions)
+    checkForReductions();
 }
 
 ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion,
@@ -910,7 +916,8 @@ ScopStmt::ScopStmt(Scop &parent, TempSco
   buildDomain(tempScop, CurRegion);
   buildAccesses(tempScop, BB);
   deriveAssumptions(BB);
-  checkForReductions();
+  if (DetectReductions)
+    checkForReductions();
 }
 
 /// @brief Collect loads which might form a reduction chain with @p StoreMA

Modified: polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll?rev=245598&r1=245597&r2=245598&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll Thu Aug 20 14:08:11 2015
@@ -1,4 +1,11 @@
 ; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops -analyze < %s | FileCheck %s
+
+
+; RUN: opt %loadPolly -polly-scops -polly-detect-reductions \
+; RUN:                -polly-allow-nonaffine-branches \
+; RUN:                -polly-allow-nonaffine-loops -analyze < %s \
+; RUN:                -polly-detect-reductions=false \
+; RUN: | FileCheck %s -check-prefix=NO-REDUCTION
 ;
 ;    void f(int *A, int *C) {
 ;      for (int i = 0; i < 1024; i++) {
@@ -24,6 +31,8 @@
 ; CHECK:                { Stmt_bb3__TO__bb10[i0] -> MemRef_A[i0] };
 ; CHECK:    }
 
+; NO-REDUCTION-NOT: Reduction Type: +
+
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
 define void @f(i32* %A, i32* %C) {




More information about the llvm-commits mailing list