[polly] r183025 - Test that independent block pass does not transform induction variables

Tobias Grosser tobias at grosser.es
Mon Jun 3 01:08:42 PDT 2013


On 06/02/2013 06:54 AM, Sebastian Pop wrote:
> Tobias Grosser wrote:
>> Author: grosser
>> Date: Fri May 31 12:44:38 2013
>> New Revision: 183025
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=183025&view=rev
>> Log:
>> Test that independent block pass does not transform induction variables
>>
>> The original test case showed a problem with the independet blocks pass and
>> we decided to XFAIL it for now. Unfortunately the failure is not detected if
>> we build without asserts and the verification of the independent block pass
>> is not run. This change tests now for the actual reason of the failure and
>> should trigger even in a non asserts build. We did not yet solve the underlying
>> bug, but this should at least make the test suite behavior consistent.
>
> When I first read the title, I thought you solved the problem by special casing
> SCEV synthesizable IVs in independent block pass.

No, unfortunately not.

I believe special casing is not an option here. In fact, I believe there 
is no solution within the independent blocks pass. The failing test case 
shows that translating out of SSA is not possible. I attached another 
test case that illustrates that leaving the PHI node as it is is also 
not an option.

I believe we rather should refuse to handle such situations for now. A 
check that seems to be save is to refuse to scops, in which a loop 
header is part of the scop, but the entire loop is not. This is probably 
something we already do implicatively for the non -polly-codegen-scev case.

What do you think?

Cheers,
Tobias
-------------- next part --------------
; RUN: opt %loadPolly -polly-independent -polly-codegen-scev < %s -S | FileCheck %s
;
; Ensure that the independent block pass does not invalidate the induction
; variable here.
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"

define void @main(i64* %A) nounwind {
entry:
  br label %for.i

for.i:
  %indvar.i = phi i64 [ 0, %entry ], [ %indvar.next.i, %for.i.backedge ]
  %indvar.next.i = add i64 %indvar.i, 1
  %scevgep = getelementptr i64* %A, i64 %indvar.i
  store i64 %indvar.i, i64* %scevgep, align 4
  br i1 true, label %for.j.preheader, label %for.j2

for.j.preheader:
  br label %for.j

for.j:
  %indvar.j = phi i64 [ %indvar.next.j, %for.j ], [ 0, %for.j.preheader ]
  %indvar.next.j = add i64 %indvar.j, 1
  %exitcond.j = icmp eq i64 %indvar.next.j, 10
  br i1 %exitcond.j, label %for.j2, label %for.j

for.j2:
  fence seq_cst
  br label %for.i.backedge

for.i.backedge:
  %exitcond.i = icmp eq i64 %indvar.next.i, 2048
  br i1 %exitcond.i, label %for.i, label %.end

.end:
  ret void
}

; CHECK: %indvar.j = phi i64 [ %indvar.next.j, %for.j ], [ 0, %for.j.preheader ]


More information about the llvm-commits mailing list