[polly] r234119 - Do not assume all multi-parameter products are affine

Tobias Grosser tobias at grosser.es
Sun Apr 5 07:57:50 PDT 2015


Author: grosser
Date: Sun Apr  5 09:57:50 2015
New Revision: 234119

URL: http://llvm.org/viewvc/llvm-project?rev=234119&view=rev
Log:
Do not assume all multi-parameter products are affine

As soon as one operand of the product is invalid, the entire product is invalid.
This happens for example if one of the operands is not loop-invariant.

This fixes http://llvm.org/PR23125

Reported-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com

Added:
    polly/trunk/test/ScopDetect/parametric-multiply-in-scev-2.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=234119&r1=234118&r2=234119&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Sun Apr  5 09:57:50 2015
@@ -228,7 +228,7 @@ public:
       Return.merge(Op);
     }
 
-    if (HasMultipleParams)
+    if (HasMultipleParams && Return.isValid())
       return ValidatorResult(SCEVType::PARAM, Expr);
 
     // TODO: Check for NSW and NUW.

Added: polly/trunk/test/ScopDetect/parametric-multiply-in-scev-2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/parametric-multiply-in-scev-2.ll?rev=234119&view=auto
==============================================================================
--- polly/trunk/test/ScopDetect/parametric-multiply-in-scev-2.ll (added)
+++ polly/trunk/test/ScopDetect/parametric-multiply-in-scev-2.ll Sun Apr  5 09:57:50 2015
@@ -0,0 +1,27 @@
+; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
+
+
+; CHECK-NOT: Valid Region
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @blam(float* %A, float* %B) {
+bb:
+  %tmp1 = alloca i64
+  %tmp2 = shl i64 2, undef
+  %tmp3 = shl i64 2, undef
+  %tmp4 = mul nsw i64 %tmp2, %tmp3
+  br label %loop
+
+loop:
+  %indvar = phi i64 [ %indvar.next, %loop ], [ 0, %bb ]
+  %tmp12 = load i64, i64* %tmp1
+  %tmp13 = mul nsw i64 %tmp12, %tmp4
+  %ptr = getelementptr inbounds float, float* %B, i64 %tmp13
+  %val = load float, float* %ptr
+  store float %val, float* %A
+  %indvar.next = add nsw i64 %indvar, 1
+  br i1 false, label %loop, label %bb21
+
+bb21:
+  ret void
+}





More information about the llvm-commits mailing list