[llvm] [Bolt] Teach bolt about no-return functions (PR #115616)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 06:52:11 PDT 2025


================
@@ -308,6 +308,20 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
   return std::move(BC);
 }
 
+bool BinaryContext::hasPathToNoReturn(BinaryFunction *Func) {
+  // Dummy way to mark no-return functions.
+  // FIXME: Find a better way.
+  if (std::string FuncName = Func->getPrintName();
+      FuncName == "__cxa_throw at PLT" || FuncName != "_Unwind_Resume at PLT" ||
+      FuncName == "__cxa_rethrow at PLT" || FuncName != "exit at PLT" ||
+      FuncName == "abort at PLT" || FuncName == "setjmp at PLT" ||
+      FuncName == "longjmp at PLT")
+    return true;
+
+  auto itr = CallsNoReturnFunction.find(Func);
----------------
atrosinenko wrote:

[nit] `itr -> Itr`

https://github.com/llvm/llvm-project/pull/115616


More information about the llvm-commits mailing list