[PATCH] D132882: [BOLT] Restrict ICP for functions with unknown control flow

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 15:50:57 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG31abde43d624: [BOLT] Restrict ICP for functions with unknown control flow (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132882/new/

https://reviews.llvm.org/D132882

Files:
  bolt/include/bolt/Passes/IndirectCallPromotion.h
  bolt/lib/Passes/IndirectCallPromotion.cpp


Index: bolt/lib/Passes/IndirectCallPromotion.cpp
===================================================================
--- bolt/lib/Passes/IndirectCallPromotion.cpp
+++ bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -1158,8 +1158,7 @@
     for (auto &BFIt : BFs) {
       BinaryFunction &Function = BFIt.second;
 
-      if (!Function.isSimple() || Function.isIgnored() ||
-          !Function.hasProfile())
+      if (!shouldOptimize(Function))
         continue;
 
       const bool HasLayout = !Function.getLayout().block_empty();
@@ -1219,7 +1218,7 @@
   for (BinaryFunction *FuncPtr : Functions) {
     BinaryFunction &Function = *FuncPtr;
 
-    if (!Function.isSimple() || Function.isIgnored() || !Function.hasProfile())
+    if (!shouldOptimize(Function))
       continue;
 
     const bool HasLayout = !Function.getLayout().block_empty();
Index: bolt/include/bolt/Passes/IndirectCallPromotion.h
===================================================================
--- bolt/include/bolt/Passes/IndirectCallPromotion.h
+++ bolt/include/bolt/Passes/IndirectCallPromotion.h
@@ -217,6 +217,10 @@
   bool shouldPrint(const BinaryFunction &BF) const override {
     return BinaryFunctionPass::shouldPrint(BF) && Modified.count(&BF) > 0;
   }
+  bool shouldOptimize(const BinaryFunction &BF) const override {
+    return BF.isSimple() && !BF.isIgnored() && BF.hasProfile() &&
+           !BF.hasUnknownControlFlow();
+  }
   void runOnFunctions(BinaryContext &BC) override;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132882.458904.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220908/b5d9aa8a/attachment.bin>


More information about the llvm-commits mailing list