diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-01-21 00:35:11 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-01-21 00:35:11 +0000 |
commit | e25ffdf8a18a4b20c6bab43b25687c0143473853 (patch) | |
tree | 4ca73f6c2e47cb6a0544a600bb4939348231c913 /clang/lib/CodeGen/CGCleanup.cpp | |
parent | b3fd5cfa81b830adbadc96f706e364ac1753f5c6 (diff) | |
download | bcm5719-llvm-e25ffdf8a18a4b20c6bab43b25687c0143473853.tar.gz bcm5719-llvm-e25ffdf8a18a4b20c6bab43b25687c0143473853.zip |
Revert "CodeGen: Simplify CodeGenFunction::EmitCaseStmt"
I misunderstood the discussion on this. The complexity here is
justified by the malloc overhead it saves.
This reverts commit r199302.
llvm-svn: 199700
Diffstat (limited to 'clang/lib/CodeGen/CGCleanup.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCleanup.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 4983ce93437..3cf21bb9c33 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -885,6 +885,29 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { } } +/// isObviouslyBranchWithoutCleanups - Return true if a branch to the +/// specified destination obviously has no cleanups to run. 'false' is always +/// a conservatively correct answer for this method. +bool CodeGenFunction::isObviouslyBranchWithoutCleanups(JumpDest Dest) const { + assert(Dest.getScopeDepth().encloses(EHStack.stable_begin()) + && "stale jump destination"); + + // Calculate the innermost active normal cleanup. + EHScopeStack::stable_iterator TopCleanup = + EHStack.getInnermostActiveNormalCleanup(); + + // If we're not in an active normal cleanup scope, or if the + // destination scope is within the innermost active normal cleanup + // scope, we don't need to worry about fixups. + if (TopCleanup == EHStack.stable_end() || + TopCleanup.encloses(Dest.getScopeDepth())) // works for invalid + return true; + + // Otherwise, we might need some cleanups. + return false; +} + + /// Terminate the current block by emitting a branch which might leave /// the current cleanup-protected scope. The target scope may not yet /// be known, in which case this will require a fixup. |