This repository was archived by the owner on Oct 31, 2025. It is now read-only.
Always inline calls with "not obviously legal" pointer args (instead of the opposite).#1023
Merged
eddyb merged 4 commits intoEmbarkStudios:mainfrom Apr 4, 2023
LykenSol:inliner-positive-memobj
Merged
Always inline calls with "not obviously legal" pointer args (instead of the opposite).#1023eddyb merged 4 commits intoEmbarkStudios:mainfrom LykenSol:inliner-positive-memobj
eddyb merged 4 commits intoEmbarkStudios:mainfrom
LykenSol:inliner-positive-memobj
Conversation
|
This has been tested with the MRP + (SPIR-T HTML preview) that instigated #1021, and compiles it correctly. Anecdotally, it's also been tested with the practical case that consumes the cons borrowing trait which highlighted the bug, is functioning as expected there as well 👍 |
oisyn
approved these changes
Apr 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR, the behavior of the inliner wrt pointer types in
fnsignatures (and pointer args) was to special-case some illegal cases and force inlining. This PR flips some of that on its head, treating everything it's not sure about as illegal, forcing inlining in all the cases not explicitly deemed legal.Specifically for fixing #1021, the necessary change is obeying the SPIR-V spec about pointer call arguments having to be "memory object declarations" (i.e. an
OpVariable, or one of the caller's ownOpFunctionParameters, which transitively must be a wholeOpVariableetc.).With this PR, any pointer argument other than an
OpVariable(either global or in the caller) or anOpFunctionParameter, will force inlining (even if some of those edge cases may actually be legal, we'll still be correctly conservative).(The several commits should be reviewed separately, as the first 3 only refactor
linker::inline's existing logic)