diff options
author | Joseph Tremoulet <jotrem@microsoft.com> | 2016-09-20 16:09:32 -0400 |
---|---|---|
committer | Joseph Tremoulet <jotrem@microsoft.com> | 2016-09-20 17:28:39 -0400 |
commit | 0aebfbef08a28b28dbf687d7f49cbc8369ea441a (patch) | |
tree | e849944750d11d2824f277817224757cfaec2c48 /src | |
parent | a4bdd3b33762d07be30f207eb66be934ccd2ffb4 (diff) | |
download | coreclr-0aebfbef08a28b28dbf687d7f49cbc8369ea441a.tar.gz coreclr-0aebfbef08a28b28dbf687d7f49cbc8369ea441a.tar.bz2 coreclr-0aebfbef08a28b28dbf687d7f49cbc8369ea441a.zip |
Respect JitNoRangeChks flag in RyuJit
Honor this config flag by having assertion prop treat all bounds check
nodes as redundant when it is set.
Also change the flag's lookup options to `REGUTIL_default` to match the
rest of the jit-focused flags.
Note that support for this flag is conditional on having the preprocessor
flag `FEATURE_ENABLE_NO_RANGE_CHECKS` defined, which requires a custom
build with line 199 of inc/switches.h un-commented (or with compile flags
altered to include `-DFEATURE_ENABLE_NO_RANGE_CHECKS`) -- the purpose of
the flag is to facilitate experiments to estimate the cumulative cost of
bounds checking in various workloads.
Diffstat (limited to 'src')
-rw-r--r-- | src/inc/clrconfigvalues.h | 2 | ||||
-rw-r--r-- | src/jit/assertionprop.cpp | 15 | ||||
-rw-r--r-- | src/jit/jitconfig.h | 2 | ||||
-rw-r--r-- | src/jit/jitconfigvalues.h | 3 |
4 files changed, 21 insertions, 1 deletions
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index 9cf1c50d64..1bd04197f5 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -493,7 +493,7 @@ CONFIG_DWORD_INFO_EX(INTERNAL_JitNoStructPromotion, W("JitNoStructPromotion"), 0 CONFIG_DWORD_INFO_EX(INTERNAL_JitNoUnroll, W("JitNoUnroll"), 0, "", CLRConfig::REGUTIL_default) CONFIG_DWORD_INFO_EX(INTERNAL_JitNoMemoryBarriers, W("JitNoMemoryBarriers"), 0, "If 1, don't generate memory barriers", CLRConfig::REGUTIL_default) #ifdef FEATURE_ENABLE_NO_RANGE_CHECKS -RETAIL_CONFIG_DWORD_INFO(PRIVATE_JitNoRangeChks, W("JitNoRngChks"), 0, "If 1, don't generate range checks") +RETAIL_CONFIG_DWORD_INFO_EX(PRIVATE_JitNoRangeChks, W("JitNoRngChks"), 0, "If 1, don't generate range checks", CLRConfig::REGUTIL_default) #endif RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_JitOptimizeType, W("JitOptimizeType"), "") CONFIG_DWORD_INFO_EX(INTERNAL_JitOrder, W("JitOrder"), 0, "", CLRConfig::REGUTIL_default) diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp index fe35c3b780..8a53278daf 100644 --- a/src/jit/assertionprop.cpp +++ b/src/jit/assertionprop.cpp @@ -3700,6 +3700,21 @@ GenTreePtr Compiler::optAssertionProp_BndsChk(ASSERT_VALARG_TP assertions, const assert(tree->gtOper == GT_ARR_BOUNDS_CHECK); +#ifdef FEATURE_ENABLE_NO_RANGE_CHECKS + if (JitConfig.JitNoRangeChks()) + { +#ifdef DEBUG + if (verbose) + { + printf("\nFlagging check redundant due to JitNoRangeChks in BB%02u:\n", compCurBB->bbNum); + gtDispTree(tree, nullptr, nullptr, true); + } +#endif // DEBUG + tree->gtFlags |= GTF_ARR_BOUND_INBND; + return nullptr; + } +#endif // FEATURE_ENABLE_NO_RANGE_CHECKS + BitVecOps::Iter iter(apTraits, assertions); unsigned index = 0; while (iter.NextElem(apTraits, &index)) diff --git a/src/jit/jitconfig.h b/src/jit/jitconfig.h index d5b4e30796..9186e12982 100644 --- a/src/jit/jitconfig.h +++ b/src/jit/jitconfig.h @@ -5,6 +5,8 @@ #ifndef _JITCONFIG_H_ #define _JITCONFIG_H_ +#include "switches.h" + struct CORINFO_SIG_INFO; class ICorJitHost; diff --git a/src/jit/jitconfigvalues.h b/src/jit/jitconfigvalues.h index 497d677375..d03a31f305 100644 --- a/src/jit/jitconfigvalues.h +++ b/src/jit/jitconfigvalues.h @@ -92,6 +92,9 @@ CONFIG_INTEGER(JitNoMemoryBarriers, W("JitNoMemoryBarriers"), 0) // If 1, don't CONFIG_INTEGER(JitNoRegLoc, W("JitNoRegLoc"), 0) CONFIG_INTEGER(JitNoStructPromotion, W("JitNoStructPromotion"), 0) // Disables struct promotion in Jit32 CONFIG_INTEGER(JitNoUnroll, W("JitNoUnroll"), 0) +#ifdef FEATURE_ENABLE_NO_RANGE_CHECKS +CONFIG_INTEGER(JitNoRangeChks, W("JitNoRngChks"), 0) // If 1, don't generate range checks +#endif CONFIG_INTEGER(JitOrder, W("JitOrder"), 0) CONFIG_INTEGER(JitPInvokeCheckEnabled, W("JITPInvokeCheckEnabled"), 0) CONFIG_INTEGER(JitPInvokeEnabled, W("JITPInvokeEnabled"), 1) |