Heejin Ahn
bcac389fb2
[WebAssembly] Fix fixEndsAtEndOfFunction for try-catch
...
When the function return type is non-void and `end` instructions are at
the very end of a function, CFGStackify's `fixEndsAtEndOfFunction`
function fixes the corresponding block/loop/try's type to match the
function's return type. This is applied to consecutive `end` markers at
the end of a function. For example, when the function return type is
`i32`,
```
block i32 ;; return type is fixed to i32
...
loop i32 ;; return type is fixed to i32
...
end_loop
end_block
end_function
```
But try-catch is a little different, because it consists of two parts:
a try part and a catch part, and both parts' return type should satisfy
the function's return type. Which means,
```
try i32 ;; return type is fixed to i32
...
block i32 ;; this should be changed i32 too!
...
end_block
catch
...
end_try
end_function
```
As you can see in this example, it is not sufficient to only `end`
instructions at the end of a function; in case of `try`, we should
check instructions before `catch`es, in case their corresponding `try`'s
type has been fixed.
This changes `fixEndsAtEndOfFunction`'s algorithm to use a worklist
that contains a reverse iterator, each of which is a starting point for
a new backward `end` instruction search.
Fixes https://bugs.llvm.org/show_bug.cgi?id=47413 .
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D87207
2020-09-08 09:27:40 -07:00
..
2019-07-09 01:21:04 +00:00
2019-07-09 02:10:33 +00:00
2019-06-05 20:01:01 +00:00
2020-06-17 16:25:50 -07:00
2019-08-28 23:13:43 +00:00
2020-06-15 08:31:56 -07:00
2019-02-28 18:39:08 +00:00
2019-02-28 18:39:08 +00:00
2020-07-06 12:49:50 -07:00
2019-09-18 23:18:16 +00:00
2020-02-18 15:55:20 -08:00
2020-02-18 15:55:20 -08:00
2020-02-18 15:55:20 -08:00
2019-03-30 09:29:57 +00:00
2019-03-29 19:36:51 +00:00
2020-09-08 09:27:40 -07:00
2020-06-03 14:04:59 -07:00
2018-08-27 15:45:51 +00:00
2020-02-13 10:16:06 -08:00
2019-01-08 06:25:55 +00:00
2019-01-08 06:25:55 +00:00
2019-01-14 22:03:43 +00:00
2019-01-14 22:03:43 +00:00
2019-10-15 01:11:51 +00:00
2019-01-08 06:25:55 +00:00
2019-01-08 06:25:55 +00:00
2020-06-15 08:31:56 -07:00
2019-01-18 02:47:48 +00:00
2018-11-19 17:10:36 +00:00
2020-04-16 16:32:17 -07:00
2020-06-04 13:25:10 -07:00
2018-08-27 15:45:51 +00:00
2020-06-06 22:30:51 -04:00
2018-10-25 23:55:10 +00:00
2020-05-28 19:46:11 -07:00
2019-10-09 21:42:08 +00:00
2019-12-11 11:54:57 -08:00
2020-02-18 15:55:20 -08:00
2020-02-18 15:55:20 -08:00
2020-02-18 15:55:20 -08:00
2018-08-27 15:45:51 +00:00
2019-01-08 06:25:55 +00:00
2018-11-19 17:10:36 +00:00
2019-02-23 00:07:39 +00:00
2020-08-08 15:23:11 -07:00
2019-01-08 06:25:55 +00:00
2020-02-18 15:55:20 -08:00
2020-08-26 09:20:46 +01:00
2018-11-19 17:10:36 +00:00
2019-02-23 00:07:39 +00:00
2020-02-18 15:55:20 -08:00
2019-10-09 21:42:08 +00:00
2020-07-16 14:10:22 -07:00
2019-03-01 00:12:13 +00:00
2020-02-18 15:55:20 -08:00
2019-01-09 14:20:20 +00:00
2019-01-08 06:25:55 +00:00
2019-01-09 14:20:20 +00:00
2019-01-08 06:25:55 +00:00
2018-11-19 17:10:36 +00:00
2019-02-23 00:07:39 +00:00
2018-08-27 15:45:51 +00:00
2018-11-19 17:10:36 +00:00
2019-03-05 20:35:34 +00:00
2019-02-01 22:27:34 +00:00
2019-12-24 16:27:51 -08:00
2020-06-11 15:11:45 -07:00
2018-08-27 15:45:51 +00:00
2019-01-08 06:25:55 +00:00
2019-01-08 06:25:55 +00:00
2019-04-26 18:45:04 +00:00
2019-03-19 05:10:39 +00:00
2019-03-30 01:31:11 +00:00
2019-03-30 01:31:11 +00:00
2019-01-08 06:25:55 +00:00
2020-02-18 15:55:20 -08:00
2020-02-18 15:55:20 -08:00
2020-06-15 08:31:56 -07:00
2020-06-15 08:31:56 -07:00
2020-06-15 08:31:56 -07:00
2019-06-05 20:01:01 +00:00
2020-06-15 08:31:56 -07:00
2020-02-18 15:55:20 -08:00
2020-06-20 00:06:39 -07:00
2020-01-23 18:13:52 -08:00
2019-08-05 21:36:09 +00:00
2019-09-03 22:26:49 +00:00
2020-04-09 18:44:50 -07:00
2019-08-26 21:41:17 +00:00
2020-04-09 18:44:50 -07:00
2020-03-26 16:19:02 -07:00
2019-02-23 00:07:39 +00:00
2019-02-23 00:07:39 +00:00
2019-01-29 10:53:42 +00:00
2019-01-29 10:53:42 +00:00
2020-02-18 15:55:20 -08:00
2019-01-14 18:25:29 +00:00
2020-07-06 12:49:50 -07:00
2019-02-23 00:07:39 +00:00
2020-01-17 17:23:56 -08:00
2020-02-18 14:56:09 -08:00
2020-02-18 14:56:09 -08:00
2020-02-18 15:55:20 -08:00
2019-03-29 22:00:18 +00:00
2019-12-24 16:27:51 -08:00
2018-11-18 11:58:47 +00:00
2020-02-13 10:16:06 -08:00
2019-01-08 06:25:55 +00:00
2018-11-19 17:10:36 +00:00
2020-05-04 14:44:39 +01:00
2019-04-23 21:17:03 +00:00
2020-09-06 15:42:21 -07:00
2019-01-14 22:03:43 +00:00
2019-01-31 00:35:37 +00:00
2019-03-21 11:18:54 +00:00
2019-05-13 19:40:18 +00:00
2020-01-24 14:26:27 -08:00
2019-10-09 21:42:08 +00:00
2019-10-09 21:42:08 +00:00
2020-07-15 07:34:22 +00:00
2020-02-18 15:55:20 -08:00
2019-05-23 01:24:01 +00:00
2019-01-08 06:25:55 +00:00
2018-11-19 17:10:36 +00:00
2020-02-18 15:55:20 -08:00
2019-11-15 16:22:01 -08:00
2020-02-18 15:55:20 -08:00
2019-01-08 06:25:55 +00:00
2019-02-23 00:07:39 +00:00
2020-07-10 18:27:52 -07:00
2020-02-04 18:36:32 -08:00
2020-02-04 18:36:32 -08:00
2020-05-15 10:53:02 -07:00
2020-02-04 18:36:32 -08:00
2020-05-01 17:20:49 -07:00
2020-02-04 18:36:32 -08:00
2019-05-23 18:09:26 +00:00
2020-07-28 18:25:55 -07:00
2019-10-31 20:02:24 -07:00
2020-06-09 13:46:12 -07:00
2020-08-03 13:54:00 -07:00
2018-12-21 06:58:15 +00:00
2020-06-03 15:36:44 -07:00
2019-01-02 20:43:08 +00:00
2020-07-28 17:46:45 -07:00
2019-06-19 00:02:13 +00:00
2020-02-04 18:36:32 -08:00
2020-07-16 11:37:25 -07:00
2020-02-25 13:54:48 -08:00
2020-07-10 00:18:59 -07:00
2020-07-02 16:21:54 +08:00
2020-05-19 12:50:44 -07:00
2020-07-28 18:25:55 -07:00
2020-07-10 18:27:52 -07:00
2020-06-25 15:52:44 -07:00
2020-06-03 14:04:59 -07:00
2020-07-08 01:02:05 -07:00
2020-05-14 13:14:45 -07:00
2020-06-15 08:31:56 -07:00
2020-06-15 08:31:56 -07:00
2020-06-15 08:31:56 -07:00
2020-03-19 17:39:52 -07:00
2020-06-11 15:11:45 -07:00
2020-06-17 12:34:45 -07:00
2020-07-30 10:52:16 -07:00
2020-02-18 15:55:20 -08:00
2020-05-08 13:52:39 -07:00
2020-01-24 14:27:35 -08:00
2020-02-13 10:16:06 -08:00
2019-07-16 22:22:08 +00:00
2019-02-23 00:07:39 +00:00
2019-02-23 00:07:39 +00:00
2019-02-23 00:07:39 +00:00
2020-02-18 15:55:20 -08:00
2020-02-18 15:55:20 -08:00
2020-06-25 15:52:44 -07:00
2019-02-26 05:20:19 +00:00
2018-07-02 16:03:49 +00:00
2019-02-28 18:39:08 +00:00
2020-04-04 07:02:50 -07:00