[PATCH] D18200: Add __atomic_* lowering to AtomicExpandPass.
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 11:43:55 PDT 2016
reames added inline comments.
Comment at: lib/CodeGen/AtomicExpandPass.cpp:115
@@ +114,3 @@
+ unsigned Align = LI->getAlignment();
+ if (Align == 0)
+ return DL.getABITypeAlignment(LI->getType());
> reames wrote:
> > Alignment can't be zero for atomic instructions. Make this an assert.
> I want to change that, to allow specifying atomic IR instructions with any alignment. They'll be expanded to a libcall which uses a mutex if unaligned, of course.
> From original plan email:
> > A4) In LLVM, add "align" attributes to cmpxchg and atomicrmw, and allow specifying "align" values for "load atomic" and "store atomic". LLVM will lower them to the generic library calls. In clang, start lowering misaligned atomics to these llvm instructions as well.
This sounds like a reasonable future direction, but it is not the state as of this patch. As a result, you'd be introducing completely dead code if you landed as is. Please do not do this. Introduce the assert, then change in a future commit which actually introduces the new language feature.
More information about the llvm-commits