File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ struct LowerUnflattenable : public PostWalker<LowerUnflattenable> {
9898 condition = builder.makeRefIsNull (refTee);
9999 flip = true ;
100100 brValue = builder.makeRefAs (RefAsNonNull, getRef ());
101- flowValue = getRef ();
101+ // No value flos out.
102102 break ;
103103 }
104104 case BrOnCast: {
@@ -125,9 +125,11 @@ struct LowerUnflattenable : public PostWalker<LowerUnflattenable> {
125125 }
126126
127127 auto * br = builder.makeBreak (curr->name , brValue);
128- auto * iff = builder.makeIf (condition, br);
129- auto * seq = builder.makeSequence (iff, flowValue);
130- replaceCurrent (seq);
128+ Expression* result = builder.makeIf (condition, br);
129+ if (flowValue) {
130+ result = builder.makeSequence (result, flowValue);
131+ }
132+ replaceCurrent (result);
131133 }
132134
133135 void replaceUnreachableWithDrops () {
@@ -464,8 +466,6 @@ struct Flatten
464466 // Lower things before the main walk.
465467 LowerUnflattenable (*getModule (), getPassOptions ()).walkFunction (curr);
466468
467- std::cout << " after " << *curr << ' \n ' ;
468-
469469 WalkerPass<
470470 ExpressionStackWalker<Flatten, UnifiedExpressionVisitor<Flatten>>>::
471471 doWalkFunction (curr);
You can’t perform that action at this time.
0 commit comments