File tree Expand file tree Collapse file tree 5 files changed +99
-5
lines changed
AdaptorOCL/ocl_igc_shared/indirect_access_detection
Optimizer/OpenCLPasses/ScalarArgAsPointer Expand file tree Collapse file tree 5 files changed +99
-5
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ SPDX-License-Identifier: MIT
1313
1414#pragma once
1515
16- const uint32_t INDIRECT_ACCESS_DETECTION_VERSION = 8 ;
16+ const uint32_t INDIRECT_ACCESS_DETECTION_VERSION = 9 ;
Original file line number Diff line number Diff line change @@ -224,11 +224,12 @@ ScalarArgAsPointerAnalysis::findArgs(llvm::Instruction* inst)
224224 {
225225 auto args = analyzeOperand (inst->getOperand (i));
226226
227- if (!args)
228- return nullptr ; // propagate fail
229-
230- result->insert (args->begin (), args->end ());
227+ if (args)
228+ result->insert (args->begin (), args->end ());
231229 }
230+
231+ if (result->empty ())
232+ return nullptr ; // propagate fail
232233 }
233234
234235 m_visitedInst[inst] = result;
Original file line number Diff line number Diff line change 1+ ;=========================== begin_copyright_notice ============================
2+ ;
3+ ; Copyright (C) 2024 Intel Corporation
4+ ;
5+ ; SPDX-License-Identifier: MIT
6+ ;
7+ ;============================ end_copyright_notice =============================
8+
9+ ; REQUIRES: llvm-14-plus
10+ ; RUN: igc_opt --opaque-pointers --igc-scalar-arg-as-pointer-analysis -igc-serialize-metadata -S %s | FileCheck %s
11+ ;
12+ ; CHECK: !{!"m_OpenCLArgScalarAsPointersSet{{[[][0-9][]]}}", i32 0}
13+
14+ define spir_kernel void @test (i64 %a ) #0 {
15+ entry:
16+ %0 = add nsw i64 1 , 2
17+ %1 = add nsw i64 %a , %0
18+ %2 = inttoptr i64 %1 to i32 addrspace (1 )*
19+ store i32 39 , i32 addrspace (1 )* %2 , align 4
20+ ret void
21+ }
22+
23+ !igc.functions = !{!0 }
24+
25+ !0 = !{void (i64 )* @test , !1 }
26+ !1 = !{!2 }
27+ !2 = !{!"function_type" , i32 0 }
Original file line number Diff line number Diff line change 1+ ;=========================== begin_copyright_notice ============================
2+ ;
3+ ; Copyright (C) 2024 Intel Corporation
4+ ;
5+ ; SPDX-License-Identifier: MIT
6+ ;
7+ ;============================ end_copyright_notice =============================
8+
9+ ; REQUIRES: llvm-14-plus
10+ ; RUN: igc_opt --opaque-pointers --igc-scalar-arg-as-pointer-analysis -igc-serialize-metadata -S %s | FileCheck %s
11+ ;
12+ ; CHECK-NOT: m_OpenCLArgScalarAsPointersSet
13+
14+ define spir_kernel void @test (i64 %a , i32 addrspace (1 )* %p ) #0 {
15+ entry:
16+ %0 = add nsw i64 1 , 2
17+ %1 = add nsw i64 %a , %0
18+ %2 = getelementptr inbounds i32 , i32 addrspace (1 )* %p , i64 %1
19+ store i32 39 , i32 addrspace (1 )* %2 , align 4
20+ ret void
21+ }
22+
23+ !igc.functions = !{!0 }
24+
25+ !0 = !{void (i64 , i32 addrspace (1 )*)* @test , !1 }
26+ !1 = !{!2 }
27+ !2 = !{!"function_type" , i32 0 }
Original file line number Diff line number Diff line change 1+ ;=========================== begin_copyright_notice ============================
2+ ;
3+ ; Copyright (C) 2024 Intel Corporation
4+ ;
5+ ; SPDX-License-Identifier: MIT
6+ ;
7+ ;============================ end_copyright_notice =============================
8+
9+ ; REQUIRES: llvm-14-plus
10+ ; RUN: igc_opt --opaque-pointers --igc-scalar-arg-as-pointer-analysis -igc-serialize-metadata -S %s | FileCheck %s
11+ ;
12+ ; Tests "phi" instruction, when first path leads to scalar as pointer.
13+ ;
14+ ; CHECK-NOT: !{!"m_OpenCLArgScalarAsPointersSet{{[[][0-9][]]}}", i32 0}
15+ ; CHECK: !{!"m_OpenCLArgScalarAsPointersSet{{[[][0-9][]]}}", i32 1}
16+ ; CHECK-NOT: !{!"m_OpenCLArgScalarAsPointersSet{{[[][0-9][]]}}", i32 2}
17+
18+ define spir_kernel void @test (i1 %s , i64 %a , i32 addrspace (1 )* %b ) #0 {
19+ entry:
20+ br i1 %s , label %if.then , label %if.else
21+
22+ if.then:
23+ %0 = inttoptr i64 %a to i32 addrspace (1 )*
24+ br label %if.end
25+
26+ if.else:
27+ br label %if.end
28+
29+ if.end:
30+ %1 = phi i32 addrspace (1 )* [ %0 , %if.then ], [ %b , %if.else ]
31+ store i32 39 , i32 addrspace (1 )* %1 , align 4
32+ ret void
33+ }
34+
35+ !igc.functions = !{!0 }
36+
37+ !0 = !{void (i1 , i64 , i32 addrspace (1 )*)* @test , !1 }
38+ !1 = !{!2 }
39+ !2 = !{!"function_type" , i32 0 }
You can’t perform that action at this time.
0 commit comments