File tree Expand file tree Collapse file tree 4 files changed +62
-4
lines changed Expand file tree Collapse file tree 4 files changed +62
-4
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ std::vector<SuffixTree::RepeatedSubstring> StringifyProcessor::filter(
204204 void walk (Expression* curr) {
205205 hasFilterValue = false ;
206206 Super::walk (curr);
207+ flushControlFlowQueue ();
207208 }
208209
209210 void addUniqueSymbol (SeparatorReason reason) {}
Original file line number Diff line number Diff line change @@ -42,9 +42,7 @@ inline void StringifyWalker<SubType>::doWalkFunction(Function* func) {
4242 addUniqueSymbol (SeparatorReason::makeFuncStart (func));
4343 Super::walk (func->body );
4444 addUniqueSymbol (SeparatorReason::makeEnd ());
45- while (!controlFlowQueue.empty ()) {
46- dequeueControlFlow ();
47- }
45+ flushControlFlowQueue ();
4846}
4947
5048template <typename SubType>
Original file line number Diff line number Diff line change @@ -191,7 +191,11 @@ struct StringifyWalker
191191 static void scan (SubType* self, Expression** currp);
192192 static void doVisitExpression (SubType* self, Expression** currp);
193193
194- private:
194+ void flushControlFlowQueue () {
195+ while (!controlFlowQueue.empty ()) {
196+ dequeueControlFlow ();
197+ }
198+ }
195199 void dequeueControlFlow ();
196200};
197201
Original file line number Diff line number Diff line change 11091109 unreachable
11101110 )
11111111)
1112+
1113+ ;; Tests that restricted expressions (local.set) are filtered from outlining
1114+ ;; even when nested within control flow.
1115+ (module
1116+ ;; CHECK: (type $0 (func))
1117+
1118+ ;; CHECK: (func $a (type $0)
1119+ ;; CHECK-NEXT: (local $x i32)
1120+ ;; CHECK-NEXT: (if
1121+ ;; CHECK-NEXT: (i32.const 0)
1122+ ;; CHECK-NEXT: (then
1123+ ;; CHECK-NEXT: (local.set $x
1124+ ;; CHECK-NEXT: (i32.const 1)
1125+ ;; CHECK-NEXT: )
1126+ ;; CHECK-NEXT: )
1127+ ;; CHECK-NEXT: )
1128+ ;; CHECK-NEXT: )
1129+ (func $a
1130+ (local $x i32 )
1131+ (block
1132+ (if
1133+ (i32.const 0 )
1134+ (then
1135+ (local.set $x
1136+ (i32.const 1 )
1137+ )
1138+ )
1139+ )
1140+ )
1141+ )
1142+ ;; CHECK: (func $b (type $0)
1143+ ;; CHECK-NEXT: (local $x i32)
1144+ ;; CHECK-NEXT: (if
1145+ ;; CHECK-NEXT: (i32.const 0)
1146+ ;; CHECK-NEXT: (then
1147+ ;; CHECK-NEXT: (local.set $x
1148+ ;; CHECK-NEXT: (i32.const 1)
1149+ ;; CHECK-NEXT: )
1150+ ;; CHECK-NEXT: )
1151+ ;; CHECK-NEXT: )
1152+ ;; CHECK-NEXT: )
1153+ (func $b
1154+ (local $x i32 )
1155+ (block
1156+ (if
1157+ (i32.const 0 )
1158+ (then
1159+ (local.set $x
1160+ (i32.const 1 )
1161+ )
1162+ )
1163+ )
1164+ )
1165+ )
1166+ )
You can’t perform that action at this time.
0 commit comments