[polly] r179163 - ScopDetect: Allow multiplications of the form <param> * <param>

Tobias Grosser grosser at fim.uni-passau.de
Wed Apr 10 00:42:29 PDT 2013


Author: grosser
Date: Wed Apr 10 02:42:28 2013
New Revision: 179163

URL: http://llvm.org/viewvc/llvm-project?rev=179163&view=rev
Log:
ScopDetect: Allow multiplications of the form <param> * <param>

We handle these by treating this result of the multiplication as an additional
parameter.

Added:
    polly/trunk/test/ScopDetect/parametric-multiply-in-scev.ll
Modified:
    polly/trunk/lib/Support/SCEVValidator.cpp

Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=179163&r1=179162&r2=179163&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Wed Apr 10 02:42:28 2013
@@ -208,6 +208,11 @@ public:
       if (Op.isINT())
         continue;
 
+      if (Op.isPARAM() && Return.isPARAM()) {
+        Return.merge(Op);
+        continue;
+      }
+
       if ((Op.isIV() || Op.isPARAM()) && !Return.isINT()) {
         DEBUG(dbgs() << "INVALID: More than one non-int operand in MulExpr\n"
                      << "\tExpr: " << *Expr << "\n"

Added: polly/trunk/test/ScopDetect/parametric-multiply-in-scev.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/parametric-multiply-in-scev.ll?rev=179163&view=auto
==============================================================================
--- polly/trunk/test/ScopDetect/parametric-multiply-in-scev.ll (added)
+++ polly/trunk/test/ScopDetect/parametric-multiply-in-scev.ll Wed Apr 10 02:42:28 2013
@@ -0,0 +1,29 @@
+; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-detect -polly-codegen-scev -analyze < %s | FileCheck %s
+
+
+;  foo(float *A, long n, long k) {
+;    if (true)
+;      A[n * k] = 0;
+;  }
+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"
+
+define void @foo(float* %A, i64 %n, i64 %k) {
+entry:
+  br label %for.j
+
+for.j:
+  br i1 true, label %if.then, label %return
+
+if.then:
+  %mul = mul nsw i64 %n, %k
+  %arrayidx = getelementptr float* %A, i64 %mul
+  store float 0.000000e+00, float* %arrayidx
+  br label %return
+
+return:
+  ret void
+}
+
+; CHECK: Valid Region for Scop: for.j => return





More information about the llvm-commits mailing list