[test] Reduced test for second distinct issue triggering revert of 9153515

This commit is contained in:
Philip Reames 2022-07-15 12:08:24 -07:00 committed by Philip Reames
parent 1976ad70c5
commit 2aed3cdb5e
1 changed files with 32 additions and 0 deletions

View File

@ -351,4 +351,36 @@ exit:
ret void
}
; Loop invariant does not neccessarily mean dominating the loop. Forming
; an ICmpZero from this example would be illegal even though the operands
; to the compare are loop invariant.
define void @loop_invariant_definition(i64 %arg) {
; CHECK-LABEL: @loop_invariant_definition(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[T1:%.*]]
; CHECK: t1:
; CHECK-NEXT: [[LSR_IV:%.*]] = phi i64 [ [[LSR_IV_NEXT:%.*]], [[T1]] ], [ -1, [[ENTRY:%.*]] ]
; CHECK-NEXT: [[LSR_IV_NEXT]] = add nsw i64 [[LSR_IV]], 1
; CHECK-NEXT: br i1 true, label [[T4:%.*]], label [[T1]]
; CHECK: t4:
; CHECK-NEXT: [[T5:%.*]] = trunc i64 [[LSR_IV_NEXT]] to i32
; CHECK-NEXT: [[T6:%.*]] = add i32 [[T5]], 1
; CHECK-NEXT: [[T7:%.*]] = icmp eq i32 [[T5]], [[T6]]
; CHECK-NEXT: ret void
;
entry:
br label %t1
t1: ; preds = %1, %0
%t2 = phi i64 [ %t3, %t1 ], [ 0, %entry ]
%t3 = add nuw i64 %t2, 1
br i1 true, label %t4, label %t1
t4: ; preds = %1
%t5 = trunc i64 %t2 to i32
%t6 = add i32 %t5, 1
%t7 = icmp eq i32 %t5, %t6
ret void
}
declare i64 @llvm.vscale.i64()