Skip to content

Commit 5542ef5

Browse files
agrabezhigcbot
authored andcommitted
Support opaque pointers in PromoteBools pass
Fixed issue with opaque pointers in PromoteBools pass
1 parent 829f882 commit 5542ef5

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

IGC/AdaptorOCL/preprocess_spvir/PromoteBools.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -520,19 +520,15 @@ Value* PromoteBools::getOrCreatePromotedValue(Value* value)
520520
if (newValue != value)
521521
{
522522
promotedValuesCache[value] = newValue;
523-
if (value->getType() == newValue->getType())
524-
{
525-
value->replaceAllUsesWith(newValue);
526-
}
527-
else
528-
{
529-
for (const auto& user : value->users())
530-
{
531-
if (!wasPromoted(user))
532-
{
533-
promotionQueue.push(user);
534-
}
523+
auto ty = value->getType();
524+
if (!IGCLLVM::isOpaquePointerTy(ty) && ty == newValue->getType()) {
525+
value->replaceAllUsesWith(newValue);
526+
} else {
527+
for (const auto &user : value->users()) {
528+
if (!wasPromoted(user)) {
529+
promotionQueue.push(user);
535530
}
531+
}
536532
}
537533
}
538534
return newValue;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
;=========================== begin_copyright_notice ============================
2+
;
3+
; Copyright (C) 2025 Intel Corporation
4+
;
5+
; SPDX-License-Identifier: MIT
6+
;
7+
;============================ end_copyright_notice =============================
8+
9+
; RUN: igc_opt --typed-pointers -igc-promote-bools -S %s | FileCheck %s
10+
; RUN: igc_opt --opaque-pointers -igc-promote-bools -S %s | FileCheck %s
11+
12+
target triple = "spir64-unknown-unknown"
13+
14+
; CHECK-LABEL: define spir_func float @readSrcPixelSingle() {
15+
; CHECK-NEXT: call spir_func zeroext i8 @isBorder()
16+
17+
; CHECK-LABEL: define spir_func zeroext i8 @isBorder() {
18+
; CHECK-NEXT: ret i8 0
19+
20+
define spir_func zeroext i1 @isBorder() {
21+
ret i1 false
22+
}
23+
24+
define spir_func float @readSrcPixelSingle() {
25+
%call = call spir_func zeroext i1 @isBorder()
26+
ret float 0.000000e+00
27+
}

0 commit comments

Comments
 (0)