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

Gergely Bálint via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 05:18:27 PST 2024


================
@@ -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;
----------------
bgergely0 wrote:

`FuncName != "A" || FuncName != "B"` is always true.

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


More information about the llvm-commits mailing list