File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -521,7 +521,7 @@ Function *GenISAIntrinsic::getDeclaration(
521
521
IGCLLVM::Module* M = (IGCLLVM::Module*)Module;
522
522
523
523
Function *F =
524
- cast <Function>(
524
+ dyn_cast <Function>(
525
525
M->getOrInsertFunction (
526
526
getName ((GenISAIntrinsic::ID)(id-Intrinsic::num_intrinsics), Tys),
527
527
getType (
@@ -530,6 +530,7 @@ Function *GenISAIntrinsic::getDeclaration(
530
530
Tys),
531
531
getAttributes (M->getContext (),(GenISAIntrinsic::ID)(id - 1 ))));
532
532
533
+ IGC_ASSERT_MESSAGE (F, " getOrInsertFunction probably returned constant expression!" );
533
534
// Since Function::isIntrinsic() will return true due to llvm.* prefix,
534
535
// Module::getOrInsertFunction fails to add the attributes.
535
536
// explicitly adding the attribute to handle this problem.
You can’t perform that action at this time.
0 commit comments