Skip to content

AArch64 atomic operations disrupted by fast-regalloc #25900

@TNorthover

Description

@TNorthover
Bugzilla Link 25526
Resolution FIXED
Resolved on Nov 19, 2016 14:13
Version trunk
OS All
CC @compnerd,@emaste,@jyknight,@kbeyls,@TNorthover

Extended Description

When compiling this at -O0:

define {i64, i1} @​foo(i64* %addr, i64 %desired, i64 %new) {
  %old = cmpxchg i64* %addr, i64 %desired, i64 %new seq_cst seq_cst
  ret {i64, i1} %old
}

Fast-regalloc seems to insert many spills between the ldaxr and the stlxr. If these are on the same cache-line as %addr (in practice) then they can reset the monitor causing the operation to fail.

ARM is almost certainly affected too. But both only at -O0.

I'm still not sure what to do about this one. Some obvious options are:

  1. Go back to lots of pseudo-instructions for various different uses. Extremely nasty, we worked very hard to get rid of those for better codegen.
  2. Disable fast-regalloc in all cases. Probably bad for debug quality, so I doubt this is viable.
  3. Emit libcalls at -O0. I'm not sure all platforms support these though, we'd have to make sure they're available.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions