[PATCH] D12338: Make `llvm::expandAtomicRMWToCmpXchg`'s initial load atomic.

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 11:07:30 PDT 2015


jfb added a comment.

@jyasskin I took a look at implementing what we discussed <http://reviews.llvm.org/D12338#239615>, and it's quite a bit uglier than I though it would be:

- We want the same value that factors into `ATOMIC_*_LOCK_FREE`, which is `MaxAtomicInlineWidth` from `tools/clang/lib/Basic/Targets.cpp` (each `Target` should define a value there, or gets `0` by default).
- We can pass this to the backend through LLVM's `TargetOptions`, which clang's `BackendUtil.cpp` can initialize.
- `AtomicExpandPass` has a `TargetMachine`, which has `TargetOptions`.

This will work for code that come straight from C++, but won't work for code that only uses opt: clang has the information we need, and LLVM doesn't. This is pretty much something that should be in the `DataLayout` instead, which is a *very* involved change! WDYT? Am I missing something obvious?


http://reviews.llvm.org/D12338





More information about the llvm-commits mailing list