@@ -295,7 +295,7 @@ static Function *addReplaceFunc(Module &M, StringRef Name, Type *StateType) {
295
295
Type *PtrTy = PointerType::get (Ctx, NativeCPUGlobalAS);
296
296
static FunctionType *FTy = FunctionType::get (RetTy, {DimTy, PtrTy}, false );
297
297
auto FCallee = M.getOrInsertFunction (Name, FTy);
298
- auto *F = dyn_cast <Function>(FCallee.getCallee ());
298
+ auto *F = cast <Function>(FCallee.getCallee ());
299
299
IRBuilder<> Builder (Ctx);
300
300
BasicBlock *BB = BasicBlock::Create (Ctx, " entry" , F);
301
301
Builder.SetInsertPoint (BB);
@@ -366,9 +366,7 @@ PreservedAnalyses PrepareSYCLNativeCPUPass::run(Module &M,
366
366
if (!Glob)
367
367
continue ;
368
368
for (const auto &Use : Glob->uses ()) {
369
- auto I = dyn_cast<CallInst>(Use.getUser ());
370
- if (!I)
371
- report_fatal_error (" Unsupported Value in SYCL Native CPU\n " );
369
+ auto *I = cast<CallInst>(Use.getUser ());
372
370
if (!IsNativeCPUKernel (I->getFunction ())) {
373
371
// only use the threadlocal if we have kernels calling builtins
374
372
// indirectly
@@ -417,9 +415,7 @@ PreservedAnalyses PrepareSYCLNativeCPUPass::run(Module &M,
417
415
Function *const Glob = Entry.first ;
418
416
for (const auto &Use : Glob->uses ()) {
419
417
auto *ReplaceFunc = getReplaceFunc (M, Entry.second .first , StateType);
420
- auto I = dyn_cast<CallInst>(Use.getUser ());
421
- if (!I)
422
- report_fatal_error (" Unsupported Value in SYCL Native CPU\n " );
418
+ auto *I = cast<CallInst>(Use.getUser ());
423
419
auto *Arg = ConstantInt::get (Type::getInt32Ty (M.getContext ()),
424
420
Entry.second .second );
425
421
auto *NewI = CallInst::Create (
0 commit comments