[PATCH] D18200: Add __atomic_* lowering to AtomicExpandPass.
James Y Knight via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 18:34:01 PDT 2016
jyknight added inline comments.
Comment at: lib/CodeGen/AtomicExpandPass.cpp:1177
@@ +1176,3 @@
+ // Build up the function call. There's two kinds. First, the sized
+ // variants. These calls are going to be one of the following (with
> If I'm reading the documentation correctly, the sized versions are purely an optimization over the generic versions correct? The compiler is free to emit a mix of sized and generic calls on the same object?
> If so, it would be nice to have the code reflect that. In particular, it might make sense to extract a helper function which specializes generic calls with known sizes to the specialized form, and use that in way that manually written generic calls get specialized as well. I think that would also give you an logically distinct chunk which could be factored out and submitted separately.
That is correct. Except that there's no generic version of some of the functions (the integer math ones).
Also, I'm not sure I followed what you're suggesting. Are you saying you'd like the code to emit a call to a non-size-specialized function, and then run a later optimization pass to turn that into another call, to a size-specialized function?
If so, I think that'd be strictly worse. Going through an intermediate step would provide no value. There should be no manually written calls to these library functions. Users call the clang builtins (or, even better, the C11/C++11 standard functions), which will get lowered to "load atomic", "store atomic", "atomicrmw", or "cmpxchg" llvm IR instructions. From those, we'll end up here.
And if someone is crazy and calls the library functions directly, llvm shouldn't do try to identify those calls and do anything to them.
More information about the llvm-commits