Skip to content

Commit 5faeeec

Browse files
PawelJurekgfxbot
authored andcommitted
Call getAnalysis in doFinalization only if it is needed.
There is a corner case: when we compile a file that has no kernels in it, the analysis is not added to the manager and we can't use it. This could result in a crash Change-Id: Ia48c276277b35ff0072f4763cb93fe67b586d24d
1 parent 540f5c9 commit 5faeeec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

IGC/Compiler/FindInterestingConstants.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ void FindInterestingConstants::copyInterestingConstants(ContextT* pShaderCtx)
332332

333333
bool FindInterestingConstants::doFinalization(llvm::Module &M)
334334
{
335-
CodeGenContext* ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
336-
337335
if (m_InterestingConstants.size() != 0)
338336
{
337+
CodeGenContext* ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
338+
339339
if (ctx->type == ShaderType::PIXEL_SHADER)
340340
{
341341
PixelShaderContext* pShaderCtx = static_cast <PixelShaderContext*>(ctx);

0 commit comments

Comments
 (0)