[PATCH] D54661: [WebAssembly] Don't override default implementation of isOffsetFoldingLegal. NFC.
Derek Schuff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 19 17:41:20 PST 2018
dschuff added a comment.
Yeah I think for PIC code all globals need to be relative.
If I understand `isOffsetFoldingLegal`, currently we have `i32.load addr($pop)` where the addr is a constant and the offset comes from the stack (e.g. could be the result of a gep but is often `i32.const 0`) and the `addr` is the folded address of the global.
If there's no individual interposition we could use something like this in cases where it would have been `const 0` before:
get_global __memoryBase
i32.load addr($pop)
If there's a constant gep, it should actually be legal to fold that into the address too: `i32.load addr+n($pop)`.
If there's a variable gep, it has to be added to the memory base, but the addr can still be a constant relative to the memory base. Does that mean `isOffsetFoldingLegal` is true then? Not sure, I'd want to look at the code a bit more and also at e.g. our `address-offsets.ll` test.
Repository:
rL LLVM
https://reviews.llvm.org/D54661
More information about the llvm-commits
mailing list