-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dead code elimination #68
Comments
I think it's reasonable to strip that code and expect no errors. But I think it's also reasonable to throw an error here. The eliminated code is arguably incorrect (both dead code elimination:
So IMO DCE should be an optional feature of the linker, which may have side-effects when the code is incorrect. I'm adding that it is possible for a linker or langserver to check that all condition combinations lead to valid code (at least that the referenced identifiers are declared), which mitigates the downside of DCE. |
Leaving DCE as linker now sounds good. Once the practical issues become clear, I suspect we'll want to pick a side on DCE for consistency / shader library compatibility... but maybe not and DCE stays implementation defined forever. I'll leave this issue open for now while we learn more. |
(I don't think this is urgent for M1, but wanted to save the issue for later discussion.)
A couple of arguments for eventually spec'ing that dead code should be removed:
const_assert
statements (and cause unexpected failures when the linked result is passed to naga/tint)Here's an example of the second untested conditions case.
foo
imports something unrelated fromutil
, but that leads to a set of untested conditions which would fail to compile in naga/tint:The text was updated successfully, but these errors were encountered: