[PATCH] D107102: [WebAssembly] Add new pass to lower int/ptr conversions of reftypes
Paulo Matos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 29 14:39:46 PDT 2021
pmatos added a comment.
In D107102#2914633 <https://reviews.llvm.org/D107102#2914633>, @tlively wrote:
> Another approach would be to lower to DEBUG_UNREACHABLE, which is the normal unreachable instruction but not modeled as a terminator (see WebAssemblyInstrControl.td). I imagine you could use more standard ISel patterns for that lowering rather than introducing a separate pass.
Didn't know about `DEBUG_UNREACHABLE`, thanks. However, I notice this is too low in the compiler. I need to generate IR instructions and `DEBUG_UNREACHABLE` seems to be a machine instruction. Still don't think however that using normal patterns would work. The issue has to do with the fact that `inttoptr` and `ptrtoint` instructions are lowered during ISel Lowering and don't reach pattern matching. So, once you go into `SelectionDAGISel::runOnMachineFunction(MF);`, the function `visitPtrToInt` will try to generate a `TRUNCATE` for a reference type which will assert because of the zero size. So anything we do here, should be done `PreISel` as far as I understand.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107102/new/
https://reviews.llvm.org/D107102
More information about the llvm-commits
mailing list