From: Chris Lattner Date: Mon, 19 Aug 2002 19:08:52 +0000 (+0000) Subject: New testcase X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d03de90bb12a5a2b4f8626bc85e40e7a6d16c4a4;p=oota-llvm.git New testcase git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3385 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVars.ll b/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVars.ll new file mode 100644 index 00000000000..7dfbf900604 --- /dev/null +++ b/test/Transforms/FunctionResolve/2002-08-19-ResolveGlobalVars.ll @@ -0,0 +1,25 @@ +; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved correctly. +; +; RUN: if as < %s | opt -gcse -instcombine -constprop -dce | dis | grep getelementptr +; RUN: then exit 1 +; RUN: else exit 0 +; RUN: fi +; + +%X = uninitialized global int ; [#uses=1] +%X = global [4 x int] [ int 1, int 2, int 3, int 4 ] ; <[4 x int]*> [#uses=1] + +implementation ; Functions: + +int %foo(int %x) { +bb1: ;[#uses=0] + %reg107-idxcast = cast int %x to uint ; [#uses=2] + %reg113 = getelementptr int* %X, uint %reg107-idxcast ; [#uses=1] + %reg120 = getelementptr [4 x int]* %X, uint 0, uint %reg107-idxcast ; [#uses=1] + %reg123 = sub int* %reg113, %reg120 ; [#uses=1] + %cast232 = cast int* %reg123 to long ; [#uses=1] + %reg234 = div long %cast232, 4 ; [#uses=1] + %cast108 = cast long %reg234 to int ; [#uses=1] + ret int %cast108 +} +