src/compiler/translator/tree_ops/PruneNoOps.cpp


Log

Author Commit Date CI Message
Shahbaz Youssefi d314868d 2025-03-21T16:13:45 Translator: prune `side_effect,noop` to `side_effect` ... if the result is unused. If `noop` includes a reference to a struct that's entirely made of samplers, the transformation that removes samplers from structs doesn't know what to do with the empty expressions. Bug: chromium:390467743 Change-Id: I62ccce6031e1bb4a0c875d0f7dce9adefb7e208d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6383081 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 568caaa0 2024-07-23T15:07:59 Prune switch(constant) with no matching case Bug: chromium:350528343 Change-Id: Iabb475b230f22086de482bbdcf2fa00b0d986622 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5735815 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi facd07ec 2023-02-14T14:11:00 Vulkan: Prune all statements without side effect Bug: chromium:1417461 Bug: angleproject:6061 Change-Id: I6e2b74589021ee60c99448e43ee3eb7f06796ede Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4250278 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9d84ad7d 2023-02-14T10:47:54 Translator: Fix sampler-in-struct when struct is unused Standalone symbols as statements are also pruned. For example in the below: ``` x; g(); ``` The line that only contains `x;` is pruned. In particular, this was causing a bug with sampler-in-struct processing where the code ASSERTs that if an instance of the struct is visited during traversal, that it's already processed as part of an index chain (like s.member), but in the above situation that is not true. Bug: chromium:1416152 Change-Id: I49e9a5826fc4d8c1fef1fa6f1d38c65f33f8acfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4247584 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Eddie Hatfield 91976352 2022-06-21T15:41:02 Use C++17 attributes instead of custom macros Bug: angleproject:6747 Change-Id: Iad6c7cd8a18d028e01da49b647c5d01af11e0522 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3718999 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 15fe0474 2022-03-21T00:06:38 Translator: Work around tool paranoia w.r.t repeated std::move An unknown diagnostic tool has flagged a usage in PruneNoOps, where an empty vector is std::move'd on multiple iterations of a loop, as error-prone. That was intended behavior. To silence the tool however, the empty vector declaration is moved inside the loop. Bug: chromium:1304953 Change-Id: Ie4b0c78e3f4a845db2b3b3a18d4ca095f0ba746b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3539443 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 63248e7f 2021-08-05T23:49:23 Translator: Fix dead-code-elimination corner case The DCE code had a corner case bug where a switch case containing multiple DCE'ed `break`s followed by another case would cause some of the DCE'ed statements in the first case to be doubly pruned, failing on an assertion. This was due to the fact that visitBlock() was asking traversal to continue if a new case was visited while pruning nodes, but the traversal does not take into account that some statements need to be skipped and so would also visit the pruned statements. If the pruned statements contain a branch instruction, they get re-pruned. The visitBlock() function that does the pruning is reworked so that it more clearly traverses the statements. Bug: chromium:1237200 Change-Id: Ib078c2ea73ade756c7d7ef5a5c489fa53c39f352 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3077659 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 3f9dcb00 2021-06-12T01:37:32 Translator: Prune trivial dead code Code after discard, return, break and continue is discarded with this change. This simplifies SPIR-V generation as no code is allowed after a branch instruction and no special handling is necessary after this change. Bug: angleproject:4889 Change-Id: Ife9c8de8a6d0db9d682561daf44366aad9b1cf61 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2957811 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9f4b159b 2021-01-19T12:48:15 Translator: Avoid vector copies with multi-replacement Turns push_backs into emplace_backs and changes the TIntermSequence constructor argument to &&. Bug: angleproject:5535 Change-Id: I640ce879b6ade48a28dea6385ebb7a95cb8304ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2636680 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
Shahbaz Youssefi 472c74c6 2019-08-19T16:32:13 Translator: Allow tree validation in children of TCompiler This is to be able to perform validation inside TranslatorVulkan, even if it's through ASSERTs. Additionally, every transformation is changed such that they do their validation themselves. TIntermTraverser::updateTree() performs the validation, which indirectly validates many of three tree transformations. Some of the more ancient transformations that don't use this function directly call TCompiler::validateAST. Bug: angleproject:2733 Change-Id: Ie4af029d34e053c5ad1dc8c2c2568eecd625d344 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1761149 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b779b12c 2018-06-20T11:46:43 Add kEmptyImmutableString. We can use this instead of ImmutableString(""). Bug: angleproject:2665 Change-Id: I8b3d5d3075838b9f2caa1627071202e48a5fdc83 Reviewed-on: https://chromium-review.googlesource.com/1108085 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Luc Ferron <lucferron@chromium.org>
Olli Etuaho a07b4213 2018-03-22T16:13:13 Move AST transformations to a subdirectory Move AST transformations to compiler/translator/tree_ops. BUG=angleproject:2409 TEST=angle_unittests Change-Id: I9c620e98707d22d005da6192fe7d1b4e8030aadd Reviewed-on: https://chromium-review.googlesource.com/975550 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>