Commit Graph

5 Commits

Author SHA1 Message Date
Ben Clayton ea3eee9885 resolver: Migrate validation to behavior analysis
Migrate some of the validation logic over to use the results of behavior
analysis.

The most significant changes are:
* Unreachable-statements now consider merge-points of control flow. For
  example, if all branches of a if-statement or switch-statement either
  return or discard, the next statement will be considered unreachable.
* Unreachable statements are no longer an error, but a warning. See
  https://github.com/gpuweb/gpuweb/issues/2378.
* Statements that follow a loops that does not break, or have a
  conditional will now be considered unreachable.
* Unreachable statements produced by the SPIR-V reader are now removed
  using the new RemoveUnreachableStatements transform.

Some other new changes include additional validation for the continuing
block for for-loops, to match the rules of a loop continuing block.
The new cases this validation is testing for are not expressible in
WGSL, but some transforms may produce complex continuing statements that
might violate these rules. All the writers are able to decay these
complex for-loop continuing statements to regular loops.

Bug: tint:1302
Change-Id: I0d8a48c73d5d5c30a1cddf92cc3383a692a58e61
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-12-03 17:51:48 +00:00
Antonio Maiorano d388bc9b36 Restore "MSL writer: make signed int overflow defined behaviour"
This reverts commit e33b0baa08.

Added tests/expressions/literals/intmin.wgsl test.

Bug: tint:124
Change-Id: I3d46f939ff20fa377ddb5fcb52f9afe728b8e430
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60441
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-30 18:59:06 +00:00
Corentin Wallez e33b0baa08 Revert "MSL writer: make signed int overflow defined behaviour"
This reverts commit e5dbe24e94.

Reason for revert: Makes the Tint-Dawn roll fails because of
MSL compilation errors on as_type<uint>(-2147483648):
as_type cast from 'long' to 'uint' (aka 'unsigned int') is not allowed
   
as_type<uint>(-2147483647) compiles fine, so this is most
likely because the MSL compiler types the literal as a long
(since without the - it is larger than the max int32).

Original change's description:
> MSL writer: make signed int overflow defined behaviour
>
> Bug: tint:124
> Change-Id: Icf545b633d6390ceb7f639e80111390005e311a1
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60100
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
> Reviewed-by: David Neto <dneto@google.com>

TBR=dneto@google.com,bclayton@google.com,jrprice@google.com,amaiorano@google.com,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I3e3384a9185013bb141a1b7b9b22bad8571bbc50
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:124
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60345
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-30 08:22:58 +00:00
Antonio Maiorano e5dbe24e94 MSL writer: make signed int overflow defined behaviour
Bug: tint:124
Change-Id: Icf545b633d6390ceb7f639e80111390005e311a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60100
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-29 13:51:47 +00:00
Ben Clayton def7313523 test: Add loop test cases
Bug: tint:833
Bug: tint:914
Change-Id: Ieb34c734ad08c632c8d4e6152d856ec28f35cf85
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55249
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-06-21 19:04:56 +00:00