diff options
author | Alon Zakai <azakai@google.com> | 2019-05-01 14:48:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-01 14:48:41 -0700 |
commit | 2bd3758a22131cfd6925b3fd995657b211095c90 (patch) | |
tree | 2a38a48ab68c00ed1b55e885f86014bbdda92ff2 /src/passes/Inlining.cpp | |
parent | 73709b4da08d285c2237c8c23a54ba53274c0c7f (diff) | |
download | binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.gz binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.tar.bz2 binaryen-2bd3758a22131cfd6925b3fd995657b211095c90.zip |
clang-tidy braces changes (#2075)
Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
Diffstat (limited to 'src/passes/Inlining.cpp')
-rw-r--r-- | src/passes/Inlining.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index 681109af8..11f452e17 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -79,17 +79,20 @@ struct FunctionInfo { bool worthInlining(PassOptions& options) { // if it's big, it's just not worth doing (TODO: investigate more) - if (size > FLEXIBLE_SIZE_LIMIT) + if (size > FLEXIBLE_SIZE_LIMIT) { return false; + } // if it's so small we have a guarantee that after we optimize the // size will not increase, inline it - if (size <= INLINING_OPTIMIZING_WILL_DECREASE_SIZE_LIMIT) + if (size <= INLINING_OPTIMIZING_WILL_DECREASE_SIZE_LIMIT) { return true; + } // if it has one use, then inlining it would likely reduce code size // since we are just moving code around, + optimizing, so worth it // if small enough that we are pretty sure its ok - if (calls == 1 && !usedGlobally && size <= CAREFUL_SIZE_LIMIT) + if (calls == 1 && !usedGlobally && size <= CAREFUL_SIZE_LIMIT) { return true; + } // more than one use, so we can't eliminate it after inlining, // so only worth it if we really care about speed and don't care // about size, and if it's lightweight so a good candidate for @@ -300,8 +303,9 @@ struct Inlining : public Pass { state.worthInlining.insert(func->name); } }); - if (state.worthInlining.size() == 0) + if (state.worthInlining.size() == 0) { return false; + } // fill in actionsForFunction, as we operate on it in parallel (each // function to its own entry) for (auto& func : module->functions) { @@ -323,16 +327,18 @@ struct Inlining : public Pass { // avoid risk of races // note that we do not risk stalling progress, as each iteration() will // inline at least one call before hitting this - if (inlinedUses.count(func->name)) + if (inlinedUses.count(func->name)) { continue; + } for (auto& action : state.actionsForFunction[func->name]) { auto* inlinedFunction = action.contents; // if we've inlined into a function, don't inline it in this iteration, // avoid risk of races // note that we do not risk stalling progress, as each iteration() will // inline at least one call before hitting this - if (inlinedInto.count(inlinedFunction)) + if (inlinedInto.count(inlinedFunction)) { continue; + } Name inlinedName = inlinedFunction->name; #ifdef INLINING_DEBUG std::cout << "inline " << inlinedName << " into " << func->name << '\n'; |