aboutsummaryrefslogtreecommitdiff
path: root/source/opt/constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/opt/constants.cpp')
-rw-r--r--source/opt/constants.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/opt/constants.cpp b/source/opt/constants.cpp
index a3dac5d7..020e248b 100644
--- a/source/opt/constants.cpp
+++ b/source/opt/constants.cpp
@@ -217,7 +217,8 @@ Instruction* ConstantManager::BuildInstructionAndAddToModule(
auto* new_inst_ptr = new_inst.get();
*pos = pos->InsertBefore(std::move(new_inst));
++(*pos);
- context()->get_def_use_mgr()->AnalyzeInstDefUse(new_inst_ptr);
+ if (context()->AreAnalysesValid(IRContext::Analysis::kAnalysisDefUse))
+ context()->get_def_use_mgr()->AnalyzeInstDefUse(new_inst_ptr);
MapConstantToInst(new_const, new_inst_ptr);
return new_inst_ptr;
}