Skip to content

Commit 4cd04fe

Browse files
mikerice1969yuxuanchen1997
authored andcommitted
[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
1 parent 83cb038 commit 4cd04fe

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18389,13 +18389,12 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
1838918389
llvm_unreachable("rcp operand must have a float representation");
1839018390
llvm::Type *Ty = Op0->getType();
1839118391
llvm::Type *EltTy = Ty->getScalarType();
18392-
Constant *One =
18393-
Ty->isVectorTy()
18394-
? ConstantVector::getSplat(
18395-
ElementCount::getFixed(
18396-
dyn_cast<FixedVectorType>(Ty)->getNumElements()),
18397-
ConstantFP::get(EltTy, 1.0))
18398-
: ConstantFP::get(EltTy, 1.0);
18392+
Constant *One = Ty->isVectorTy()
18393+
? ConstantVector::getSplat(
18394+
ElementCount::getFixed(
18395+
cast<FixedVectorType>(Ty)->getNumElements()),
18396+
ConstantFP::get(EltTy, 1.0))
18397+
: ConstantFP::get(EltTy, 1.0);
1839918398
return Builder.CreateFDiv(One, Op0, "hlsl.rcp");
1840018399
}
1840118400
case Builtin::BI__builtin_hlsl_elementwise_rsqrt: {

0 commit comments

Comments
 (0)