[PATCH] D92744: [WebAssembly] Fix code generated for atomic operations in PIC mode

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 6 21:55:51 PST 2020


sbc100 created this revision.
Herald added subscribers: wingo, ecnelises, jfb, sunfish, hiraditya, jgravelle-google, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

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

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

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` explcity 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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92744

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td
  llvm/test/CodeGen/WebAssembly/atomic-pic.ll
  llvm/test/CodeGen/WebAssembly/offset-atomics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92744.309810.patch
Type: text/x-patch
Size: 18060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201207/23dc6c55/attachment.bin>


More information about the llvm-commits mailing list