diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-05-11 20:35:31 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-05-11 20:35:31 +0800 |
commit | 1345b89c88d32fed62df16e492e18bcf7ded477c (patch) | |
tree | 6a98cdf15b2b0a45d62084107560ff32c7d91c5d /src/hir_conv/constant_evaluation.cpp | |
parent | 20ecad6f1d3b70b199486876dc804c4850cf5fdb (diff) | |
download | mrust-1345b89c88d32fed62df16e492e18bcf7ded477c.tar.gz |
HIR Const Eval - Use cached monomorphsed values in consteval, evaluate in reverse
Diffstat (limited to 'src/hir_conv/constant_evaluation.cpp')
-rw-r--r-- | src/hir_conv/constant_evaluation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hir_conv/constant_evaluation.cpp b/src/hir_conv/constant_evaluation.cpp index 0ccb6e6f..22909cdc 100644 --- a/src/hir_conv/constant_evaluation.cpp +++ b/src/hir_conv/constant_evaluation.cpp @@ -414,6 +414,12 @@ namespace HIR { //check_lit_type(item.m_value->span(), item.m_type, item.m_value_res); } + auto it = c.m_monomorph_cache.find(*e2.p); + if( it != c.m_monomorph_cache.end() ) + { + MIR_ASSERT(state, !it->second.is_Defer(), "Cached literal for " << *e2.p << " is Defer"); + return clone_literal( it->second ); + } return clone_literal( c.m_value_res ); } TU_ARM(c, ItemAddr, e2) |