From cd5e1801836e53e9a6e0b1b2b791a26b5a9c6934 Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Thu, 20 Mar 2025 22:22:40 +0000 Subject: [PATCH 1/7] logging --- src/passes/Outlining.cpp | 118 +++++++++++++++++++++------------- src/passes/stringify-walker.h | 9 ++- 2 files changed, 79 insertions(+), 48 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 8ec0e14b415..e47eee7ab54 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -21,12 +21,12 @@ #include "support/suffix_tree.h" #include "wasm.h" -#define OUTLINING_DEBUG 0 +#define OUTLINING_DEBUG 1 #if OUTLINING_DEBUG -#define DBG(statement) statement +#define ODBG(statement) statement #else -#define DBG(statement) +#define ODBG(statement) #endif // Check a Result or MaybeResult for error and call Fatal() if the error exists. @@ -45,8 +45,8 @@ struct ReconstructStringifyWalker ReconstructStringifyWalker(Module* wasm, Function* func) : existingBuilder(*wasm), outlinedBuilder(*wasm), func(func) { this->setModule(wasm); - DBG(std::cerr << "\nexistingBuilder: " << &existingBuilder - << " outlinedBuilder: " << &outlinedBuilder << "\n"); + ODBG(std::cerr << "\nexistingBuilder: " << &existingBuilder + << " outlinedBuilder: " << &outlinedBuilder << "\n"); } // As we reconstruct the IR during outlining, we need to know what @@ -91,25 +91,26 @@ struct ReconstructStringifyWalker // starting a new function, as that resets the counters back to 0. instrCounter++; - DBG(std::string desc); + ODBG(std::string desc); if (auto curr = reason.getBlockStart()) { + ODBG(desc = "Block Start at "); ASSERT_OK(existingBuilder.visitBlockStart(curr->block)); - DBG(desc = "Block Start at "); } else if (auto curr = reason.getIfStart()) { // IR builder needs the condition of the If pushed onto the builder before // visitIfStart(), which will expect to be able to pop the condition. // This is always okay to do because the correct condition was installed // onto the If when the outer scope was visited. existingBuilder.push(curr->iff->condition); + ODBG(desc = "If Start at "); ASSERT_OK(existingBuilder.visitIfStart(curr->iff)); - DBG(desc = "If Start at "); } else if (reason.getElseStart()) { + ODBG(desc = "Else Start at "); ASSERT_OK(existingBuilder.visitElse()); - DBG(desc = "Else Start at "); } else if (auto curr = reason.getLoopStart()) { + ODBG(desc = "Loop Start at "); ASSERT_OK(existingBuilder.visitLoopStart(curr->loop)); - DBG(desc = "Loop Start at "); } else if (reason.getEnd()) { + ODBG(desc = "End at "); ASSERT_OK(existingBuilder.visitEnd()); // Reset the function in case we just ended the function scope. existingBuilder.setFunction(func); @@ -122,12 +123,11 @@ struct ReconstructStringifyWalker // its expressions off the stack, so we must call build() after visitEnd() // to clear the internal stack IRBuilder manages. ASSERT_OK(existingBuilder.build()); - DBG(desc = "End at "); } else { - DBG(desc = "addUniqueSymbol for unimplemented control flow "); + ODBG(desc = "addUniqueSymbol for unimplemented control flow "); WASM_UNREACHABLE("unimplemented control flow"); } - DBG(printAddUniqueSymbol(desc)); + ODBG(printAddUniqueSymbol(desc)); } void visitExpression(Expression* curr) { @@ -151,7 +151,7 @@ struct ReconstructStringifyWalker ASSERT_OK(builder->visit(curr)); } } - DBG(printVisitExpression(curr)); + ODBG(printVisitExpression(curr)); if (state == InSeq || state == InSkipSeq) { maybeEndSeq(); @@ -165,9 +165,9 @@ struct ReconstructStringifyWalker instrCounter = 0; seqCounter = 0; state = NotInSeq; - DBG(std::cerr << "\n" - << "Func Start to $" << func->name << " at " - << &existingBuilder << "\n"); + ODBG(std::cerr << "\n" + << "Func Start to $" << func->name << " at " + << &existingBuilder << "\n"); } ReconstructState getCurrState() { @@ -209,29 +209,41 @@ struct ReconstructStringifyWalker getModule()->getFunction(sequences[seqCounter].func); ASSERT_OK(outlinedBuilder.visitFunctionStart(outlinedFunc)); - // Add a local.get instruction for every parameter of the outlined function. - Signature sig = outlinedFunc->type.getSignature(); - for (Index i = 0; i < sig.params.size(); i++) { - ASSERT_OK(outlinedBuilder.makeLocalGet(i)); - } - // Make a call from the existing function to the outlined function. This // call will replace the instructions moved to the outlined function. + ODBG(std::cerr << "\nadding call " << outlinedFunc->name << " to " + << &existingBuilder << "\n"); ASSERT_OK(existingBuilder.makeCall(outlinedFunc->name, false)); - DBG(std::cerr << "\ncreated outlined fn: " << outlinedFunc->name << "\n"); // If the last instruction of the outlined sequence is unreachable, insert // an unreachable instruction immediately after the call to the outlined // function. This maintains the unreachable type in the original scope // of the outlined sequence. if (sequences[seqCounter].endsTypeUnreachable) { + ODBG(std::cerr << "\nadding endsUnreachable to " << &existingBuilder + << "\n"); ASSERT_OK(existingBuilder.makeUnreachable()); } + + // Add a local.get instruction for every parameter of the outlined function. + Signature sig = outlinedFunc->type.getSignature(); + ODBG(std::cerr << outlinedFunc->name << " takes " << sig.params.size() + << " parameters\n"); + for (Index i = 0; i < sig.params.size(); i++) { + ODBG(std::cerr << "adding local.get $" << i << " to " << &outlinedBuilder + << "\n"); + ASSERT_OK(outlinedBuilder.makeLocalGet(i)); + } } void transitionToInSkipSeq() { Function* outlinedFunc = getModule()->getFunction(sequences[seqCounter].func); + ODBG(std::cerr << "\nstarting to skip instructions " + << sequences[seqCounter].startIdx << " - " + << sequences[seqCounter].endIdx - 1 << " to " + << sequences[seqCounter].func + << " and adding call() instead\n"); ASSERT_OK(existingBuilder.makeCall(outlinedFunc->name, false)); // If the last instruction of the outlined sequence is unreachable, insert // an unreachable instruction immediately after the call to the outlined @@ -240,11 +252,6 @@ struct ReconstructStringifyWalker if (sequences[seqCounter].endsTypeUnreachable) { ASSERT_OK(existingBuilder.makeUnreachable()); } - DBG(std::cerr << "\nstarting to skip instructions " - << sequences[seqCounter].startIdx << " - " - << sequences[seqCounter].endIdx - 1 << " to " - << sequences[seqCounter].func - << " and adding call() instead\n"); } void maybeEndSeq() { @@ -255,12 +262,12 @@ struct ReconstructStringifyWalker } void transitionToNotInSeq() { - DBG(std::cerr << "End of sequence "); + ODBG(std::cerr << "End of sequence "); if (state == InSeq) { + ODBG(std::cerr << "to " << &outlinedBuilder); ASSERT_OK(outlinedBuilder.visitEnd()); - DBG(std::cerr << "to " << &outlinedBuilder); } - DBG(std::cerr << "\n\n"); + ODBG(std::cerr << "\n\n"); // Completed a sequence so increase the seqCounter and reset the state. seqCounter++; } @@ -292,7 +299,6 @@ struct Outlining : public Pass { // more than once in the program. auto substrings = StringifyProcessor::repeatSubstrings(stringify.hashString); - DBG(printHashString(stringify.hashString, stringify.exprs)); // Remove substrings that are substrings of longer repeat substrings. substrings = StringifyProcessor::dedupe(substrings); // Remove substrings with overlapping indices. @@ -317,7 +323,7 @@ struct Outlining : public Pass { // are relative to the enclosing function while substrings have indices // relative to the entire program. auto sequences = makeSequences(module, substrings, stringify); - outline(module, sequences); + outline(module, sequences, stringify); // Position the outlined functions first in the functions vector to make // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); @@ -371,14 +377,18 @@ struct Outlining : public Pass { relativeIdx + substring.Length, func, stringify.exprs[seqIdx + substring.Length - 1]->type == - Type::unreachable); + Type::unreachable, + seqIdx, + substring.Length); seqByFunc[existingFunc].push_back(seq); } } return seqByFunc; } - void outline(Module* module, Sequences seqByFunc) { + void outline(Module* module, + Sequences seqByFunc, + const HashStringifyWalker& stringify) { // TODO: Make this a function-parallel sub-pass. std::vector keys(seqByFunc.size()); std::transform(seqByFunc.begin(), @@ -398,6 +408,11 @@ struct Outlining : public Pass { }); ReconstructStringifyWalker reconstruct(module, module->getFunction(func)); reconstruct.sequences = std::move(seqByFunc[func]); + ODBG(printReconstruct(module, + stringify.hashString, + stringify.exprs, + func, + reconstruct.sequences)); reconstruct.doWalkFunction(module->getFunction(func)); } } @@ -420,17 +435,28 @@ struct Outlining : public Pass { } #if OUTLINING_DEBUG - void printHashString(const std::vector& hashString, - const std::vector& exprs) { - std::cerr << "\n\n"; - for (Index idx = 0; idx < hashString.size(); idx++) { - Expression* expr = exprs[idx]; - if (expr) { - std::cerr << idx << " - " << hashString[idx] << ": " - << ShallowExpression{expr} << "\n"; - } else { - std::cerr << idx << ": unique symbol\n"; + void printReconstruct(Module* module, + const std::vector& hashString, + const std::vector& exprs, + Name existingFunc, + const std::vector& seqs) { + std::cerr << "\n\nReconstructing existing fn: " << existingFunc << "\n"; + std::cerr << "moving sequences: " << "\n"; + for (auto& seq : seqs) { + for (Index idx = seq.originalIdx; idx < seq.originalIdx + seq.length; + idx++) { + Expression* expr = exprs[idx]; + if (expr == nullptr) { + std::cerr << "unique symbol\n"; + } else { + std::cerr << idx << " - " << hashString[idx] << " - " << seq.startIdx + << " : " << ShallowExpression{expr} << "\n"; + } } + std::cerr << "to outlined function: " << seq.func << "\n"; + auto outlinedFunction = module->getFunction(seq.func); + std::cerr << "with signature: " << outlinedFunction->type.toString() + << "\n"; } } #endif diff --git a/src/passes/stringify-walker.h b/src/passes/stringify-walker.h index bb7a09924f9..31971fe9d0e 100644 --- a/src/passes/stringify-walker.h +++ b/src/passes/stringify-walker.h @@ -259,13 +259,18 @@ struct OutliningSequence { unsigned endIdx; Name func; bool endsTypeUnreachable; + unsigned originalIdx; + unsigned length; OutliningSequence(unsigned startIdx, unsigned endIdx, Name func, - bool endsTypeUnreachable) + bool endsTypeUnreachable, + unsigned originalIdx, + unsigned length) : startIdx(startIdx), endIdx(endIdx), func(func), - endsTypeUnreachable(endsTypeUnreachable) {} + endsTypeUnreachable(endsTypeUnreachable), originalIdx(originalIdx), + length(length) {} }; using Substrings = std::vector; From c8a88d8b53a4a3d355dd2c330804c3f5bc5dab58 Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Mon, 7 Apr 2025 22:31:40 +0000 Subject: [PATCH 2/7] printHash --- src/passes/Outlining.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index e47eee7ab54..ff264276628 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -295,6 +295,7 @@ struct Outlining : public Pass { HashStringifyWalker stringify; // Walk the module and create a "string representation" of the program. stringify.walkModule(module); + ODBG(printHashString(stringify.hashString, stringify.exprs)); // Collect all of the substrings of the string representation that appear // more than once in the program. auto substrings = @@ -435,6 +436,19 @@ struct Outlining : public Pass { } #if OUTLINING_DEBUG + void printHashString(const std::vector& hashString, + const std::vector& exprs) { + std::cerr << "\n\n"; + for (Index idx = 0; idx < hashString.size(); idx++) { + Expression* expr = exprs[idx]; + if (expr) { + std::cerr << idx << " - " << hashString[idx] << ": " + << ShallowExpression{expr} << "\n"; + } else { + std::cerr << idx << ": unique symbol\n"; + } + } + } void printReconstruct(Module* module, const std::vector& hashString, const std::vector& exprs, From 7c61aac6d1ffdc7a71fa7084bf6fabfa09258091 Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Mon, 7 Apr 2025 22:36:23 +0000 Subject: [PATCH 3/7] lint --- src/passes/Outlining.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index ff264276628..5067ff0ad23 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -455,7 +455,8 @@ struct Outlining : public Pass { Name existingFunc, const std::vector& seqs) { std::cerr << "\n\nReconstructing existing fn: " << existingFunc << "\n"; - std::cerr << "moving sequences: " << "\n"; + std::cerr << "moving sequences: " + << "\n"; for (auto& seq : seqs) { for (Index idx = seq.originalIdx; idx < seq.originalIdx + seq.length; idx++) { From bc3263f3394261c6f8c3fddc6168b56e86d7b5b2 Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Mon, 7 Apr 2025 23:17:51 +0000 Subject: [PATCH 4/7] macro fun --- src/passes/Outlining.cpp | 50 ++++++++++++++++++++++++++++++++++- src/passes/stringify-walker.h | 19 ------------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 5067ff0ad23..3d3797e2a01 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -21,7 +21,7 @@ #include "support/suffix_tree.h" #include "wasm.h" -#define OUTLINING_DEBUG 1 +#define OUTLINING_DEBUG 0 #if OUTLINING_DEBUG #define ODBG(statement) statement @@ -37,6 +37,36 @@ namespace wasm { +struct OutliningSequence { + unsigned startIdx; + unsigned endIdx; + Name func; + bool endsTypeUnreachable; +#if OUTLINING_DEBUG + unsigned originalIdx; + unsigned length; +#endif + +#if OUTLINING_DEBUG + OutliningSequence(unsigned startIdx, + unsigned endIdx, + Name func, + bool endsTypeUnreachable, + unsigned originalIdx, + unsigned length) + : startIdx(startIdx), endIdx(endIdx), func(func), + endsTypeUnreachable(endsTypeUnreachable), originalIdx(originalIdx), + length(length) {} +#else + OutliningSequence(unsigned startIdx, + unsigned endIdx, + Name func, + bool endsTypeUnreachable) + : startIdx(startIdx), endIdx(endIdx), func(func), + endsTypeUnreachable(endsTypeUnreachable) {} +#endif +}; + // Instances of this walker are intended to walk a function at a time, at the // behest of the owner of the instance. struct ReconstructStringifyWalker @@ -324,7 +354,11 @@ struct Outlining : public Pass { // are relative to the enclosing function while substrings have indices // relative to the entire program. auto sequences = makeSequences(module, substrings, stringify); +#if OUTLINING_DEBUG outline(module, sequences, stringify); +#else + outline(module, sequences); +#endif // Position the outlined functions first in the functions vector to make // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); @@ -373,6 +407,7 @@ struct Outlining : public Pass { // sequence relative to its function is better for outlining because we // walk functions. auto [relativeIdx, existingFunc] = stringify.makeRelative(seqIdx); +#if OUTLINING_DEBUG auto seq = OutliningSequence( relativeIdx, relativeIdx + substring.Length, @@ -381,15 +416,28 @@ struct Outlining : public Pass { Type::unreachable, seqIdx, substring.Length); +#else + auto seq = OutliningSequence( + relativeIdx, + relativeIdx + substring.Length, + func, + stringify.exprs[seqIdx + substring.Length - 1]->type == + Type::unreachable); +#endif seqByFunc[existingFunc].push_back(seq); } } return seqByFunc; } +#if OUTLINING_DEBUG void outline(Module* module, Sequences seqByFunc, const HashStringifyWalker& stringify) { +#else + void outline(Module* module, + Sequences seqByFunc) { +#endif // TODO: Make this a function-parallel sub-pass. std::vector keys(seqByFunc.size()); std::transform(seqByFunc.begin(), diff --git a/src/passes/stringify-walker.h b/src/passes/stringify-walker.h index 31971fe9d0e..d46334d3b84 100644 --- a/src/passes/stringify-walker.h +++ b/src/passes/stringify-walker.h @@ -254,25 +254,6 @@ struct HashStringifyWalker : public StringifyWalker { std::map idxToFuncName; }; -struct OutliningSequence { - unsigned startIdx; - unsigned endIdx; - Name func; - bool endsTypeUnreachable; - unsigned originalIdx; - unsigned length; - - OutliningSequence(unsigned startIdx, - unsigned endIdx, - Name func, - bool endsTypeUnreachable, - unsigned originalIdx, - unsigned length) - : startIdx(startIdx), endIdx(endIdx), func(func), - endsTypeUnreachable(endsTypeUnreachable), originalIdx(originalIdx), - length(length) {} -}; - using Substrings = std::vector; // Functions that filter vectors of SuffixTree::RepeatedSubstring From 5da94c65049d4daf7e2b2a6db97e40d000e2b29c Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Mon, 7 Apr 2025 23:33:54 +0000 Subject: [PATCH 5/7] lint --- src/passes/Outlining.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 3d3797e2a01..7bd9cc1205a 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -435,8 +435,7 @@ struct Outlining : public Pass { Sequences seqByFunc, const HashStringifyWalker& stringify) { #else - void outline(Module* module, - Sequences seqByFunc) { + void outline(Module* module, Sequences seqByFunc) { #endif // TODO: Make this a function-parallel sub-pass. std::vector keys(seqByFunc.size()); From 5959dafb903dae68cc476b110ace370fef4296c0 Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Wed, 9 Apr 2025 00:32:56 +0000 Subject: [PATCH 6/7] readability --- src/passes/Outlining.cpp | 57 ++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 7bd9cc1205a..35bd4bc00d5 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -43,28 +43,23 @@ struct OutliningSequence { Name func; bool endsTypeUnreachable; #if OUTLINING_DEBUG - unsigned originalIdx; - unsigned length; + unsigned programIdx; #endif -#if OUTLINING_DEBUG - OutliningSequence(unsigned startIdx, - unsigned endIdx, - Name func, - bool endsTypeUnreachable, - unsigned originalIdx, - unsigned length) - : startIdx(startIdx), endIdx(endIdx), func(func), - endsTypeUnreachable(endsTypeUnreachable), originalIdx(originalIdx), - length(length) {} -#else OutliningSequence(unsigned startIdx, unsigned endIdx, Name func, - bool endsTypeUnreachable) + bool endsTypeUnreachable +#if OUTLINING_DEBUG + , unsigned programIdx +#endif + ) : startIdx(startIdx), endIdx(endIdx), func(func), - endsTypeUnreachable(endsTypeUnreachable) {} + endsTypeUnreachable(endsTypeUnreachable) +#if OUTLINING_DEBUG + , programIdx(programIdx) #endif + {} }; // Instances of this walker are intended to walk a function at a time, at the @@ -354,11 +349,11 @@ struct Outlining : public Pass { // are relative to the enclosing function while substrings have indices // relative to the entire program. auto sequences = makeSequences(module, substrings, stringify); + outline(module, sequences #if OUTLINING_DEBUG - outline(module, sequences, stringify); -#else - outline(module, sequences); + , stringify #endif + ); // Position the outlined functions first in the functions vector to make // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); @@ -407,36 +402,28 @@ struct Outlining : public Pass { // sequence relative to its function is better for outlining because we // walk functions. auto [relativeIdx, existingFunc] = stringify.makeRelative(seqIdx); -#if OUTLINING_DEBUG auto seq = OutliningSequence( relativeIdx, relativeIdx + substring.Length, func, stringify.exprs[seqIdx + substring.Length - 1]->type == - Type::unreachable, - seqIdx, - substring.Length); -#else - auto seq = OutliningSequence( - relativeIdx, - relativeIdx + substring.Length, - func, - stringify.exprs[seqIdx + substring.Length - 1]->type == - Type::unreachable); + Type::unreachable +#if OUTLINING_DEBUG + , seqIdx #endif + ); seqByFunc[existingFunc].push_back(seq); } } return seqByFunc; } -#if OUTLINING_DEBUG void outline(Module* module, - Sequences seqByFunc, - const HashStringifyWalker& stringify) { -#else - void outline(Module* module, Sequences seqByFunc) { + Sequences seqByFunc +#if OUTLINING_DEBUG + , const HashStringifyWalker& stringify #endif + ) { // TODO: Make this a function-parallel sub-pass. std::vector keys(seqByFunc.size()); std::transform(seqByFunc.begin(), @@ -505,7 +492,7 @@ struct Outlining : public Pass { std::cerr << "moving sequences: " << "\n"; for (auto& seq : seqs) { - for (Index idx = seq.originalIdx; idx < seq.originalIdx + seq.length; + for (Index idx = seq.programIdx; idx < seq.programIdx + (seq.endIdx - seq.startIdx); idx++) { Expression* expr = exprs[idx]; if (expr == nullptr) { From 3114c9f1e5bef21bfc8ff6e185481a9107884c51 Mon Sep 17 00:00:00 2001 From: Ashley Nelson Date: Wed, 9 Apr 2025 00:32:56 +0000 Subject: [PATCH 7/7] readability --- src/passes/Outlining.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/passes/Outlining.cpp b/src/passes/Outlining.cpp index 35bd4bc00d5..85bc12e5869 100644 --- a/src/passes/Outlining.cpp +++ b/src/passes/Outlining.cpp @@ -51,15 +51,18 @@ struct OutliningSequence { Name func, bool endsTypeUnreachable #if OUTLINING_DEBUG - , unsigned programIdx + , + unsigned programIdx #endif ) : startIdx(startIdx), endIdx(endIdx), func(func), endsTypeUnreachable(endsTypeUnreachable) #if OUTLINING_DEBUG - , programIdx(programIdx) + , + programIdx(programIdx) #endif - {} + { + } }; // Instances of this walker are intended to walk a function at a time, at the @@ -349,11 +352,13 @@ struct Outlining : public Pass { // are relative to the enclosing function while substrings have indices // relative to the entire program. auto sequences = makeSequences(module, substrings, stringify); - outline(module, sequences + outline(module, + sequences #if OUTLINING_DEBUG - , stringify + , + stringify #endif - ); + ); // Position the outlined functions first in the functions vector to make // the outlining lit tests far more readable. moveOutlinedFunctions(module, substrings.size()); @@ -409,9 +414,10 @@ struct Outlining : public Pass { stringify.exprs[seqIdx + substring.Length - 1]->type == Type::unreachable #if OUTLINING_DEBUG - , seqIdx + , + seqIdx #endif - ); + ); seqByFunc[existingFunc].push_back(seq); } } @@ -421,9 +427,10 @@ struct Outlining : public Pass { void outline(Module* module, Sequences seqByFunc #if OUTLINING_DEBUG - , const HashStringifyWalker& stringify + , + const HashStringifyWalker& stringify #endif - ) { + ) { // TODO: Make this a function-parallel sub-pass. std::vector keys(seqByFunc.size()); std::transform(seqByFunc.begin(), @@ -492,7 +499,8 @@ struct Outlining : public Pass { std::cerr << "moving sequences: " << "\n"; for (auto& seq : seqs) { - for (Index idx = seq.programIdx; idx < seq.programIdx + (seq.endIdx - seq.startIdx); + for (Index idx = seq.programIdx; + idx < seq.programIdx + (seq.endIdx - seq.startIdx); idx++) { Expression* expr = exprs[idx]; if (expr == nullptr) {