[polly] r251226 - ScopDetection: Do not crash if we find zero array size candidates for delinearization

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 25 01:40:44 PDT 2015


Author: grosser
Date: Sun Oct 25 03:40:44 2015
New Revision: 251226

URL: http://llvm.org/viewvc/llvm-project?rev=251226&view=rev
Log:
ScopDetection: Do not crash if we find zero array size candidates for delinearization

Added:
    polly/trunk/test/ScopDetect/multidim.ll
Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=251226&r1=251225&r2=251226&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sun Oct 25 03:40:44 2015
@@ -523,7 +523,8 @@ bool ScopDetection::hasAffineMemoryAcces
                 }
               }
             }
-            Terms.push_back(SE->getMulExpr(Operands));
+            if (Operands.size())
+              Terms.push_back(SE->getMulExpr(Operands));
           }
         }
       }

Added: polly/trunk/test/ScopDetect/multidim.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/multidim.ll?rev=251226&view=auto
==============================================================================
--- polly/trunk/test/ScopDetect/multidim.ll (added)
+++ polly/trunk/test/ScopDetect/multidim.ll Sun Oct 25 03:40:44 2015
@@ -0,0 +1,36 @@
+; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; CHECK: Valid Region for Scop: bb19 => bb20
+
+; Make sure we do not crash in this test case.
+
+define void @hoge(i8* %arg)  {
+bb:
+  br label %bb9
+
+bb9:                                              ; preds = %bb
+  %tmp = add i64 undef, 4
+  %tmp10 = zext i32 undef to i64
+  %tmp11 = mul i64 %tmp, %tmp10
+  %tmp12 = add i64 %tmp11, undef
+  %tmp13 = add i64 %tmp12, undef
+  %tmp14 = add i64 %tmp13, 8
+  %tmp15 = sub i64 %tmp14, undef
+  %tmp16 = getelementptr i8, i8* %arg, i64 %tmp15
+  %tmp17 = getelementptr inbounds i8, i8* %tmp16, i64 4
+  %tmp18 = getelementptr inbounds i8, i8* %tmp17, i64 20
+  br label %bb19
+
+bb19:                                             ; preds = %bb19, %bb9
+  br i1 false, label %bb19, label %bb20
+
+bb20:                                             ; preds = %bb19
+  %tmp21 = getelementptr inbounds i8, i8* %tmp18, i64 4
+  %tmp22 = bitcast i8* %tmp21 to i32*
+  %tmp23 = load i32, i32* %tmp22
+  br label %bb24
+
+bb24:                                             ; preds = %bb20
+  unreachable
+}




More information about the llvm-commits mailing list