Skip to content

Commit ad86c34

Browse files
authored
[SYCL][ESIMD] Temp w/a for ESIMD BE: filter out @llvm.assume. (#3459)
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent 638e8cf commit ad86c34

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

llvm/lib/SYCLLowerIR/LowerESIMD.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "llvm/IR/Instructions.h"
2929
#include "llvm/IR/IntrinsicInst.h"
3030
#include "llvm/IR/Module.h"
31+
#include "llvm/IR/PatternMatch.h"
3132
#include "llvm/Pass.h"
3233
#include "llvm/Support/raw_ostream.h"
3334

@@ -1296,7 +1297,11 @@ size_t SYCLLowerESIMDPass::runOnFunction(Function &F,
12961297
auto *CI = dyn_cast<CallInst>(&I);
12971298
Function *Callee = nullptr;
12981299
if (CI && (Callee = CI->getCalledFunction())) {
1299-
1300+
// TODO workaround for ESIMD BE until it starts supporting @llvm.assume
1301+
if (match(&I, PatternMatch::m_Intrinsic<Intrinsic::assume>())) {
1302+
ESIMDToErases.push_back(CI);
1303+
continue;
1304+
}
13001305
StringRef Name = Callee->getName();
13011306

13021307
// See if the Name represents an ESIMD intrinsic and demangle only if it

llvm/test/SYCLLowerIR/esimd_lower_intrins.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,18 @@ define dso_local spir_func <16 x i32> @FUNC_44() {
308308
ret <16 x i32> %ret_val
309309
}
310310

311+
; TODO LowerESIMD.cpp temporarily removes @llvm.assume, this test checks this.
312+
; Remove once @llvm.assume is allowed in the ESIMD BE.
313+
define dso_local spir_func void @FUNC_45() {
314+
; CHECK-LABEL: FUNC_45
315+
call void @llvm.assume(i1 1)
316+
; CHECK-NOT: @llvm.assume
317+
ret void
318+
}
319+
; CHECK-LABEL: }
320+
321+
declare void @llvm.assume(i1 noundef)
322+
311323
declare dso_local spir_func <32 x i32> @_Z20__esimd_flat_atomic0ILN2cm3gen14CmAtomicOpTypeE2EjLi32ELNS1_9CacheHintE0ELS3_0EENS1_13__vector_typeIT0_XT1_EE4typeENS4_IyXT1_EE4typeENS4_ItXT1_EE4typeE(<32 x i64> %0, <32 x i16> %1)
312324
declare dso_local spir_func <32 x i32> @_Z20__esimd_flat_atomic1ILN2cm3gen14CmAtomicOpTypeE0EjLi32ELNS1_9CacheHintE0ELS3_0EENS1_13__vector_typeIT0_XT1_EE4typeENS4_IyXT1_EE4typeES7_NS4_ItXT1_EE4typeE(<32 x i64> %0, <32 x i32> %1, <32 x i16> %2)
313325
declare dso_local spir_func <32 x i32> @_Z20__esimd_flat_atomic2ILN2cm3gen14CmAtomicOpTypeE7EjLi32ELNS1_9CacheHintE0ELS3_0EENS1_13__vector_typeIT0_XT1_EE4typeENS4_IyXT1_EE4typeES7_S7_NS4_ItXT1_EE4typeE(<32 x i64> %0, <32 x i32> %1, <32 x i32> %2, <32 x i16> %3)

0 commit comments

Comments
 (0)