Author: Simon Pilgrim Date: 2022-01-12T15:35:37Z New Revision: 497a4b26c487a9640847c485f9b0c36c110a8545
URL: https://github.com/llvm/llvm-project/commit/497a4b26c487a9640847c485f9b0c36c110a8545 DIFF: https://github.com/llvm/llvm-project/commit/497a4b26c487a9640847c485f9b0c36c110a8545.diff LOG: CGBuiltin - Use castAs<> instead of getAs<> to avoid dereference of nullptr The pointer is always dereferenced immediately below, so assert the cast is correct instead of returning nullptr Added: Modified: clang/lib/CodeGen/CGBuiltin.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index e9dd41a7daa1..91284baf123a 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -3223,7 +3223,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, *this, E, llvm::Intrinsic::vector_reduce_xor, "rdx.xor")); case Builtin::BI__builtin_matrix_transpose: { - const auto *MatrixTy = E->getArg(0)->getType()->getAs<ConstantMatrixType>(); + auto *MatrixTy = E->getArg(0)->getType()->castAs<ConstantMatrixType>(); Value *MatValue = EmitScalarExpr(E->getArg(0)); MatrixBuilder<CGBuilderTy> MB(Builder); Value *Result = MB.CreateMatrixTranspose(MatValue, MatrixTy->getNumRows(), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits