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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
|
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2023-2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
; Was reduced for llvm-14, different loop-unroll results for llvm9
; REQUIRES: debug, llvm-14-plus
; RUN: igc_opt -igc-disable-loop-unroll -loop-unroll -gen-tti -debug-only="loop-unroll" -disable-output 2>&1 < %s | FileCheck %s
; ------------------------------------------------
; DisableLoopUnrollOnRetry
; ------------------------------------------------
; Test checks llvm.loop.unroll hints support on retry
; CHECK: Loop Unroll: F[test_enable] Loop %bb_enable
; CHECK: COMPLETELY UNROLLING loop %bb_enable with trip count 12!
; CHECK: Loop Unroll: F[test_full] Loop %bb_full
; CHECK: COMPLETELY UNROLLING loop %bb_full with trip count 12!
; CHECK: Loop Unroll: F[test_count] Loop %bb_count
; CHECK: UNROLLING loop %bb_count by 4!
define spir_kernel void @test_enable() {
bb:
%a = alloca i32, i32 0, align 4
br label %bb2
bb2: ; preds = %bb
br label %._crit_edge
._crit_edge: ; preds = %._crit_edge, %bb2
br i1 false, label %bb3, label %._crit_edge
bb3: ; preds = %._crit_edge
br label %.lr.ph336
.lr.ph336: ; preds = %bb3
br label %bb4
bb4: ; preds = %.lr.ph336
br label %.lr.ph333
.lr.ph333: ; preds = %bb4
br label %bb_enable
bb_enable: ; preds = %bb_enable, %.lr.ph333
%i6 = phi i32 [ 0, %.lr.ph333 ], [ %i22, %bb_enable ]
%i7 = zext i32 0 to i64
%i9 = load i32, i32* %a, align 4
%conv.i10 = zext i32 0 to i64
%conv1.i = zext i32 0 to i64
%mul.i = mul nuw i64 0, 0
%shr.i = lshr i64 0, 0
%i10 = add i32 0, 0
%i12 = load i32, i32* null, align 4
%i13 = lshr i32 0, 0
%i15 = load i32, i32* null, align 4
%i16 = mul i32 0, 0
%i17 = sub i32 0, 0
%i19 = load i32, i32* null, align 4
%i20 = mul i32 0, 0
%i21 = add i32 0, 0
%i22 = add nuw nsw i32 %i6, 1
%i23 = icmp ugt i32 %i6, 10
%i24 = icmp eq i32 0, 0
%narrow67 = select i1 %i23, i1 true, i1 undef
br i1 %narrow67, label %._crit_edge334, label %bb_enable, !llvm.loop !0
._crit_edge334: ; preds = %bb_enable
ret void
}
define spir_kernel void @test_full() {
bb:
%a = alloca i32, i32 0, align 4
br label %bb2
bb2: ; preds = %bb
br label %._crit_edge
._crit_edge: ; preds = %._crit_edge, %bb2
br i1 false, label %bb3, label %._crit_edge
bb3: ; preds = %._crit_edge
br label %.lr.ph336
.lr.ph336: ; preds = %bb3
br label %bb4
bb4: ; preds = %.lr.ph336
br label %.lr.ph333
.lr.ph333: ; preds = %bb4
br label %bb_full
bb_full: ; preds = %bb_full, %.lr.ph333
%i6 = phi i32 [ 0, %.lr.ph333 ], [ %i22, %bb_full ]
%i7 = zext i32 0 to i64
%i9 = load i32, i32* %a, align 4
%conv.i10 = zext i32 0 to i64
%conv1.i = zext i32 0 to i64
%mul.i = mul nuw i64 0, 0
%shr.i = lshr i64 0, 0
%i10 = add i32 0, 0
%i12 = load i32, i32* null, align 4
%i13 = lshr i32 0, 0
%i15 = load i32, i32* null, align 4
%i16 = mul i32 0, 0
%i17 = sub i32 0, 0
%i19 = load i32, i32* null, align 4
%i20 = mul i32 0, 0
%i21 = add i32 0, 0
%i22 = add nuw nsw i32 %i6, 1
%i23 = icmp ugt i32 %i6, 10
%i24 = icmp eq i32 0, 0
%narrow67 = select i1 %i23, i1 true, i1 undef
br i1 %narrow67, label %._crit_edge334, label %bb_full, !llvm.loop !2
._crit_edge334: ; preds = %bb_full
ret void
}
define spir_kernel void @test_count() {
bb:
%a = alloca i32, i32 0, align 4
br label %bb2
bb2: ; preds = %bb
br label %._crit_edge
._crit_edge: ; preds = %._crit_edge, %bb2
br i1 false, label %bb3, label %._crit_edge
bb3: ; preds = %._crit_edge
br label %.lr.ph336
.lr.ph336: ; preds = %bb3
br label %bb4
bb4: ; preds = %.lr.ph336
br label %.lr.ph333
.lr.ph333: ; preds = %bb4
br label %bb_count
bb_count: ; preds = %bb_count, %.lr.ph333
%i6 = phi i32 [ 0, %.lr.ph333 ], [ %i22, %bb_count ]
%i7 = zext i32 0 to i64
%i9 = load i32, i32* %a, align 4
%conv.i10 = zext i32 0 to i64
%conv1.i = zext i32 0 to i64
%mul.i = mul nuw i64 0, 0
%shr.i = lshr i64 0, 0
%i10 = add i32 0, 0
%i12 = load i32, i32* null, align 4
%i13 = lshr i32 0, 0
%i15 = load i32, i32* null, align 4
%i16 = mul i32 0, 0
%i17 = sub i32 0, 0
%i19 = load i32, i32* null, align 4
%i20 = mul i32 0, 0
%i21 = add i32 0, 0
%i22 = add nuw nsw i32 %i6, 1
%i23 = icmp ugt i32 %i6, 10
%i24 = icmp eq i32 0, 0
%narrow67 = select i1 %i23, i1 true, i1 undef
br i1 %narrow67, label %._crit_edge334, label %bb_count, !llvm.loop !4
._crit_edge334: ; preds = %bb_count
ret void
}
!0 = distinct !{!0, !1}
!1 = !{!"llvm.loop.unroll.enable"}
!2 = distinct !{!2, !3}
!3 = !{!"llvm.loop.unroll.full"}
!4 = distinct !{!4, !5}
!5 = !{!"llvm.loop.unroll.count", i32 4}
|