File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -173,6 +173,11 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
173173 auto * iff = (*currp)->dynCast <If>();
174174
175175 if (iff) {
176+ if (iff->condition ->type == unreachable) {
177+ // avoid all the branching, we never reach it anyhow
178+ *currp = iff->condition ;
179+ return ;
180+ }
176181 self->pushTask (doVisitIf, currp);
177182 if (iff->ifFalse ) {
178183 // we need to join up if-else control flow, and clear after the condition
Original file line number Diff line number Diff line change 10621062 )
10631063 (func $unreachable-if-that-could-be-a-br_if (type $7) (result i64)
10641064 (loop $label$3
1065- (if
1066- (unreachable)
1067- (f64.const 1)
1068- (br $label$3)
1069- )
1065+ (unreachable)
10701066 (i64.const 1)
10711067 )
10721068 )
1069+ (func $nop-br-might-update-type (type $1)
1070+ (block $label$39
1071+ (unreachable)
1072+ )
1073+ )
10731074)
Original file line number Diff line number Diff line change 953953 (i64.const 1 )
954954 )
955955 )
956+ (func $nop-br-might-update-type
957+ (block $label$39
958+ (if
959+ (unreachable )
960+ (if (result i32 )
961+ (i32.const 1 )
962+ (br $label$39 ) ;; if we nop this, then the parent type must change
963+ (i32.const 0 )
964+ )
965+ (i32.const 0 )
966+ )
967+ )
968+ )
956969)
957970
You can’t perform that action at this time.
0 commit comments