[llvm] 0805e40 - AMDGPUPrintfRuntimeBinding - don't dereference a dyn_cast<> pointer. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 04:43:08 PST 2021
Author: Simon Pilgrim
Date: 2021-01-28T12:38:44Z
New Revision: 0805e40a94d79e22d62f53bc308e0c27772bae44
URL: https://github.com/llvm/llvm-project/commit/0805e40a94d79e22d62f53bc308e0c27772bae44
DIFF: https://github.com/llvm/llvm-project/commit/0805e40a94d79e22d62f53bc308e0c27772bae44.diff
LOG: AMDGPUPrintfRuntimeBinding - don't dereference a dyn_cast<> pointer. NFCI.
We dereference the dyn_cast<> in all paths - use cast<> to silence the clang static analyzer warning.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
index c8bd9b96b44f..1c740aec7a42 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
@@ -356,8 +356,7 @@ bool AMDGPUPrintfRuntimeBindingImpl::lowerPrintfForGpu(Module &M) {
//
ConstantPointerNull *zeroIntPtr =
ConstantPointerNull::get(PointerType::get(Type::getInt8Ty(Ctx), 1));
- ICmpInst *cmp =
- dyn_cast<ICmpInst>(Builder.CreateICmpNE(pcall, zeroIntPtr, ""));
+ auto *cmp = cast<ICmpInst>(Builder.CreateICmpNE(pcall, zeroIntPtr, ""));
if (!CI->use_empty()) {
Value *result =
Builder.CreateSExt(Builder.CreateNot(cmp), I32Ty, "printf_res");
More information about the llvm-commits
mailing list