[PATCH] D52704: Improve static analysis of cold basic blocks
Aditya Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 2 23:22:55 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343663: Improve static analysis of cold basic blocks (authored by hiraditya, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D52704?vs=167652&id=168072#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52704
Files:
llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
Index: llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -111,6 +111,18 @@
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 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52704.168072.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181003/5b423057/attachment.bin>
More information about the llvm-commits
mailing list