From 085d4209d0be41eea193f76f042b68b08e75855f Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Thu, 6 Jun 2013 02:48:53 +0000 Subject: scop detection: only handle functions with loops to detect scops in functions with no loops, use -polly-detect-scops-in-functions-without-loops Merged from: https://llvm.org/svn/llvm-project/polly/trunk@182941 llvm-svn: 183382 --- polly/lib/Analysis/ScopDetection.cpp | 10 +++++++++- polly/test/Cloog/CodeGen/constant_condition.ll | 2 +- polly/test/Isl/CodeGen/constant_condition.ll | 2 +- polly/test/ScheduleOptimizer/2012-10-14-Zero-Bands.ll | 2 +- polly/test/ScopDetect/parametric-multiply-in-scev.ll | 4 ++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 7aa629f..bbf15ff 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -68,6 +68,11 @@ using namespace llvm; using namespace polly; +static cl::opt +DetectScopsWithoutLoops("polly-detect-scops-in-functions-without-loops", + cl::desc("Detect scops in functions without loops"), + cl::Hidden, cl::init(false), cl::cat(PollyCategory)); + static cl::opt OnlyFunction("polly-only-func", cl::desc("Only run on a single function"), cl::value_desc("function-name"), cl::ValueRequired, cl::init(""), @@ -625,9 +630,12 @@ void ScopDetection::printLocations(llvm::Function &F) { } bool ScopDetection::runOnFunction(llvm::Function &F) { + LI = &getAnalysis(); + if (!DetectScopsWithoutLoops && LI->empty()) + return false; + AA = &getAnalysis(); SE = &getAnalysis(); - LI = &getAnalysis(); RI = &getAnalysis(); Region *TopRegion = RI->getTopLevelRegion(); diff --git a/polly/test/Cloog/CodeGen/constant_condition.ll b/polly/test/Cloog/CodeGen/constant_condition.ll index 3a4a4c9..63e338e 100644 --- a/polly/test/Cloog/CodeGen/constant_condition.ll +++ b/polly/test/Cloog/CodeGen/constant_condition.ll @@ -1,4 +1,4 @@ -;RUN: opt %loadPolly %defaultOpts -polly-cloog -analyze < %s | FileCheck %s +;RUN: opt %loadPolly %defaultOpts -polly-detect-scops-in-functions-without-loops -polly-cloog -analyze < %s | FileCheck %s ;#include ;int A[1]; diff --git a/polly/test/Isl/CodeGen/constant_condition.ll b/polly/test/Isl/CodeGen/constant_condition.ll index 045efff..e5c8657 100644 --- a/polly/test/Isl/CodeGen/constant_condition.ll +++ b/polly/test/Isl/CodeGen/constant_condition.ll @@ -1,4 +1,4 @@ -;RUN: opt %loadPolly %defaultOpts -polly-ast -analyze < %s | FileCheck %s +;RUN: opt %loadPolly %defaultOpts -polly-detect-scops-in-functions-without-loops -polly-ast -analyze < %s | FileCheck %s ;#include ;int A[1]; diff --git a/polly/test/ScheduleOptimizer/2012-10-14-Zero-Bands.ll b/polly/test/ScheduleOptimizer/2012-10-14-Zero-Bands.ll index a6cbd17..6fc02853 100644 --- a/polly/test/ScheduleOptimizer/2012-10-14-Zero-Bands.ll +++ b/polly/test/ScheduleOptimizer/2012-10-14-Zero-Bands.ll @@ -1,4 +1,4 @@ -; RUN: opt %loadPolly -polly-opt-isl -analyze < %s | FileCheck %s +; RUN: opt %loadPolly -polly-detect-scops-in-functions-without-loops -polly-opt-isl -analyze < %s | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" diff --git a/polly/test/ScopDetect/parametric-multiply-in-scev.ll b/polly/test/ScopDetect/parametric-multiply-in-scev.ll index fe01e3c..e7fc28e 100644 --- a/polly/test/ScopDetect/parametric-multiply-in-scev.ll +++ b/polly/test/ScopDetect/parametric-multiply-in-scev.ll @@ -1,5 +1,5 @@ -; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s -; RUN: opt %loadPolly -polly-detect -polly-codegen-scev -analyze < %s | FileCheck %s +; RUN: opt %loadPolly -polly-detect-scops-in-functions-without-loops -polly-detect -analyze < %s | FileCheck %s +; RUN: opt %loadPolly -polly-detect-scops-in-functions-without-loops -polly-detect -polly-codegen-scev -analyze < %s | FileCheck %s ; foo(float *A, long n, long k) { -- cgit v1.1