From 8f21f4c2866b6297c51ab03caad851e9185828f1 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 16 Jan 2020 12:01:55 -0800 Subject: [PATCH 1/3] JIT: check that constant handles are not OK2_CONST_LONGs Follow-up from #1788. Also remove an arm-only handle block that should now be redundant. --- src/coreclr/src/jit/assertionprop.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/coreclr/src/jit/assertionprop.cpp b/src/coreclr/src/jit/assertionprop.cpp index 6e88e2e23bf478..51b1fc07b1b782 100644 --- a/src/coreclr/src/jit/assertionprop.cpp +++ b/src/coreclr/src/jit/assertionprop.cpp @@ -1081,11 +1081,6 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1, if (op2->gtOper == GT_CNS_INT) { #ifdef _TARGET_ARM_ - // Do not Constant-Prop immediate values that require relocation - if (op2->AsIntCon()->ImmedValNeedsReloc(this)) - { - goto DONE_ASSERTION; - } // Do not Constant-Prop large constants for ARM // TODO-CrossBitness: we wouldn't need the cast below if GenTreeIntCon::gtIconVal had // target_ssize_t type. @@ -1643,6 +1638,13 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion) } break; + case O2K_CONST_LONG: + { + // All handles should be represented by O2K_CONST_INT, + // so no handle bits should be set here. + assert((assertion->op2.u1.iconFlags & GTF_ICON_HDL_MASK) == 0); + } + default: // for all other 'assertion->op2.kind' values we don't check anything break; From bee5b39ffaa0fa192eadb5febc72d87d5ff6e08a Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 16 Jan 2020 16:56:20 -0800 Subject: [PATCH 2/3] add padding to IntVal --- src/coreclr/src/jit/compiler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/src/jit/compiler.h b/src/coreclr/src/jit/compiler.h index 23c692e1ffdd9f..bc99a774da9a16 100644 --- a/src/coreclr/src/jit/compiler.h +++ b/src/coreclr/src/jit/compiler.h @@ -6482,6 +6482,7 @@ class Compiler struct IntVal { ssize_t iconVal; // integer + unsigned padding; // unused; ensures iconFlags does not overlap lconVal unsigned iconFlags; // gtFlags }; struct Range // integer subrange From 5cfe9d2f4cc3e9555e2145351e94e3c86895150a Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Fri, 17 Jan 2020 11:16:46 -0800 Subject: [PATCH 3/3] review feedback --- src/coreclr/src/jit/assertionprop.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/src/jit/assertionprop.cpp b/src/coreclr/src/jit/assertionprop.cpp index 51b1fc07b1b782..854139c79979ca 100644 --- a/src/coreclr/src/jit/assertionprop.cpp +++ b/src/coreclr/src/jit/assertionprop.cpp @@ -1644,6 +1644,7 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion) // so no handle bits should be set here. assert((assertion->op2.u1.iconFlags & GTF_ICON_HDL_MASK) == 0); } + break; default: // for all other 'assertion->op2.kind' values we don't check anything