From a64c651e18aea8eb7e5558a68eda28411f4b4788 Mon Sep 17 00:00:00 2001 From: greg-lunarg Date: Mon, 21 Jan 2019 10:34:12 -0700 Subject: [PATCH] Fix Constants Analyses bug inserted by #2302 (#2306) Need to also remove Constants from the valid_analyses set when invalidated, otherwise Constants is not reinitialized before used. --- source/opt/ir_context.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/opt/ir_context.cpp b/source/opt/ir_context.cpp index a31349f45..61c5425d6 100644 --- a/source/opt/ir_context.cpp +++ b/source/opt/ir_context.cpp @@ -89,6 +89,11 @@ void IRContext::InvalidateAnalysesExceptFor( } void IRContext::InvalidateAnalyses(IRContext::Analysis analyses_to_invalidate) { + // The ConstantManager contains Type pointers. If the TypeManager goes + // away, the ConstantManager has to go away. + if (analyses_to_invalidate & kAnalysisTypes) { + analyses_to_invalidate |= kAnalysisConstants; + } if (analyses_to_invalidate & kAnalysisDefUse) { def_use_mgr_.reset(nullptr); } @@ -127,9 +132,6 @@ void IRContext::InvalidateAnalyses(IRContext::Analysis analyses_to_invalidate) { constant_mgr_.reset(nullptr); } if (analyses_to_invalidate & kAnalysisTypes) { - // The ConstantManager contains Type pointers. If the TypeManager goes - // away, the ConstantManager has to go away. - constant_mgr_.reset(nullptr); type_mgr_.reset(nullptr); }