• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs < %s | FileCheck %s
2
3define i32 @foo(i32* %var, i1 %cond) {
4; CHECK-LABEL: foo:
5  br i1 %cond, label %atomic_ver, label %simple_ver
6simple_ver:
7  %oldval = load i32, i32* %var
8  %newval = add nsw i32 %oldval, -1
9  store i32 %newval, i32* %var
10  br label %somewhere
11atomic_ver:
12  fence seq_cst
13  %val = atomicrmw add i32* %var, i32 -1 monotonic
14  fence seq_cst
15  br label %somewhere
16; CHECK: dmb
17; CHECK: ldxr
18; CHECK: dmb
19  ; The key point here is that the second dmb isn't immediately followed by the
20  ; simple_ver basic block, which LLVM attempted to do when DMB had been marked
21  ; with isBarrier. For now, look for something that looks like "somewhere".
22; CHECK-NEXT: mov
23somewhere:
24  %combined = phi i32 [ %val, %atomic_ver ], [ %newval, %simple_ver]
25  ret i32 %combined
26}
27