[NFC][IndVars] Add test that caused D108043 to be reverted

We currently don't simplify anything here, but we can.
This commit is contained in:
Roman Lebedev 2021-08-30 12:00:08 +03:00
parent 0a1d80d56e
commit ada219b13a
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,68 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -indvars -S %s | FileCheck %s
@g_2168 = external global [4 x [6 x i32]], align 16
@g_1150 = external global i32*, align 8
define internal fastcc void @func_2() unnamed_addr {
; CHECK-LABEL: @func_2(
; CHECK-NEXT: lbl_2898.preheader:
; CHECK-NEXT: br label [[LBL_2898:%.*]]
; CHECK: lbl_2898.loopexit:
; CHECK-NEXT: [[DOTLCSSA:%.*]] = phi i32* [ [[TMP0:%.*]], [[FOR_COND884:%.*]] ]
; CHECK-NEXT: store i32* [[DOTLCSSA]], i32** @g_1150, align 8
; CHECK-NEXT: br label [[LBL_2898]]
; CHECK: lbl_2898:
; CHECK-NEXT: [[G_1150_PROMOTED:%.*]] = load i32*, i32** @g_1150, align 8
; CHECK-NEXT: br label [[FOR_COND884]]
; CHECK: for.cond884:
; CHECK-NEXT: [[TMP0]] = phi i32* [ getelementptr inbounds ([4 x [6 x i32]], [4 x [6 x i32]]* @g_2168, i64 0, i64 3, i64 1), [[FOR_END987:%.*]] ], [ [[G_1150_PROMOTED]], [[LBL_2898]] ]
; CHECK-NEXT: [[STOREMERGE9:%.*]] = phi i16 [ [[ADD990:%.*]], [[FOR_END987]] ], [ 0, [[LBL_2898]] ]
; CHECK-NEXT: [[CMP886:%.*]] = icmp ult i16 [[STOREMERGE9]], 3
; CHECK-NEXT: br i1 [[CMP886]], label [[FOR_BODY888:%.*]], label [[LBL_2898_LOOPEXIT:%.*]]
; CHECK: for.body888:
; CHECK-NEXT: br label [[FOR_COND918:%.*]]
; CHECK: for.cond918:
; CHECK-NEXT: br label [[FOR_END926:%.*]]
; CHECK: for.end926:
; CHECK-NEXT: br label [[FOR_COND936:%.*]]
; CHECK: for.cond936:
; CHECK-NEXT: br label [[FOR_END987]]
; CHECK: for.end987:
; CHECK-NEXT: [[ADD990]] = add nuw nsw i16 [[STOREMERGE9]], 1
; CHECK-NEXT: br label [[FOR_COND884]]
;
lbl_2898.preheader:
br label %lbl_2898
lbl_2898.loopexit:
%.lcssa = phi i32* [ %0, %for.cond884 ]
store i32* %.lcssa, i32** @g_1150, align 8
br label %lbl_2898
lbl_2898:
%g_1150.promoted = load i32*, i32** @g_1150, align 8
br label %for.cond884
for.cond884:
%0 = phi i32* [ getelementptr inbounds ([4 x [6 x i32]], [4 x [6 x i32]]* @g_2168, i64 0, i64 3, i64 1), %for.end987 ], [ %g_1150.promoted, %lbl_2898 ]
%storemerge9 = phi i16 [ %add990, %for.end987 ], [ 0, %lbl_2898 ]
%cmp886 = icmp slt i16 %storemerge9, 3
br i1 %cmp886, label %for.body888, label %lbl_2898.loopexit
for.body888:
br label %for.cond918
for.cond918:
br label %for.end926
for.end926:
br label %for.cond936
for.cond936:
br label %for.end987
for.end987:
%add990 = add i16 %storemerge9, 1
br label %for.cond884
}