From 4cd04fe1aba807f941c34f33bcd510ce4a892139 Mon Sep 17 00:00:00 2001 From: Mike Rice Date: Tue, 16 Jul 2024 08:05:43 -0700 Subject: [PATCH] [NFC][clang] Replace unchecked dyn_cast with cast (#98948) Summary: BI__builtin_hlsl_elementwise_rcp is only invoked with a FixedVectorType so use cast to make this clear and satisfy the static verifier. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251454 --- clang/lib/CodeGen/CGBuiltin.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a54fa7bf87aadd..c0297476391d21 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -18389,13 +18389,12 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, llvm_unreachable("rcp operand must have a float representation"); llvm::Type *Ty = Op0->getType(); llvm::Type *EltTy = Ty->getScalarType(); - Constant *One = - Ty->isVectorTy() - ? ConstantVector::getSplat( - ElementCount::getFixed( - dyn_cast(Ty)->getNumElements()), - ConstantFP::get(EltTy, 1.0)) - : ConstantFP::get(EltTy, 1.0); + Constant *One = Ty->isVectorTy() + ? ConstantVector::getSplat( + ElementCount::getFixed( + cast(Ty)->getNumElements()), + ConstantFP::get(EltTy, 1.0)) + : ConstantFP::get(EltTy, 1.0); return Builder.CreateFDiv(One, Op0, "hlsl.rcp"); } case Builtin::BI__builtin_hlsl_elementwise_rsqrt: {