From 1873e38adc1c94a831203e608b6f137264c12f8e Mon Sep 17 00:00:00 2001 From: qiaojbao Date: Fri, 20 Dec 2024 16:04:38 +0800 Subject: [PATCH] Fix static check error on ubuntu22.04 --- lgc/builder/MatrixBuilder.cpp | 4 ++-- lgc/patch/LowerInvariantLoads.cpp | 2 +- llpc/context/llpcCompiler.cpp | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lgc/builder/MatrixBuilder.cpp b/lgc/builder/MatrixBuilder.cpp index 742f3ec9ea..555bbc0063 100644 --- a/lgc/builder/MatrixBuilder.cpp +++ b/lgc/builder/MatrixBuilder.cpp @@ -151,8 +151,8 @@ Value *BuilderImpl::CreateMatrixTimesVector(Value *const matrix, Value *const ve else result = partialResult; } - - result->setName(instName); + if (result) + result->setName(instName); return result; } diff --git a/lgc/patch/LowerInvariantLoads.cpp b/lgc/patch/LowerInvariantLoads.cpp index e8dfe23a4d..4ab3f3c05d 100644 --- a/lgc/patch/LowerInvariantLoads.cpp +++ b/lgc/patch/LowerInvariantLoads.cpp @@ -117,7 +117,7 @@ PreservedAnalyses LowerInvariantLoads::run(Function &function, FunctionAnalysisM LLVM_DEBUG(dbgs() << (clearInvariants ? "Removing invariant load flags" : "Attempting aggressive invariant load optimization") - << "\n";); + << "\n"); // This mirrors AMDGPUAliasAnalysis static const unsigned aliasMatrix[] = { diff --git a/llpc/context/llpcCompiler.cpp b/llpc/context/llpcCompiler.cpp index 8371aef8b7..a5811eee0f 100644 --- a/llpc/context/llpcCompiler.cpp +++ b/llpc/context/llpcCompiler.cpp @@ -2459,9 +2459,10 @@ Result Compiler::BuildGraphicsPipeline(const GraphicsPipelineBuildInfo *pipeline if (!cacheAccessor || !cacheAccessor->isInCache()) { LLPC_OUTS("Cache miss for graphics pipeline.\n"); - GraphicsContext graphicsContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); - result = buildGraphicsPipelineInternal(&graphicsContext, shaderInfo, buildUsingRelocatableElf, &candidateElf, + GraphicsContext *graphicsContext = new GraphicsContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); + result = buildGraphicsPipelineInternal(graphicsContext, shaderInfo, buildUsingRelocatableElf, &candidateElf, pipelineOut->stageCacheAccesses); + delete graphicsContext; if (result == Result::Success) { elfBin.codeSize = candidateElf.size(); @@ -2588,9 +2589,11 @@ Result Compiler::BuildComputePipeline(const ComputePipelineBuildInfo *pipelineIn ElfPackage candidateElf; if (!cacheAccessor || !cacheAccessor->isInCache()) { LLPC_OUTS("Cache miss for compute pipeline.\n"); - ComputeContext computeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); - result = buildComputePipelineInternal(&computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf, + ComputeContext *computeContext = + new ComputeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); + result = buildComputePipelineInternal(computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf, &pipelineOut->stageCacheAccess); + delete computeContext; if (cacheAccessor && pipelineOut->pipelineCacheAccess == CacheAccessInfo::CacheNotChecked) pipelineOut->pipelineCacheAccess = CacheAccessInfo::CacheMiss;