diff options
author | Aditya Kumar <hiraditya@msn.com> | 2018-10-03 06:21:05 +0000 |
---|---|---|
committer | Aditya Kumar <hiraditya@msn.com> | 2018-10-03 06:21:05 +0000 |
commit | a27014b85169692442ed857312473afad701c1f7 (patch) | |
tree | 2c06db2b7f161173a71b457893da566f6ef8b173 /llvm/lib/Transforms/IPO/HotColdSplitting.cpp | |
parent | 9e20ade72aeb950cb4849de8396821234f8c2ef6 (diff) | |
download | bcm5719-llvm-a27014b85169692442ed857312473afad701c1f7.tar.gz bcm5719-llvm-a27014b85169692442ed857312473afad701c1f7.zip |
Improve static analysis of cold basic blocks
Differential Revision: https://reviews.llvm.org/D52704
Reviewers: sebpop, tejohnson, brzycki, SirishP
Reviewed By: sebpop
llvm-svn: 343663
Diffstat (limited to 'llvm/lib/Transforms/IPO/HotColdSplitting.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index 820d08316d6..810fdf418a2 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -111,6 +111,18 @@ bool blockEndsInUnreachable(const BasicBlock &BB) { return succ_empty(&BB); } +static bool exceptionHandlingFunctions(const CallInst *CI) { + auto F = CI->getCalledFunction(); + if (!F) + return false; + auto FName = F->getName(); + return FName == "__cxa_begin_catch" || + FName == "__cxa_free_exception" || + FName == "__cxa_allocate_exception" || + FName == "__cxa_begin_catch" || + FName == "__cxa_end_catch"; +} + static bool unlikelyExecuted(const BasicBlock &BB) { if (blockEndsInUnreachable(BB)) @@ -122,7 +134,8 @@ bool unlikelyExecuted(const BasicBlock &BB) { if (const CallInst *CI = dyn_cast<CallInst>(&I)) { // The block is cold if it calls functions tagged as cold or noreturn. if (CI->hasFnAttr(Attribute::Cold) || - CI->hasFnAttr(Attribute::NoReturn)) + CI->hasFnAttr(Attribute::NoReturn) || + exceptionHandlingFunctions(CI)) return true; // Assume that inline assembly is hot code. |