[polly] r228832 - [FIX] Special case for branch users of scalar values
Johannes Doerfert
doerfert at cs.uni-saarland.de
Wed Feb 11 06:52:52 PST 2015
Author: jdoerfert
Date: Wed Feb 11 08:52:52 2015
New Revision: 228832
URL: http://llvm.org/viewvc/llvm-project?rev=228832&view=rev
Log:
[FIX] Special case for branch users of scalar values
Added:
polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll
Modified:
polly/trunk/lib/Analysis/TempScopInfo.cpp
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=228832&r1=228831&r2=228832&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Wed Feb 11 08:52:52 2015
@@ -158,6 +158,12 @@ bool TempScopInfo::buildScalarDependence
if (UI == 0)
continue;
+ // Ignore branches as the can only use a synthesizable condition.
+ if (isa<BranchInst>(UI)) {
+ assert(canSynthesizeInst && "Branch condition was not synthesizable.");
+ continue;
+ }
+
BasicBlock *UseParent = UI->getParent();
// Ignore the users in the same BB (statement)
Added: polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll?rev=228832&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll (added)
+++ polly/trunk/test/ScopInfo/scalar_dependence_cond_br.ll Wed Feb 11 08:52:52 2015
@@ -0,0 +1,42 @@
+; RUN: opt %loadPolly -polly-scops -disable-polly-intra-scop-scalar-to-array -polly-model-phi-nodes -analyze < %s | FileCheck %s
+;
+; CHECK: Statements
+;
+; void f(int *A, int c, int d) {
+; for (int i = 0; i < 1024; i++)
+; if (c < i)
+; A[i]++;
+; }
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f(i32* %A, i64 %c) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
+ %exitcond = icmp ne i64 %indvars.iv, 1024
+ %cmp1 = icmp slt i64 %c, %indvars.iv
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br i1 %cmp1, label %if.then, label %if.end
+
+if.then: ; preds = %for.body
+ %arrayidx = getelementptr inbounds i32* %A, i64 %indvars.iv
+ %tmp = load i32* %arrayidx, align 4
+ %inc = add nsw i32 %tmp, 1
+ store i32 %inc, i32* %arrayidx, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %for.body
+ br label %for.inc
+
+for.inc: ; preds = %if.end
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
More information about the llvm-commits
mailing list