Skip to content

Fix for 130437#130534

Draft
dhartglassMSFT wants to merge 1 commit into
dotnet:mainfrom
dhartglassMSFT:fix_130437
Draft

Fix for 130437#130534
dhartglassMSFT wants to merge 1 commit into
dotnet:mainfrom
dhartglassMSFT:fix_130437

Conversation

@dhartglassMSFT

Copy link
Copy Markdown
Contributor

Assertion failed 'isGeneralRegister(reg3)' in jitstress-random.

STRESS_SPLIT_TREES_RANDOMLY forced both a mask and a 4096b struct into locals that get spilled.

Hit assertion when we try to spill the mask to [SP+4120]. 4120 isn't encodable for a predicate store, so we need instGen_Set_Reg_To_Base_Plus_Imm. This tried to create an add where SP was the last operand - this is not allowed to be encoded.

Fix to swap the order of the operands on the add. We get this now:

IN001d:             mov     xip1, #0x1018
IN001e:             add     xip1, sp, xip1
IN001f:             str     p0, [xip1]	// [V33 rat0]

Copilot AI review requested due to automatic review settings July 10, 2026 23:16
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 10, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts ARM64 JIT codegen for the “base + large imm” address materialization helper so the generated add is encodable when the base register is SP (which cannot appear as the third operand in the register form of add).

Changes:

  • Swap the operand order of the register-form add in instGen_Set_Reg_To_Base_Plus_Imm so SP (when used) is placed in the encodable operand position.
  • Add an explanatory comment about the SP operand restriction for the encoding.

Comment on lines 2163 to 2167
instGen_Set_Reg_To_Imm(size, dstReg, imm);
GetEmitter()->emitIns_R_R_R(INS_add, size, dstReg, dstReg, baseReg);
// baseReg might be SP, which must be reg2
// an "add R0, R1, SP" is not encodable
GetEmitter()->emitIns_R_R_R(INS_add, size, dstReg, baseReg, dstReg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants