mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[Test] Simplify test by removing unneeded variable
This commit is contained in:
parent
aeb7dd335b
commit
260b1e427d
@ -3,30 +3,26 @@
|
|||||||
; RUN: opt -passes=indvars -S < %s | FileCheck %s
|
; RUN: opt -passes=indvars -S < %s | FileCheck %s
|
||||||
|
|
||||||
; TODO: should be able to remove the range check basing on the following facts:
|
; TODO: should be able to remove the range check basing on the following facts:
|
||||||
; 0 <= len <= MAX_INT, start ult len, therefore
|
; 0 <= len <= MAX_INT [1];
|
||||||
; 0 <= start < MAX_INT [1];
|
|
||||||
; iv starts from len and goes down stopping at zero and [1], therefore
|
; iv starts from len and goes down stopping at zero and [1], therefore
|
||||||
; 0 <= iv <= len [2];
|
; 0 <= iv <= len [2];
|
||||||
; 3. In range_check_block, iv != 0 and [2], therefore
|
; 3. In range_check_block, iv != 0 and [2], therefore
|
||||||
; 1 <= iv <= len [3];
|
; 1 <= iv <= len [3];
|
||||||
; 4. iv.next = iv - 1 and [3], therefore
|
; 4. iv.next = iv - 1 and [3], therefore
|
||||||
; 0 <= iv.next < len.
|
; 0 <= iv.next < len.
|
||||||
define void @test_predicated_simple(i32 %start, i32* %p, i32* %arr) {
|
define void @test_predicated_simple(i32* %p, i32* %arr) {
|
||||||
; CHECK-LABEL: @test_predicated_simple(
|
; CHECK-LABEL: @test_predicated_simple(
|
||||||
; CHECK-NEXT: entry:
|
; CHECK-NEXT: preheader:
|
||||||
; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[P:%.*]], align 4, !range !0
|
; CHECK-NEXT: [[LEN:%.*]] = load i32, i32* [[P:%.*]], align 4, [[RNG0:!range !.*]]
|
||||||
; CHECK-NEXT: [[GUARD_COND:%.*]] = icmp ult i32 [[START:%.*]], [[LEN]]
|
|
||||||
; CHECK-NEXT: br i1 [[GUARD_COND]], label [[PREHEADER:%.*]], label [[FAIL:%.*]]
|
|
||||||
; CHECK: preheader:
|
|
||||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||||
; CHECK: loop:
|
; CHECK: loop:
|
||||||
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[LEN]], [[PREHEADER]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
|
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[LEN]], [[PREHEADER:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
|
||||||
; CHECK-NEXT: [[ZERO_COND:%.*]] = icmp eq i32 [[IV]], 0
|
; CHECK-NEXT: [[ZERO_COND:%.*]] = icmp eq i32 [[IV]], 0
|
||||||
; CHECK-NEXT: br i1 [[ZERO_COND]], label [[EXIT:%.*]], label [[RANGE_CHECK_BLOCK:%.*]]
|
; CHECK-NEXT: br i1 [[ZERO_COND]], label [[EXIT:%.*]], label [[RANGE_CHECK_BLOCK:%.*]]
|
||||||
; CHECK: range_check_block:
|
; CHECK: range_check_block:
|
||||||
; CHECK-NEXT: [[IV_NEXT]] = sub i32 [[IV]], 1
|
; CHECK-NEXT: [[IV_NEXT]] = sub i32 [[IV]], 1
|
||||||
; CHECK-NEXT: [[RANGE_CHECK:%.*]] = icmp ult i32 [[IV_NEXT]], [[LEN]]
|
; CHECK-NEXT: [[RANGE_CHECK:%.*]] = icmp ult i32 [[IV_NEXT]], [[LEN]]
|
||||||
; CHECK-NEXT: br i1 [[RANGE_CHECK]], label [[BACKEDGE]], label [[FAIL_LOOPEXIT:%.*]]
|
; CHECK-NEXT: br i1 [[RANGE_CHECK]], label [[BACKEDGE]], label [[FAIL:%.*]]
|
||||||
; CHECK: backedge:
|
; CHECK: backedge:
|
||||||
; CHECK-NEXT: [[EL_PTR:%.*]] = getelementptr i32, i32* [[P]], i32 [[IV]]
|
; CHECK-NEXT: [[EL_PTR:%.*]] = getelementptr i32, i32* [[P]], i32 [[IV]]
|
||||||
; CHECK-NEXT: [[EL:%.*]] = load i32, i32* [[EL_PTR]], align 4
|
; CHECK-NEXT: [[EL:%.*]] = load i32, i32* [[EL_PTR]], align 4
|
||||||
@ -34,17 +30,11 @@ define void @test_predicated_simple(i32 %start, i32* %p, i32* %arr) {
|
|||||||
; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT]]
|
; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT]]
|
||||||
; CHECK: exit:
|
; CHECK: exit:
|
||||||
; CHECK-NEXT: ret void
|
; CHECK-NEXT: ret void
|
||||||
; CHECK: fail.loopexit:
|
|
||||||
; CHECK-NEXT: br label [[FAIL]]
|
|
||||||
; CHECK: fail:
|
; CHECK: fail:
|
||||||
; CHECK-NEXT: unreachable
|
; CHECK-NEXT: unreachable
|
||||||
;
|
;
|
||||||
entry:
|
|
||||||
%len = load i32, i32* %p, !range !0
|
|
||||||
%guard_cond = icmp ult i32 %start, %len
|
|
||||||
br i1 %guard_cond, label %preheader, label %fail
|
|
||||||
|
|
||||||
preheader:
|
preheader:
|
||||||
|
%len = load i32, i32* %p, !range !0
|
||||||
br label %loop
|
br label %loop
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
|
Loading…
Reference in New Issue
Block a user