blob: c6936362048b3a511f48107e4ea1efde4e3fff1a [file] [log] [blame]
Evan Cheng306b4ca2010-01-08 23:41:50 +00001; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s
2; rdar://r7512579
3
4; PHI defs in the atomic loop should be used by the add / adc
5; instructions. They should not be dead.
6
7define void @t(i64* nocapture %p) nounwind ssp {
8entry:
9; CHECK: t:
10; CHECK: movl $1
11; CHECK: movl (%ebp), %eax
12; CHECK: movl 4(%ebp), %edx
Dan Gohman9f23dee2010-04-17 16:29:15 +000013; CHECK: LBB0_1:
Evan Cheng306b4ca2010-01-08 23:41:50 +000014; CHECK-NOT: movl $1
15; CHECK-NOT: movl $0
16; CHECK: addl
17; CHECK: adcl
18; CHECK: lock
19; CHECK: cmpxchg8b
20; CHECK: jne
21 tail call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
22 %0 = tail call i64 @llvm.atomic.load.add.i64.p0i64(i64* %p, i64 1) ; <i64> [#uses=0]
23 tail call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
24 ret void
25}
26
27declare void @llvm.memory.barrier(i1, i1, i1, i1, i1) nounwind
28
29declare i64 @llvm.atomic.load.add.i64.p0i64(i64* nocapture, i64) nounwind