Bug 200525 - [WHLSL] Trivial clean-up of the MSL code generated
Summary: [WHLSL] Trivial clean-up of the MSL code generated
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Robin Morisset
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-07 17:39 PDT by Robin Morisset
Modified: 2019-08-21 10:46 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.79 KB, patch)
2019-08-07 17:42 PDT, Robin Morisset
darin: review+
Details | Formatted Diff | Diff
Patch for landing (2.78 KB, patch)
2019-08-13 11:50 PDT, Robin Morisset
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Morisset 2019-08-07 17:39:41 PDT
We emit some redundant '{}' around function bodies (we emit them both when visiting the function definition itself and the block).
We also emit some branch for ternary expressions instead of just using a ternary.
Comment 1 Robin Morisset 2019-08-07 17:42:55 PDT
Created attachment 375771 [details]
Patch
Comment 2 Darin Adler 2019-08-09 09:59:43 PDT
Comment on attachment 375771 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375771&action=review

> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:253
> +        m_stringBuilder.append("\n");

I think that appending a single character is slightly more efficient if you use the character: append('\n')
Comment 3 Robin Morisset 2019-08-13 11:50:29 PDT
Created attachment 376190 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2019-08-15 10:49:45 PDT
Comment on attachment 376190 [details]
Patch for landing

Clearing flags on attachment: 376190

Committed r248729: <https://trac.webkit.org/changeset/248729>
Comment 5 WebKit Commit Bot 2019-08-15 10:49:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2019-08-15 10:50:22 PDT
<rdar://problem/54353040>
Comment 7 Robin Morisset 2019-08-21 10:46:13 PDT
The ternary part of this patch was just wrong because of effects.
See https://bugs.webkit.org/show_bug.cgi?id=200961