[all-commits] [llvm/llvm-project] 04e9cd: [WebAssembly] Fix for PIC external symbol ISEL

Wouter van Oortmerssen via All-commits all-commits at lists.llvm.org
Thu Apr 8 12:08:24 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04e9cd09c888fdb14a40289808859c63985a476b
      https://github.com/llvm/llvm-project/commit/04e9cd09c888fdb14a40289808859c63985a476b
  Author: Wouter van Oortmerssen <aardappel at gmail.com>
  Date:   2021-04-08 (Thu, 08 Apr 2021)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
    M llvm/test/CodeGen/WebAssembly/load-store-pic.ll

  Log Message:
  -----------
  [WebAssembly] Fix for PIC external symbol ISEL

wasm64 was missing DAG ISEL patterns for external symbol based global.get, but simply adding these analogous to the existing 32-bit versions doesn't work.
This is because we are conflating the 32-bit global index with the pointer represented by the external symbol, which for wasm32 happened to work.
The simplest fix is to pretend we have a 64-bit global index. This sounds incorrect, but is immaterial since once this index is stored as a MachineOperand it becomes 64-bit anyway (and has been all along). As such, the EmitInstrWithCustomInserter based implementation I experimented with become a no-op and no further changes in the C++ code are required.

Differential Revision: https://reviews.llvm.org/D99904




More information about the All-commits mailing list