Skip to content

Commit 5893f70

Browse files
committed
Update check-cppcheck-llpc.yml to ubuntu 24.04 and fix static check error.
1 parent 1d04cdc commit 5893f70

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

.github/workflows/check-cppcheck-llpc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
cppcheck:
88
name: cppcheck
9-
runs-on: "ubuntu-20.04"
9+
runs-on: "ubuntu-24.04"
1010
steps:
1111
- name: Setup environment
1212
run: |
@@ -19,5 +19,5 @@ jobs:
1919
git submodule update --init
2020
- name: Run cppcheck
2121
run: |
22-
cppcheck -q -j$(( $(nproc) * 4 )) --error-exitcode=1 --std=c++17 --inline-suppr . -i llpc/tool/amdllpc.cpp \
23-
-I imported/llvm-dialects/include
22+
cppcheck -q -j$(( $(nproc) * 4 )) --error-exitcode=1 --std=c++20 --inline-suppr . \
23+
-I imported/llvm-dialects/include -i imported -i llpc/unittests -i llvmraytracing

lgc/builder/MatrixBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ Value *BuilderImpl::CreateMatrixTimesVector(Value *const matrix, Value *const ve
151151
else
152152
result = partialResult;
153153
}
154-
155-
result->setName(instName);
154+
if (result)
155+
result->setName(instName);
156156
return result;
157157
}
158158

lgc/patch/LowerInvariantLoads.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ PreservedAnalyses LowerInvariantLoads::run(Function &function, FunctionAnalysisM
117117

118118
LLVM_DEBUG(dbgs() << (clearInvariants ? "Removing invariant load flags"
119119
: "Attempting aggressive invariant load optimization")
120-
<< "\n";);
120+
<< "\n");
121121

122122
// This mirrors AMDGPUAliasAnalysis
123123
static const unsigned aliasMatrix[] = {

llpc/context/llpcCompiler.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,9 +2459,10 @@ Result Compiler::BuildGraphicsPipeline(const GraphicsPipelineBuildInfo *pipeline
24592459

24602460
if (!cacheAccessor || !cacheAccessor->isInCache()) {
24612461
LLPC_OUTS("Cache miss for graphics pipeline.\n");
2462-
GraphicsContext graphicsContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash);
2463-
result = buildGraphicsPipelineInternal(&graphicsContext, shaderInfo, buildUsingRelocatableElf, &candidateElf,
2462+
GraphicsContext *graphicsContext = new GraphicsContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash);
2463+
result = buildGraphicsPipelineInternal(graphicsContext, shaderInfo, buildUsingRelocatableElf, &candidateElf,
24642464
pipelineOut->stageCacheAccesses);
2465+
delete graphicsContext;
24652466

24662467
if (result == Result::Success) {
24672468
elfBin.codeSize = candidateElf.size();
@@ -2588,9 +2589,10 @@ Result Compiler::BuildComputePipeline(const ComputePipelineBuildInfo *pipelineIn
25882589
ElfPackage candidateElf;
25892590
if (!cacheAccessor || !cacheAccessor->isInCache()) {
25902591
LLPC_OUTS("Cache miss for compute pipeline.\n");
2591-
ComputeContext computeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash);
2592-
result = buildComputePipelineInternal(&computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf,
2592+
ComputeContext *computeContext = new ComputeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash);
2593+
result = buildComputePipelineInternal(computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf,
25932594
&pipelineOut->stageCacheAccess);
2595+
delete computeContext;
25942596

25952597
if (cacheAccessor && pipelineOut->pipelineCacheAccess == CacheAccessInfo::CacheNotChecked)
25962598
pipelineOut->pipelineCacheAccess = CacheAccessInfo::CacheMiss;

0 commit comments

Comments
 (0)