Skip to content

Commit 58c5774

Browse files
[ESIMD] Fixed a crash lowering __esimd_unpack_mask
1 parent 0f401bf commit 58c5774

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

llvm/lib/SYCLLowerIR/LowerESIMD.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,8 @@ static void translateUnPackMask(CallInst &CI) {
726726
llvm::Value *TransCI = Builder.CreateZExt(
727727
Arg0, llvm::FixedVectorType::get(llvm::Type::getInt16Ty(Context), N));
728728
TransCI->takeName(&CI);
729-
cast<llvm::Instruction>(TransCI)->setDebugLoc(CI.getDebugLoc());
729+
if (llvm::Instruction *TransCInst = dyn_cast<llvm::Instruction>(TransCI))
730+
TransCInst->setDebugLoc(CI.getDebugLoc());
730731
CI.replaceAllUsesWith(TransCI);
731732
}
732733

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -LowerESIMD -S < %s | FileCheck %s
3+
4+
define spir_func <32 x i16> @_Z3foov() {
5+
; CHECK-LABEL: @_Z3foov(
6+
; CHECK-NEXT: ret <32 x i16> zext (<32 x i1> bitcast (<1 x i32> <i32 1717986918> to <32 x i1>) to <32 x i16>)
7+
;
8+
%call.i.i = call spir_func <32 x i16> @_Z19__esimd_unpack_maskILi32EEN2cl4sycl5INTEL3gpu11vector_typeItXT_EE4typeEj(i32 1717986918)
9+
ret <32 x i16> %call.i.i
10+
}
11+
12+
declare dso_local spir_func <32 x i16> @_Z19__esimd_unpack_maskILi32EEN2cl4sycl5INTEL3gpu11vector_typeItXT_EE4typeEj(i32)

0 commit comments

Comments
 (0)