specializer: allow unused fully-constrained interface variables. #729
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.
Fixes #723.
For a bit of background, this is what happens for e.g. an
Input
interface variablex: f32
, during inference/specialization ofOpTypePointer
by storage class:We're in a weird situation, where
%x
is fully determined to always be%x<Input>
, because of the typing rule ofOpVariable S: (OpTypePointer S _)
(i.e. the redundancy of the storage class), but it still started out as "generic", and its type is an application of a "generic", so we have to treat it as such for consistency.This isn't normally a problem, as any use of
%x
will be forced to instantiate%x<Input>
, and so theOpEntryPoint
will rely on that instance to replace its use of%x
with%x<Input>
.However, if
%x
happens to be unused in the actual entry-point function, we would've panicked, before this PR, as theOpEntryPoint
couldn't use any existing instances.This PR works around that by "simply" instantiating any interface variables listed in
OpEntryPoint
, that have all of their "storage class parameters" fully constrained to concrete storage classes (and therefore require no inference/specialization).