Changeset View
Changeset View
Standalone View
Standalone View
test/Transforms/LoopInterchange/currentLimitation.ll
Show All 10 Lines | |||||
;;--------------------------------------Test case 01------------------------------------ | ;;--------------------------------------Test case 01------------------------------------ | ||||
;; [FIXME] This loop though valid is currently not interchanged due to the limitation that we cannot split the inner loop latch due to multiple use of inner induction | ;; [FIXME] This loop though valid is currently not interchanged due to the limitation that we cannot split the inner loop latch due to multiple use of inner induction | ||||
;; variable.(used to increment the loop counter and to access A[j+1][i+1] | ;; variable.(used to increment the loop counter and to access A[j+1][i+1] | ||||
;; for(int i=0;i<N-1;i++) | ;; for(int i=0;i<N-1;i++) | ||||
;; for(int j=1;j<N-1;j++) | ;; for(int j=1;j<N-1;j++) | ||||
;; A[j+1][i+1] = A[j+1][i+1] + k; | ;; A[j+1][i+1] = A[j+1][i+1] + k; | ||||
; FIXME: Currently fails because of DA changes. | |||||
; IR-LABEL: @interchange_01 | ; IR-LABEL: @interchange_01 | ||||
; IR-NOT: split | ; IR-NOT: split | ||||
; CHECK: Name: Dependence | ; CHECK: Name: UnsupportedInsBetweenInduction | ||||
; CHECK-NEXT: Function: interchange_01 | ; CHECK-NEXT: Function: interchange_01 | ||||
define void @interchange_01(i32 %k, i32 %N) { | define void @interchange_01(i32 %k, i32 %N) { | ||||
entry: | entry: | ||||
%sub = add nsw i32 %N, -1 | %sub = add nsw i32 %N, -1 | ||||
%cmp26 = icmp sgt i32 %N, 1 | %cmp26 = icmp sgt i32 %N, 1 | ||||
br i1 %cmp26, label %for.cond1.preheader.lr.ph, label %for.end17 | br i1 %cmp26, label %for.cond1.preheader.lr.ph, label %for.end17 | ||||
for.cond1.preheader.lr.ph: | for.cond1.preheader.lr.ph: | ||||
%cmp324 = icmp sgt i32 %sub, 1 | %cmp324 = icmp sgt i32 %sub, 1 | ||||
%0 = add i32 %N, -2 | %0 = add i32 %N, -2 | ||||
%1 = sext i32 %sub to i64 | %1 = sext i32 %sub to i64 | ||||
br label %for.cond1.preheader | br label %for.cond1.preheader | ||||
for.cond.loopexit: | for.cond.loopexit: | ||||
%cmp = icmp slt i64 %indvars.iv.next29, %1 | %cmp = icmp slt i64 %indvars.iv.next29, %1 | ||||
br i1 %cmp, label %for.cond1.preheader, label %for.end17 | br i1 %cmp, label %for.cond1.preheader, label %for.end17 | ||||
for.cond1.preheader: | for.cond1.preheader: | ||||
%indvars.iv28 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next29, %for.cond.loopexit ] | %indvars.iv28 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next29, %for.cond.loopexit ] | ||||
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1 | %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1 | ||||
br i1 %cmp324, label %for.body4, label %for.cond.loopexit | br i1 %cmp324, label %for.body4, label %for.cond.loopexit | ||||
for.body4: | for.body4: | ||||
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.cond1.preheader ] | %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.cond1.preheader ] | ||||
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 | %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 | ||||
%arrayidx7 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next29 | %arrayidx7 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* @A, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next29 | ||||
%2 = load i32, i32* %arrayidx7 | %2 = load i32, i32* %arrayidx7 | ||||
%add8 = add nsw i32 %2, %k | %add8 = add nsw i32 %2, %k | ||||
store i32 %add8, i32* %arrayidx7 | store i32 %add8, i32* %arrayidx7 | ||||
%lftr.wideiv = trunc i64 %indvars.iv to i32 | %lftr.wideiv = trunc i64 %indvars.iv to i32 | ||||
%exitcond = icmp eq i32 %lftr.wideiv, %0 | %exitcond = icmp eq i32 %lftr.wideiv, %0 | ||||
br i1 %exitcond, label %for.cond.loopexit, label %for.body4 | br i1 %exitcond, label %for.cond.loopexit, label %for.body4 | ||||
for.end17: | for.end17: | ||||
ret void | ret void | ||||
} | } | ||||
; When currently cannot interchange this loop, because transform currently | ; When currently cannot interchange this loop, because transform currently | ||||
; expects the latches to be the exiting blocks too. | ; expects the latches to be the exiting blocks too. | ||||
; IR-LABEL: @interchange_02 | ; IR-LABEL: @interchange_02 | ||||
; IR-NOT: split | ; IR-NOT: split | ||||
Show All 31 Lines |