Skip to content

Arm64-SVE: Support unknown size accesses in IsContainableLclAddr - #135665

Merged
dhartglassMSFT merged 5 commits into
dotnet:mainfrom
snickolls-arm:lcladdr-containment
Nov 11, 2026
Merged

dhartglassMSFT merged 5 commits into
dotnet:mainfrom
snickolls-arm:lcladdr-containment

Conversation

@snickolls-arm

Copy link
Copy Markdown
Contributor

A LCL_ADDR node can be contained by an indirection if the access is not wide. Therefore the definition can be forwarded to straight to IsWideAccess, with the added benefit that this will handle sizes that are unknown at compile time.

A LCL_ADDR node can be contained by an indirection if the access is
not wide. Therefore the definition can be forwarded to straight to
IsWideAccess, with the added benefit that this will handle sizes that
are unknown at compile time.
@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 Oct 13, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 13, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@snickolls-arm

Copy link
Copy Markdown
Contributor Author

@dhartglassMSFT @dotnet/arm64-contrib

@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.

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor

cc: @dhartglassMSFT

@SwapnilGaikwad SwapnilGaikwad mentioned this pull request Oct 26, 2026
2 of 27 tasks
@snickolls-arm

Copy link
Copy Markdown
Contributor Author

The test I've added seems to assert on Mono:

04:58:40.374 Running test: JIT/opt/ValueNumbering/LocalAddressContainment/LocalAddressContainment.dll
* Assertion at /Users/runner/work/1/s/src/mono/mono/mini/interp/transform.c:8797, condition `i32 < G_MAXUINT16' not met

src/mono/mono/mini/interp/transform.c:8797

			case CEE_INITOBJ:
				CHECK_STACK(td, 1);
				token = read32 (td->ip + 1);
				klass = mini_get_class (method, token, generic_context);
				CHECK_TYPELOAD (klass);
				if (m_class_is_valuetype (klass)) {
					--td->sp;
					interp_add_ins (td, MINT_ZEROBLK_IMM);
					interp_ins_set_sreg (td->last_ins, td->sp [0].var);
					i32 = mono_class_value_size (klass, NULL);
					g_assert (i32 < G_MAXUINT16);
					td->last_ins->data [0] = GINT_TO_UINT16 (i32);

Is the assertion off-by-one? If the maximum offset into a class is strictly less than UINT16_MAX then it suggests the class size can be at most UINT16_MAX.

@dhartglassMSFT

Copy link
Copy Markdown
Contributor

The test I've added seems to assert on Mono:

04:58:40.374 Running test: JIT/opt/ValueNumbering/LocalAddressContainment/LocalAddressContainment.dll
* Assertion at /Users/runner/work/1/s/src/mono/mono/mini/interp/transform.c:8797, condition `i32 < G_MAXUINT16' not met

src/mono/mono/mini/interp/transform.c:8797

			case CEE_INITOBJ:
				CHECK_STACK(td, 1);
				token = read32 (td->ip + 1);
				klass = mini_get_class (method, token, generic_context);
				CHECK_TYPELOAD (klass);
				if (m_class_is_valuetype (klass)) {
					--td->sp;
					interp_add_ins (td, MINT_ZEROBLK_IMM);
					interp_ins_set_sreg (td->last_ins, td->sp [0].var);
					i32 = mono_class_value_size (klass, NULL);
					g_assert (i32 < G_MAXUINT16);
					td->last_ins->data [0] = GINT_TO_UINT16 (i32);

Is the assertion off-by-one? If the maximum offset into a class is strictly less than UINT16_MAX then it suggests the class size can be at most UINT16_MAX.

I wouldn't worry too much, hitting mono bugs like this is not too unusual.

Normally we create an active issue, then disable that test on Mono.

Example of a recent disabling:
#133936

Issue:
#133910

So before merging you can just open an issue similar to 133910, with area-Infrastructure-mono and disabled-test, then disable the test against that issue.

(The < vs <= might be moot anyway, is the init size 65536B? Which would be beyon UINT16_MAX anyway)

@snickolls-arm

Copy link
Copy Markdown
Contributor Author

The test I've added seems to assert on Mono:

04:58:40.374 Running test: JIT/opt/ValueNumbering/LocalAddressContainment/LocalAddressContainment.dll
* Assertion at /Users/runner/work/1/s/src/mono/mono/mini/interp/transform.c:8797, condition `i32 < G_MAXUINT16' not met

src/mono/mono/mini/interp/transform.c:8797

			case CEE_INITOBJ:
				CHECK_STACK(td, 1);
				token = read32 (td->ip + 1);
				klass = mini_get_class (method, token, generic_context);
				CHECK_TYPELOAD (klass);
				if (m_class_is_valuetype (klass)) {
					--td->sp;
					interp_add_ins (td, MINT_ZEROBLK_IMM);
					interp_ins_set_sreg (td->last_ins, td->sp [0].var);
					i32 = mono_class_value_size (klass, NULL);
					g_assert (i32 < G_MAXUINT16);
					td->last_ins->data [0] = GINT_TO_UINT16 (i32);

Is the assertion off-by-one? If the maximum offset into a class is strictly less than UINT16_MAX then it suggests the class size can be at most UINT16_MAX.

I wouldn't worry too much, hitting mono bugs like this is not too unusual.

Normally we create an active issue, then disable that test on Mono.

Example of a recent disabling: #133936

Issue: #133910

So before merging you can just open an issue similar to 133910, with area-Infrastructure-mono and disabled-test, then disable the test against that issue.

(The < vs <= might be moot anyway, is the init size 65536B? Which would be beyon UINT16_MAX anyway)

I've added #137359 for this. I'm not able to label issues myself at the moment, please could you add them?

@dhartglassMSFT
dhartglassMSFT enabled auto-merge (squash) November 11, 2026 22:09
@dhartglassMSFT
dhartglassMSFT merged commit 505fda7 into dotnet:main Nov 11, 2026
126 of 134 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 12, 2026
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 arm-sve Work related to arm64 SVE/SVE2 support community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants