[llvm] [WebAssembly] Add path to PIC mode for wasm tables (PR #67545)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 08:34:55 PDT 2023
================
@@ -1724,8 +1724,14 @@ SDValue WebAssemblyTargetLowering::LowerGlobalAddress(SDValue Op,
fail(DL, DAG, "Invalid address space for WebAssembly target");
unsigned OperandFlags = 0;
- if (isPositionIndependent()) {
- const GlobalValue *GV = GA->getGlobal();
+ const GlobalValue *GV = GA->getGlobal();
+ // is PIC but not a WebAssembly table.
+ // Since WebAssembly tables cannot yet be shared accross modules, we don't need special
+ // treatment for tables in PIC mode.
+ if (isPositionIndependent() &&
+ !(GV->getValueType()->isArrayTy() &&
+ WebAssembly::isWebAssemblyReferenceType(GV->getValueType()->getArrayElementType()))) {
----------------
sbc100 wrote:
How about writing a little helper to make this obvious, then we wouldn't need the comment: `isTableType(GV->getValueType())` ?
https://github.com/llvm/llvm-project/pull/67545
More information about the llvm-commits
mailing list