Wasm: Fix hardcoding _Unwind_CallPersonality function name#167612
Wasm: Fix hardcoding _Unwind_CallPersonality function name#167612
Conversation
|
@llvm/pr-subscribers-backend-webassembly Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167612.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index 1ea3e6bcb15ce..a9a2df406143e 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -85,6 +85,7 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -273,8 +274,13 @@ bool WasmEHPrepareImpl::prepareEHPads(Function &F) {
// instruction selection.
CatchF = Intrinsic::getOrInsertDeclaration(&M, Intrinsic::wasm_catch);
+ // FIXME: Verify this is really supported for current module.
+ StringRef UnwindCallPersonalityName =
+ RTLIB::RuntimeLibcallsInfo::getLibcallImplName(
+ RTLIB::_Unwind_CallPersonality);
+
// _Unwind_CallPersonality() wrapper function, which calls the personality
- CallPersonalityF = M.getOrInsertFunction("_Unwind_CallPersonality",
+ CallPersonalityF = M.getOrInsertFunction(UnwindCallPersonalityName,
IRB.getInt32Ty(), IRB.getPtrTy());
if (Function *F = dyn_cast<Function>(CallPersonalityF.getCallee()))
F->setDoesNotThrow();
|
fe8e8a2 to
d79bdb3
Compare
|
Should there be something in an implementation file or tablegen somewhere that actually defines the name? |
Yes, this is defined in RuntimeLibcalls.td. RTLIB::impl__Unwind_CallPersonality directly corresponds to this string. This is the bare minimum to stop using the hardcoded name. Technically this should be querying which implementation from LibcallLoweringInfo from UNWIND_CALL_PERSONALITY, but that requires future boilerplate |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/110/builds/6262 Here is the relevant piece of the build log for the reference |

No description provided.