diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-02-05 19:56:38 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-02-05 19:56:38 +0000 |
commit | fad4d40f3792b0d9e101c40738e1f691131007d2 (patch) | |
tree | f16de5d50c2ef2d196835d461609c35331a7a25e /test/Transforms/GlobalOpt | |
parent | dc7c716a1cfc27a12f3bbfa44bd80904ee782779 (diff) | |
download | external_llvm-fad4d40f3792b0d9e101c40738e1f691131007d2.zip external_llvm-fad4d40f3792b0d9e101c40738e1f691131007d2.tar.gz external_llvm-fad4d40f3792b0d9e101c40738e1f691131007d2.tar.bz2 |
Teach GlobalOpt to handle atomic accesses to globals.
* Most of the transforms come through intact by having each transformed load or
store copy the ordering and synchronization scope of the original.
* The transform that turns a global only accessed in main() into an alloca
(since main is non-recursive) with a store of the initial value uses an
unordered store, since it's guaranteed to be the first thing to happen in main.
(Threads may have started before main (!) but they can't have the address of a
function local before the point in the entry block we insert our code.)
* The heap-SRoA transforms are disabled in the face of atomic operations. This
can probably be improved; it seems odd to have atomic accesses to an alloca
that doesn't have its address taken.
AnalyzeGlobal keeps track of the strongest ordering found in any use of the
global. This is more information than we need right now, but it's cheap to
compute and likely to be useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149847 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GlobalOpt')
-rw-r--r-- | test/Transforms/GlobalOpt/atomic.ll | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/atomic.ll b/test/Transforms/GlobalOpt/atomic.ll new file mode 100644 index 0000000..4c3f439 --- /dev/null +++ b/test/Transforms/GlobalOpt/atomic.ll @@ -0,0 +1,10 @@ +; RUN: opt -globalopt < %s -S -o - | FileCheck %s + +@GV1 = internal global i64 1 +; CHECK: @GV1 = internal unnamed_addr constant i64 1 + +define void @test1() { +entry: + %0 = load atomic i8* bitcast (i64* @GV1 to i8*) acquire, align 8 + ret void +} |