From c4792a228ea36792b90f87ddf7fce2477e827822 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Sat, 7 Sep 2024 09:00:52 -0700 Subject: [PATCH] JIT: don't create vector constants from relocatable constants (#107491) We can't represent relocations in data currently. Fixes #107396. --- src/coreclr/jit/lower.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index f8bc800241491..d92895a9d4980 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -8962,12 +8962,22 @@ void Lowering::LowerStoreIndirCoalescing(GenTreeIndir* ind) assert(prevData.IsStore()); assert(currData.IsStore()); - // For now, only constants are supported for data. + // For now, only non-relocatable constants are supported for data. if (!prevData.value->OperIsConst() || !currData.value->OperIsConst()) { return; } + if (prevData.value->IsCnsIntOrI() && prevData.value->AsIntCon()->ImmedValNeedsReloc(comp)) + { + return; + } + + if (currData.value->IsCnsIntOrI() && currData.value->AsIntCon()->ImmedValNeedsReloc(comp)) + { + return; + } + // Otherwise, the difference between two offsets has to match the size of the type. // We don't support overlapping stores. if (abs(prevData.offset - currData.offset) != (int)genTypeSize(prevData.targetType))