Skip to content

Commit

Permalink
Change cast type in WIAnalysis
Browse files Browse the repository at this point in the history
Change 'cast' to 'dyn_cast' and check for null pointer.
  • Loading branch information
pawelflisikowski authored and igcbot committed Aug 7, 2024
1 parent a8f79f5 commit 19c6e97
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions IGC/Compiler/CISACodeGen/WIAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1538,9 +1538,16 @@ WIAnalysis::WIDependancy WIAnalysisRunner::calculate_dep(const CallInst* inst)
if (intrinsic_name == llvm_input ||
intrinsic_name == llvm_shaderinputvec)
{
e_interpolation mode = (e_interpolation)cast<ConstantInt>(inst->getOperand(1))->getZExtValue();
if (mode != EINTERPOLATION_CONSTANT
)
if (auto* CI = dyn_cast<ConstantInt>(inst->getOperand(1)))
{
e_interpolation mode = (e_interpolation)CI->getZExtValue();
if (mode != EINTERPOLATION_CONSTANT
)
{
return WIAnalysis::RANDOM;
}
}
else
{
return WIAnalysis::RANDOM;
}
Expand Down

0 comments on commit 19c6e97

Please sign in to comment.