From d83b8a83eccac2c7e931959238f6dd9fd7e98f36 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 20 Aug 2015 19:08:11 +0000 Subject: [PATCH] Add option to control reduction detection llvm-svn: 245598 --- polly/lib/Analysis/ScopInfo.cpp | 11 +++++++++-- .../ScopInfo/NonAffine/non_affine_loop_condition.ll | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 2f6e59c351de..d5e43970faf5 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -80,6 +80,11 @@ static cl::opt UserContextStr( cl::desc("Provide additional constraints on the context parameters"), cl::init(""), cl::cat(PollyCategory)); +static cl::opt 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, TempScop &tempScop, const Region &CurRegion, 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, TempScop &tempScop, const Region &CurRegion, buildDomain(tempScop, CurRegion); buildAccesses(tempScop, BB); deriveAssumptions(BB); - checkForReductions(); + if (DetectReductions) + checkForReductions(); } /// @brief Collect loads which might form a reduction chain with @p StoreMA diff --git a/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll b/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll index 66c41ef5d9da..bf17db95248a 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll @@ -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) {