Skip to content

[LLVM->SPIRV] Fix untyped pointer const GEP source type#3616

Open
wenju-he wants to merge 2 commits intoKhronosGroup:mainfrom
wenju-he:fix-untyped-pointer-Constant-GEP-type
Open

[LLVM->SPIRV] Fix untyped pointer const GEP source type#3616
wenju-he wants to merge 2 commits intoKhronosGroup:mainfrom
wenju-he:fix-untyped-pointer-Constant-GEP-type

Conversation

@wenju-he
Copy link
Contributor

@wenju-he wenju-he commented Mar 3, 2026

Always emit the GEPOperator's source element type as the base type for untyped access chains so that SPV_KHR_untyped_pointers round-trips keep the original i8 indexing semantics.

Drop the Scavenger-based TypedPointerType lookup, which could disagree with the GEP source type (e.g., when the pointer operand is declared as [2 x i32]) and is redundant because we already compute the expected pointer type from the GEP itself.

This PR addresses a similar issue to 1be9366, but specifically
handling the logic path when SPV_KHR_untyped_pointers is active.

The test has constant ugly GEP
https://llvm.org/docs/GetElementPtr.html#what-s-an-uglygep

wenju-he and others added 2 commits March 3, 2026 08:19
Always emit the GEPOperator's source element type as the base type for
untyped access chains so that SPV_KHR_untyped_pointers round-trips keep
the original i8 indexing semantics.

Drop the Scavenger-based TypedPointerType lookup, which could disagree
with the GEP source type (e.g., when the pointer operand is declared as
[2 x i32]) and is redundant because we already compute the expected
pointer type from the GEP itself.

Co-authored-by: GitHub Copilot <copilot@github.com>
@wenju-he wenju-he changed the title Fix untyped pointer const GEP source type [LLVM->SPIRV] Fix untyped pointer const GEP source type Mar 3, 2026
@wenju-he
Copy link
Contributor Author

@jcranmer-intel could you please review, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant