[polly] r250669 - [FIX] Only constant integer branch conditions are always affine
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 18 15:56:44 PDT 2015
Author: jdoerfert
Date: Sun Oct 18 17:56:42 2015
New Revision: 250669
URL: http://llvm.org/viewvc/llvm-project?rev=250669&view=rev
Log:
[FIX] Only constant integer branch conditions are always affine
There are several different kinds of constants that could occur in a
branch condition, however we can only handle the most interesting one
namely constant integers. To this end we have to treat others as
non-affine.
This fixes bug 25244.
Added:
polly/trunk/test/ScopInfo/constant-non-integer-branch-condition.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=250669&r1=250668&r2=250669&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sun Oct 18 17:56:42 2015
@@ -421,8 +421,8 @@ bool ScopDetection::isValidCFG(BasicBloc
if (isa<UndefValue>(Condition))
return invalid<ReportUndefCond>(Context, /*Assert=*/true, TI, &BB);
- // Constant conditions are always affine.
- if (isa<Constant>(Condition))
+ // Constant integer conditions are always affine.
+ if (isa<ConstantInt>(Condition))
return true;
if (BranchInst *BI = dyn_cast<BranchInst>(TI))
Added: polly/trunk/test/ScopInfo/constant-non-integer-branch-condition.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/constant-non-integer-branch-condition.ll?rev=250669&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/constant-non-integer-branch-condition.ll (added)
+++ polly/trunk/test/ScopInfo/constant-non-integer-branch-condition.ll Sun Oct 18 17:56:42 2015
@@ -0,0 +1,27 @@
+; RUN: opt %loadPolly -analyze -polly-scops %s | FileCheck %s
+;
+; At some point this caused a problem in the domain generation as we
+; assumed any constant branch condition to be valid. However, only constant
+; integers are interesting and can be handled.
+;
+; CHECK: Stmt_entry_split__TO__cleanup
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: nounwind uwtable
+define i32 @main(i32* %A) #0 {
+entry:
+ br label %entry.split
+
+entry.split: ; preds = %entry
+ br i1 icmp ne (i32 (...)* @test_weak, i32 (...)* null), label %if.then, label %cleanup
+
+if.then: ; preds = %entry.split
+ store i32 0, i32* %A
+ br label %cleanup
+
+cleanup: ; preds = %if.then, %entry.split
+ ret i32 0
+}
+
+declare extern_weak i32 @test_weak(...)
More information about the llvm-commits
mailing list