[polly] r244456 - Add test case with PHI node in exit block
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 09:18:00 PDT 2015
Author: meinersbur
Date: Mon Aug 10 11:17:59 2015
New Revision: 244456
URL: http://llvm.org/viewvc/llvm-project?rev=244456&view=rev
Log:
Add test case with PHI node in exit block
The PHI node with multiple incoming edges from inside the region.
Thanks Tobias for coming up with the example.
Added:
polly/trunk/test/ScopDetect/phi_with_multi_exiting_edges.ll
Added: polly/trunk/test/ScopDetect/phi_with_multi_exiting_edges.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/phi_with_multi_exiting_edges.ll?rev=244456&view=auto
==============================================================================
--- polly/trunk/test/ScopDetect/phi_with_multi_exiting_edges.ll (added)
+++ polly/trunk/test/ScopDetect/phi_with_multi_exiting_edges.ll Mon Aug 10 11:17:59 2015
@@ -0,0 +1,66 @@
+; RUN: opt %loadPolly -polly-detect-unprofitable -polly-detect -analyze -S < %s | FileCheck %s
+;
+; XFAIL: *
+;
+; Region with an exit node that has a PHI node multiple incoming edges from
+; inside the region. Motivation for supporting such cases in Polly.
+;
+; float test(long n, float A[static const restrict n]) {
+; float sum = 0;
+; for (long i = 0; i < n; i += 1)
+; sum += A[i];
+; for (long i = 0; i < n; i += 1)
+; sum += A[i];
+; return sum;
+; }
+;
+;
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define float @test(i64 %n, float* noalias nonnull %A) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %sum.0 = phi float [ 0.000000e+00, %entry ], [ %add, %for.inc ]
+ %i.0 = phi i64 [ 0, %entry ], [ %add1, %for.inc ]
+ %cmp = icmp slt i64 %i.0, %n
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %arrayidx = getelementptr inbounds float, float* %A, i64 %i.0
+ %tmp = load float, float* %arrayidx, align 4
+ %add = fadd float %sum.0, %tmp
+ %add1 = add nuw nsw i64 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ %sum.0.lcssa = phi float [ %sum.0, %for.cond ]
+ br label %for.cond.3
+
+for.cond.3: ; preds = %for.inc.8, %for.end
+ %sum.1 = phi float [ %sum.0.lcssa, %for.end ], [ %add7, %for.inc.8 ]
+ %i2.0 = phi i64 [ 0, %for.end ], [ %add9, %for.inc.8 ]
+ %cmp4 = icmp slt i64 %i2.0, %n
+ br i1 %cmp4, label %for.body.5, label %for.end.10
+
+for.body.5: ; preds = %for.cond.3
+ br label %for.inc.8
+
+for.inc.8: ; preds = %for.body.5
+ %arrayidx6 = getelementptr inbounds float, float* %A, i64 %i2.0
+ %tmp1 = load float, float* %arrayidx6, align 4
+ %add7 = fadd float %sum.1, %tmp1
+ %add9 = add nuw nsw i64 %i2.0, 1
+ br label %for.cond.3
+
+for.end.10: ; preds = %for.cond.3
+ %sum.1.lcssa = phi float [ %sum.1, %for.cond.3 ]
+ ret float %sum.1.lcssa
+}
+
+; CHECK: Valid Region for Scop: for.cond => for.end.10
More information about the llvm-commits
mailing list