add another case, this one that uses getelementptr instructions
authorChris Lattner <sabre@nondot.org>
Mon, 26 Sep 2005 06:51:50 +0000 (06:51 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 26 Sep 2005 06:51:50 +0000 (06:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23448 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/GlobalOpt/ctor-list-opt.ll

index 2e713469c5f9d12331078418098674fd945bf197..ae198b46560ea1b0bedfa6795f9607998a50b805 100644 (file)
@@ -1,12 +1,13 @@
 ; RUN: llvm-as < %s | opt -globalopt -disable-output &&
 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep CTOR
 
-%llvm.global_ctors = appending global [6 x { int, void ()* }] [ 
+%llvm.global_ctors = appending global [7 x { int, void ()* }] [ 
   { int, void ()* } { int 65535, void ()* %CTOR1 },
   { int, void ()* } { int 65535, void ()* %CTOR1 },
   { int, void ()* } { int 65535, void ()* %CTOR2 },
   { int, void ()* } { int 65535, void ()* %CTOR3 },
   { int, void ()* } { int 65535, void ()* %CTOR4 },
+  { int, void ()* } { int 65535, void ()* %CTOR5 },
   { int, void ()* } { int 2147483647, void ()* null }
 ]
 
@@ -14,6 +15,8 @@
 %G2 = global int 0
 %G3 = global int -123
 
+%X = global {int, [2 x int]} { int 0, [2 x int] [ int 17, int 21] }
+
 %CTORGV = internal global bool false    ;; Should become constant after eval
 
 implementation
@@ -48,6 +51,15 @@ internal void %CTOR4() {
        ret void
 }
 
+internal void %CTOR5() {
+       %X.2p = getelementptr {int,[2 x int]}* %X, int 0, uint 1, int 0
+       %X.2 = load int* %X.2p
+       %X.1p = getelementptr {int,[2 x int]}* %X, int 0, uint 0
+       store int %X.2, int* %X.1p
+       store int 42, int* %X.2p
+       ret void
+}
+
 bool %accessor() {
        %V = load bool* %CTORGV   ;; constant true
        ret bool %V