File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -481,7 +481,9 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
481481 // format. We need to flip the condition, which at worst adds 1.
482482 if (curr->name .is ()) {
483483 auto * br = list[0 ]->dynCast <Break>();
484- if (br && br->condition && br->name == curr->name ) {
484+ // we seek a regular br_if; if the type is unreachable that means it is not
485+ // actually taken, so ignore
486+ if (br && br->condition && br->name == curr->name && br->type != unreachable) {
485487 assert (!br->value ); // can't, it would be dropped or last in the block
486488 if (BranchUtils::BranchSeeker::countNamed (curr, curr->name ) == 1 ) {
487489 // no other breaks to that name, so we can do this
Original file line number Diff line number Diff line change 10481048 )
10491049 )
10501050 )
1051+ (func $untaken-br_if-then-if (type $1)
1052+ (block $label$0
1053+ (br_if $label$0
1054+ (unreachable)
1055+ )
1056+ (if
1057+ (i32.const 0)
1058+ (nop)
1059+ )
1060+ )
1061+ )
10511062)
Original file line number Diff line number Diff line change 932932 )
933933 )
934934 )
935+ (func $untaken-br_if-then-if
936+ (block $label$0
937+ (br_if $label$0
938+ (unreachable )
939+ )
940+ (if
941+ (i32.const 0 )
942+ (nop )
943+ )
944+ )
945+ )
935946)
936947
You can’t perform that action at this time.
0 commit comments