Commit 5faeeecc authored by Jurek, Pawel's avatar Jurek, Pawel Committed by gbsbuild

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
parent 540f5c9a
......@@ -332,10 +332,10 @@ void FindInterestingConstants::copyInterestingConstants(ContextT* pShaderCtx)
bool FindInterestingConstants::doFinalization(llvm::Module &M)
{
CodeGenContext* ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
if (m_InterestingConstants.size() != 0)
{
CodeGenContext* ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
if (ctx->type == ShaderType::PIXEL_SHADER)
{
PixelShaderContext* pShaderCtx = static_cast <PixelShaderContext*>(ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment