llvm-project/llvm/test/CodeGen
Christof Douma 8cfd91dcc7 [AArch64] Fix bug 35094 atomicrmw on Armv8.1-A+lse
Fixes https://bugs.llvm.org/show_bug.cgi?id=35094

The Dead register definition pass should leave alone the atomicrmw
instructions on AArch64 (LTE extension). The reason is the following
statement in the Arm ARM:

"The ST<OP> instructions, and LD<OP> instructions where the destination
register is WZR or XZR, are not regarded as doing a read for the purpose
of a DMB LD barrier."

A good example was given in the gcc thread by Will Deacon (linked in the
bugzilla ticket 35094):

    P0 (atomic_int* y,atomic_int* x) {
      atomic_store_explicit(x,1,memory_order_relaxed);
      atomic_thread_fence(memory_order_release);
      atomic_store_explicit(y,1,memory_order_relaxed);
    }

    P1 (atomic_int* y,atomic_int* x) {
      atomic_fetch_add_explicit(y,1,memory_order_relaxed);  // STADD
      atomic_thread_fence(memory_order_acquire);
      int r0 = atomic_load_explicit(x,memory_order_relaxed);
    }

    P2 (atomic_int* y) {
      int r1 = atomic_load_explicit(y,memory_order_relaxed);
    }

    My understanding is that it is forbidden for r0 == 0 and r1 == 2 after
    this test has executed. However, if the relaxed add in P1 compiles to
    STADD and the subsequent acquire fence is compiled as DMB LD, then we
    don't have any ordering guarantees in P1 and the forbidden result could
    be observed.

Change-Id: I419f9f9df947716932038e1100c18d10a96408d0
llvm-svn: 356360
2019-03-18 09:21:06 +00:00
..
AArch64 [AArch64] Fix bug 35094 atomicrmw on Armv8.1-A+lse 2019-03-18 09:21:06 +00:00
AMDGPU AMDGPU: Partially fix default device for HSA 2019-03-17 21:31:35 +00:00
ARC
ARM [ARM] Add MachineVerifier logic for some Thumb1 instructions. 2019-03-15 21:44:49 +00:00
AVR [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later. 2019-03-13 17:07:09 +00:00
BPF [BPF] Add BTF Var and DataSec Support 2019-03-16 15:36:31 +00:00
Generic [AVR] Remove unneeded XFAILs from the Generic CodeGen tests 2019-01-20 11:16:58 +00:00
Hexagon [Hexagon] Remove icmp undef from reduced tests 2019-03-15 15:07:44 +00:00
Inputs
Lanai
MIR MIR: Allow targets to serialize MachineFunctionInfo 2019-03-14 22:54:43 +00:00
MSP430 [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later. 2019-03-13 17:07:09 +00:00
Mips [MIPS GlobalISel] Improve selection of constants 2019-03-15 07:07:50 +00:00
NVPTX [Codegen] fix typos in test case 2019-03-02 08:03:59 +00:00
PowerPC [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later. 2019-03-13 17:07:09 +00:00
RISCV [RISCV] Extend test/CodeGen/RISCV/callee-saved-* to test getCalleePreservedRegs 2019-03-14 08:17:44 +00:00
SPARC [SPARC] Regenerate label test for D59363 2019-03-15 11:24:17 +00:00
SystemZ [SystemZ] Remove icmp undef 2019-03-14 11:56:41 +00:00
Thumb [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later. 2019-03-13 17:07:09 +00:00
Thumb2 [ARM] Check that CPSR does not have other uses 2019-03-17 21:36:15 +00:00
WebAssembly [WebAssembly] Make rethrow take an except_ref type argument 2019-03-16 05:38:57 +00:00
WinCFGuard
WinEH Fix invalid target triples in tests. (NFC) 2019-03-04 23:37:41 +00:00
X86 [DAGCombine] Fold (x & ~y) | y patterns 2019-03-17 15:45:38 +00:00
XCore [DAGCombiner] If a TokenFactor would be merged into its user, consider the user later. 2019-03-13 17:07:09 +00:00