1; RUN: llc -march=arm64 -o -  %s | FileCheck %s
2
3; ARM64ISelLowering.cpp was creating a new (floating-point) load for efficiency
4; but not updating chain-successors of the old one. As a result, the two memory
5; operations in this function both ended up direct successors to the EntryToken
6; and could be reordered.
7
8@var = global i32 0, align 4
9
10define float @foo() {
11; CHECK-LABEL: foo:
12  ; Load must come before we clobber @var
13; CHECK: adrp x[[VARBASE:[0-9]+]], {{_?var}}
14; CHECK: ldr [[SREG:s[0-9]+]], [x[[VARBASE]],
15; CHECK: str wzr, [x[[VARBASE]],
16
17  %val = load i32* @var, align 4
18  store i32 0, i32* @var, align 4
19
20  %fltval = sitofp i32 %val to float
21  ret float %fltval
22}
23