[llvm-commits] [llvm] r81168 - /llvm/trunk/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll

Dan Gohman gohman at apple.com
Mon Sep 7 16:04:59 PDT 2009


Author: djg
Date: Mon Sep  7 18:04:59 2009
New Revision: 81168

URL: http://llvm.org/viewvc/llvm-project?rev=81168&view=rev
Log:
Add a testcase for the GlobalOpt inbounds fix.

Added:
    llvm/trunk/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll

Added: llvm/trunk/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll?rev=81168&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll (added)
+++ llvm/trunk/test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll Mon Sep  7 18:04:59 2009
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | FileCheck %s
+
+; Don't get fooled by the inbounds keyword; it doesn't change
+; the computed address.
+
+; CHECK: @H = global i32 2
+; CHECK: @I = global i32 2
+
+ at llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR } ]
+ at addr = external global i32
+ at G = internal global [6 x [5 x i32]] zeroinitializer
+ at H = global i32 80
+ at I = global i32 90
+
+define internal void @CTOR() {
+  store i32 1, i32* getelementptr ([6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
+  store i32 2, i32* getelementptr inbounds ([6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
+  %t = load i32* getelementptr ([6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
+  store i32 %t, i32* @H
+  %s = load i32* getelementptr inbounds ([6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
+  store i32 %s, i32* @I
+  ret void
+}





More information about the llvm-commits mailing list