mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-12 02:47:10 +00:00
[Tests] More consolidation of lftr tests
llvm-svn: 360936
This commit is contained in:
parent
c37a86d479
commit
e7b680478c
@ -1,36 +0,0 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -indvars -S | FileCheck %s
|
||||
@.str3 = private constant [6 x i8] c"%lld\0A\00", align 1
|
||||
declare i32 @printf(i8* noalias nocapture, ...) nounwind
|
||||
|
||||
; PR13371: indvars pass incorrectly substitutes 'undef' values
|
||||
;
|
||||
; LFTR should not user %undef as the loop counter.
|
||||
define i64 @test() nounwind {
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: func_start:
|
||||
; CHECK-NEXT: br label [[BLOCK9:%.*]]
|
||||
; CHECK: block9:
|
||||
; CHECK-NEXT: [[UNDEF:%.*]] = phi i64 [ [[NEXT_UNDEF:%.*]], [[BLOCK9]] ], [ undef, [[FUNC_START:%.*]] ]
|
||||
; CHECK-NEXT: [[ITER:%.*]] = phi i64 [ [[NEXT_ITER:%.*]], [[BLOCK9]] ], [ 1, [[FUNC_START]] ]
|
||||
; CHECK-NEXT: [[NEXT_ITER]] = add nuw nsw i64 [[ITER]], 1
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 [[NEXT_ITER]], i64 [[UNDEF]])
|
||||
; CHECK-NEXT: [[NEXT_UNDEF]] = add nsw i64 [[UNDEF]], 1
|
||||
; CHECK-NEXT: [[_TMP_3:%.*]] = icmp ult i64 [[NEXT_ITER]], 100
|
||||
; CHECK-NEXT: br i1 [[_TMP_3]], label [[BLOCK9]], label [[EXIT:%.*]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: ret i64 0
|
||||
;
|
||||
func_start:
|
||||
br label %block9
|
||||
block9: ; preds = %block9,%func_start
|
||||
%undef = phi i64 [ %next_undef, %block9 ], [ undef, %func_start ]
|
||||
%iter = phi i64 [ %next_iter, %block9 ], [ 1, %func_start ]
|
||||
%next_iter = add nsw i64 %iter, 1
|
||||
%0 = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 %next_iter, i64 %undef)
|
||||
%next_undef = add nsw i64 %undef, 1
|
||||
%_tmp_3 = icmp slt i64 %next_iter, 100
|
||||
br i1 %_tmp_3, label %block9, label %exit
|
||||
exit: ; preds = %block9
|
||||
ret i64 0
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -indvars -S | FileCheck %s
|
||||
|
||||
; Don't RAUW the loop's original comparison instruction if it has other uses
|
||||
; which aren't dominated by the new comparison instruction (which we insert
|
||||
; at the branch user).
|
||||
define void @use_before_branch() {
|
||||
; CHECK-LABEL: @use_before_branch(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[LOOPENTRY_0:%.*]]
|
||||
; CHECK: loopentry.0:
|
||||
; CHECK-NEXT: [[MB_Y_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[TMP_152:%.*]], [[LOOPENTRY_1:%.*]] ]
|
||||
; CHECK-NEXT: [[TMP_14:%.*]] = icmp ule i32 [[MB_Y_0]], 3
|
||||
; CHECK-NEXT: [[TMP_15:%.*]] = zext i1 [[TMP_14]] to i32
|
||||
; CHECK-NEXT: br i1 [[TMP_14]], label [[LOOPENTRY_1]], label [[LOOPEXIT_0:%.*]]
|
||||
; CHECK: loopentry.1:
|
||||
; CHECK-NEXT: [[TMP_152]] = add nuw nsw i32 [[MB_Y_0]], 2
|
||||
; CHECK-NEXT: br label [[LOOPENTRY_0]]
|
||||
; CHECK: loopexit.0:
|
||||
; CHECK-NEXT: unreachable
|
||||
;
|
||||
entry:
|
||||
br label %loopentry.0
|
||||
|
||||
loopentry.0:
|
||||
%mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopentry.1 ]
|
||||
%tmp.14 = icmp sle i32 %mb_y.0, 3
|
||||
%tmp.15 = zext i1 %tmp.14 to i32
|
||||
br i1 %tmp.14, label %loopentry.1, label %loopexit.0
|
||||
|
||||
loopentry.1:
|
||||
%tmp.152 = add i32 %mb_y.0, 2
|
||||
br label %loopentry.0
|
||||
|
||||
loopexit.0: ; preds = %loopentry.0
|
||||
unreachable
|
||||
}
|
@ -115,3 +115,72 @@ loop:
|
||||
exit:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Don't RAUW the loop's original comparison instruction if it has other uses
|
||||
; which aren't dominated by the new comparison instruction (which we insert
|
||||
; at the branch user).
|
||||
define void @use_before_branch() {
|
||||
; CHECK-LABEL: @use_before_branch(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[LOOPENTRY_0:%.*]]
|
||||
; CHECK: loopentry.0:
|
||||
; CHECK-NEXT: [[MB_Y_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[TMP_152:%.*]], [[LOOPENTRY_1:%.*]] ]
|
||||
; CHECK-NEXT: [[TMP_14:%.*]] = icmp ule i32 [[MB_Y_0]], 3
|
||||
; CHECK-NEXT: br i1 [[TMP_14]], label [[LOOPENTRY_1]], label [[LOOPEXIT_0:%.*]]
|
||||
; CHECK: loopentry.1:
|
||||
; CHECK-NEXT: [[TMP_152]] = add nuw nsw i32 [[MB_Y_0]], 2
|
||||
; CHECK-NEXT: br label [[LOOPENTRY_0]]
|
||||
; CHECK: loopexit.0:
|
||||
; CHECK-NEXT: unreachable
|
||||
;
|
||||
entry:
|
||||
br label %loopentry.0
|
||||
|
||||
loopentry.0:
|
||||
%mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopentry.1 ]
|
||||
%tmp.14 = icmp sle i32 %mb_y.0, 3
|
||||
%tmp.15 = zext i1 %tmp.14 to i32
|
||||
br i1 %tmp.14, label %loopentry.1, label %loopexit.0
|
||||
|
||||
loopentry.1:
|
||||
%tmp.152 = add i32 %mb_y.0, 2
|
||||
br label %loopentry.0
|
||||
|
||||
loopexit.0: ; preds = %loopentry.0
|
||||
unreachable
|
||||
}
|
||||
|
||||
@.str3 = private constant [6 x i8] c"%lld\0A\00", align 1
|
||||
declare i32 @printf(i8* noalias nocapture, ...) nounwind
|
||||
|
||||
; PR13371: indvars pass incorrectly substitutes 'undef' values
|
||||
;
|
||||
; LFTR should not user %undef as the loop counter.
|
||||
define i64 @no_undef_counter() nounwind {
|
||||
; CHECK-LABEL: @no_undef_counter(
|
||||
; CHECK-NEXT: func_start:
|
||||
; CHECK-NEXT: br label [[BLOCK9:%.*]]
|
||||
; CHECK: block9:
|
||||
; CHECK-NEXT: [[UNDEF:%.*]] = phi i64 [ [[NEXT_UNDEF:%.*]], [[BLOCK9]] ], [ undef, [[FUNC_START:%.*]] ]
|
||||
; CHECK-NEXT: [[ITER:%.*]] = phi i64 [ [[NEXT_ITER:%.*]], [[BLOCK9]] ], [ 1, [[FUNC_START]] ]
|
||||
; CHECK-NEXT: [[NEXT_ITER]] = add nuw nsw i64 [[ITER]], 1
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 [[NEXT_ITER]], i64 [[UNDEF]])
|
||||
; CHECK-NEXT: [[NEXT_UNDEF]] = add nsw i64 [[UNDEF]], 1
|
||||
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[NEXT_ITER]], 100
|
||||
; CHECK-NEXT: br i1 [[EXITCOND]], label [[BLOCK9]], label [[EXIT:%.*]]
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: ret i64 0
|
||||
;
|
||||
func_start:
|
||||
br label %block9
|
||||
block9: ; preds = %block9,%func_start
|
||||
%undef = phi i64 [ %next_undef, %block9 ], [ undef, %func_start ]
|
||||
%iter = phi i64 [ %next_iter, %block9 ], [ 1, %func_start ]
|
||||
%next_iter = add nsw i64 %iter, 1
|
||||
%0 = tail call i32 (i8*, ...) @printf(i8* noalias nocapture getelementptr inbounds ([6 x i8], [6 x i8]* @.str3, i64 0, i64 0), i64 %next_iter, i64 %undef)
|
||||
%next_undef = add nsw i64 %undef, 1
|
||||
%_tmp_3 = icmp slt i64 %next_iter, 100
|
||||
br i1 %_tmp_3, label %block9, label %exit
|
||||
exit: ; preds = %block9
|
||||
ret i64 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user