1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; REQUIRES: regkeys
; RUN: igc_opt --igc-loopcount --regkey=EnableKernelCostDebug=1 -S < %s 2>&1 | FileCheck %s
; ------------------------------------------------
; LoopCountAnalysis
; ------------------------------------------------
define spir_kernel void @test(i32 addrspace(1)* %d, i32 %N) {
;CHECK-LABEL: Loop at depth 1 with header for.body
;CHECK: Argument symbol found with index 1 isInDirect = 0
;CHECK; Total number of loops: 1
;
entry:
%cmp1 = icmp sgt i32 %N, 0
br i1 %cmp1, label %for.body.preheader, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
br label %for.end
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.for.body_crit_edge, %for.body.preheader
%0 = phi i32 addrspace(1)* [ %3, %for.body.for.body_crit_edge ], [ %d, %for.body.preheader ]
%i.02 = phi i32 [ %inc, %for.body.for.body_crit_edge ], [ 0, %for.body.preheader ]
store i32 %i.02, i32 addrspace(1)* %0, align 4
%inc = add nuw nsw i32 %i.02, 1
%cmp = icmp slt i32 %inc, %N
%1 = ptrtoint i32 addrspace(1)* %0 to i64
%2 = add i64 %1, 4
%3 = inttoptr i64 %2 to i32 addrspace(1)*
br i1 %cmp, label %for.body.for.body_crit_edge, label %for.end.loopexit
for.body.for.body_crit_edge: ; preds = %for.body
br label %for.body
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %entry.for.end_crit_edge, %for.end.loopexit
ret void
}
define spir_kernel void @test_2(i32 addrspace(1)* %d, i32 addrspace(1)* %s){
;CHECK-LABEL: Loop at depth 1 with header for.body
;CHECK: Argument symbol found with index 1 isInDirect = 1
;CHECK; Total number of loops: 1
;
entry:
%0 = ptrtoint i32 addrspace(1)* %s to i64
%1 = add i64 %0, 4
%2 = inttoptr i64 %1 to i32 addrspace(1)*
%3 = load i32, i32 addrspace(1)* %2, align 4
%cmp1.not = icmp eq i32 %3, 0
br i1 %cmp1.not, label %entry.for.end_crit_edge, label %for.body.preheader
entry.for.end_crit_edge: ; preds = %entry
br label %for.end
for.body.preheader: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.for.body_crit_edge, %for.body.preheader
%4 = phi i32 addrspace(1)* [ %7, %for.body.for.body_crit_edge ], [ %d, %for.body.preheader ]
%i.02 = phi i32 [ %inc, %for.body.for.body_crit_edge ], [ 0, %for.body.preheader ]
store i32 %i.02, i32 addrspace(1)* %4, align 4
%inc = add nuw nsw i32 %i.02, 1
%cmp = icmp ult i32 %inc, %3
%5 = ptrtoint i32 addrspace(1)* %4 to i64
%6 = add i64 %5, 4
%7 = inttoptr i64 %6 to i32 addrspace(1)*
br i1 %cmp, label %for.body.for.body_crit_edge, label %for.end.loopexit
for.body.for.body_crit_edge: ; preds = %for.body
br label %for.body
for.end.loopexit: ; preds = %for.body
br label %for.end
for.end: ; preds = %entry.for.end_crit_edge, %for.end.loopexit
ret void
}
|