[webkit-changes] [WebKit/WebKit] 353252: [WGSL] Don't serialize unused constants
Tadeu Zagallo
noreply at github.com
Wed May 31 07:46:24 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 353252b02ec1e00a79bc45466ae67bc8c619077c
https://github.com/WebKit/WebKit/commit/353252b02ec1e00a79bc45466ae67bc8c619077c
Author: Tadeu Zagallo <tzagallo at apple.com>
Date: 2023-05-31 (Wed, 31 May 2023)
Changed paths:
M Source/WebGPU/WGSL/AST/ASTVariable.h
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
A Source/WebGPU/WGSL/tests/valid/local-constant-trivial.wgsl
Log Message:
-----------
[WGSL] Don't serialize unused constants
https://bugs.webkit.org/show_bug.cgi?id=257494
rdar://110009934
Reviewed by Dan Glastonbury.
If all references to a constant are replaced with its value, we should no longer serialize
the constant declaration in the generated code. In order to do that, while looking at
variable uses and definitions to rewrite globals, we changen all consts which still
have uses into lets, and later in the code generation we simply skip over consts.
* Source/WebGPU/WGSL/AST/ASTVariable.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::def):
(WGSL::RewriteGlobalVariables::read):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::serializeVariable):
* Source/WebGPU/WGSL/tests/valid/local-constant-trivial.wgsl: Added.
Canonical link: https://commits.webkit.org/264732@main
More information about the webkit-changes
mailing list