[all-commits] [llvm/llvm-project] 1b6d87: [WebAssembly] Fix code generated for atomic operat...

Sam Clegg via All-commits all-commits at lists.llvm.org
Tue Dec 8 18:53:20 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b6d879ec1fc4e883d0f1f580bbe9230215d9e80
      https://github.com/llvm/llvm-project/commit/1b6d879ec1fc4e883d0f1f580bbe9230215d9e80
  Author: Sam Clegg <sbc at chromium.org>
  Date:   2020-12-08 (Tue, 08 Dec 2020)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
    A llvm/test/CodeGen/WebAssembly/atomic-pic.ll
    M llvm/test/CodeGen/WebAssembly/offset-atomics.ll

  Log Message:
  -----------
  [WebAssembly] Fix code generated for atomic operations in PIC mode

The main this this test does is to add the `IsNotPIC` predicate to the
all the atomic instructions pattern that directly refer to
`tglobaladdr`.

This is because in PIC mode we need to generate separate instruction
sequence (either a direct global.get, or __memory_base + offset) for
accessing global addresses.

As part of this change I noticed that many of the `Requires` attributes
added to the instruction in `WebAssemblyInstrAtomics.td` were being
honored.  This is because the wrapped in a `let Predicates =
[HasAtomics]` block and it seems that that outer wrapping overrides any
`Requires` on defs within it.   As a workaround I removed the outer
`let` and added `HasAtomics` to all the inner `Requires`.  I believe
that all the instrucitons that don't have `Requires` explicit bottom out
in `ATOMIC_I` and `ATOMIC_NRI` which have `HasAtomics` so this should
not remove this predicate from any patterns (at least that is the idea).

The alternative to this approach looks like implementing something
like `PredicateControl` in `Mips.td` where we can split the predicates
into groups so they don't clobber each other.

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




More information about the All-commits mailing list