[RISCV] Avoid emitting hardware fences for singlethread fences
authorPhilip Reames <preames@rivosinc.com>
Tue, 10 Jan 2023 17:51:56 +0000 (09:51 -0800)
committerPhilip Reames <listmail@philipreames.com>
Tue, 10 Jan 2023 18:09:59 +0000 (10:09 -0800)
commitc4ce1e0131aa04cec4803740c3c203c7f000e837
tree8c838ce45b58c045783c1a43d293ede35d434a4a
parentd8534e4e981da5ff9907999eb549b3a1d075a69b
[RISCV] Avoid emitting hardware fences for singlethread fences

singlethread fences only synchronize with code running on the same hardware thread (i.e. signal handlers). Because of this, we need to prevent instruction reordering, but do not need to emit hardware fence instructions.

The implementation strategy here matches many other backends. The main motivation of this patch is to introduce the MEMBARRIER node and get some test coverage for it.

Differential Revision: https://reviews.llvm.org/D141311
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/test/CodeGen/RISCV/atomic-fence.ll