[AMDGPU] Coverity fixes - check ret val and init class members#198570
Merged
Conversation
|
@llvm/pr-subscribers-backend-amdgpu Author: Rafał Rudnicki (bratpiorka) ChangesCoverity fixes Full diff: https://github.com/llvm/llvm-project/pull/198570.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
index 6bf70686f5569..b2aed7c5d12c3 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
@@ -279,9 +279,10 @@ simplifyAMDGCNImageIntrinsic(const GCNSubtarget *ST,
// Obtain the original image sample intrinsic's signature
// and replace its return type with the half-vector for D16 folding
SmallVector<Type *, 8> SigTys;
- Intrinsic::getIntrinsicSignature(II.getCalledFunction(), SigTys);
- SigTys[0] = HalfVecTy;
+ if (!Intrinsic::getIntrinsicSignature(II.getCalledFunction(), SigTys))
+ return std::nullopt;
+ SigTys[0] = HalfVecTy;
Module *M = II.getModule();
Function *HalfDecl =
Intrinsic::getOrInsertDeclaration(M, ImageDimIntr->Intr, SigTys);
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index c55796c37f287..c53e4a8a6313e 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -296,7 +296,7 @@ class GCNRPTarget {
GCNRPTarget(const GCNRegPressure &RP, const MachineFunction &MF)
: MF(MF), UnifiedRF(MF.getSubtarget<GCNSubtarget>().hasGFX90AInsts()),
- RP(RP) {}
+ RP(RP), MaxSGPRs(0), MaxVGPRs(0), MaxUnifiedVGPRs(0) {}
};
///////////////////////////////////////////////////////////////////////////////
|
Contributor
|
can you be more specific in the title and description? |
bfd62f4 to
ba3b338
Compare
Contributor
Author
|
@shiltian done |
shiltian
reviewed
May 19, 2026
|
|
||
| GCNRPTarget(const GCNRegPressure &RP, const MachineFunction &MF) | ||
| : MF(MF), UnifiedRF(MF.getSubtarget<GCNSubtarget>().hasGFX90AInsts()), | ||
| RP(RP) {} |
Contributor
There was a problem hiding this comment.
nit: I'd prefer this to be something like:
/// Target number of SGPRs.
unsigned MaxSGPRs = 0;
/// Target number of ArchVGPRs and AGPRs.
unsigned MaxVGPRs = 0;
/// Target number of overall VGPRs for subtargets with unified RFs. Always 0
/// for subtargets with non-unified RFs.
unsigned MaxUnifiedVGPRs = 0;
ba3b338 to
0ae9f8d
Compare
Contributor
Author
|
@shiltian ok, done |
Contributor
Author
|
@shiltian all tests passed - please merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coverity fixes: