From b55a5b47e2c660e353ec7b3d45fd2e13597474dc Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 9 Apr 2002 20:43:18 +0000 Subject: [PATCH] New testcase git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2218 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../LevelRaise/2002-04-09-MissedRaise.ll | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/Transforms/LevelRaise/2002-04-09-MissedRaise.ll diff --git a/test/Transforms/LevelRaise/2002-04-09-MissedRaise.ll b/test/Transforms/LevelRaise/2002-04-09-MissedRaise.ll new file mode 100644 index 00000000000..b7a9e32eed0 --- /dev/null +++ b/test/Transforms/LevelRaise/2002-04-09-MissedRaise.ll @@ -0,0 +1,49 @@ +; This example was not getting level raised because of a negative index from +; this instruction: +; %reg111 = add int %reg110, -12 +; this testcase is distilled from this C source: +; void foo(int j, int *x) { +; unsigned i; +; for (i = 12; i < 14; ++i) +; x[j*i-12] = j; +; } + +; RUN: if as < %s | opt -raise | dis | grep ' cast ' | grep '*' +; RUN: then exit 1 +; RUN: else exit 0 +; RUN: fi + +implementation + +void "foo"(int %j, int * %x) +begin +bb0: ;[#uses=0] + br label %bb1 + +bb1: ;[#uses=2] + %reg108 = cast int * %x to sbyte * ; [#uses=1] + %cond219 = setgt ulong 12, 13 ; [#uses=1] + br bool %cond219, label %bb3, label %bb2 + +bb2: ;[#uses=3] + %cann-indvar = phi uint [ 0, %bb1 ], [ %add1-indvar, %bb2 ] ; [#uses=2] + %reg117 = add uint %cann-indvar, 12 ; [#uses=2] + %add1-indvar = add uint %cann-indvar, 1 ; [#uses=1] + %cast224 = cast uint %reg117 to uint ; [#uses=1] + %cast225 = cast uint %reg117 to int ; [#uses=1] + %reg110 = mul int %j, %cast225 ; [#uses=1] + %reg111 = add int %reg110, -12 ; [#uses=1] + %cast222 = cast int %reg111 to uint ; [#uses=1] + %reg113 = shl uint %cast222, ubyte 2 ; [#uses=1] + %cast114 = cast uint %reg113 to ulong ; [#uses=1] + %cast115 = cast ulong %cast114 to sbyte * ; [#uses=1] + %reg116 = add sbyte * %reg108, %cast115 ; [#uses=1] + %cast223 = cast sbyte * %reg116 to int * ; [#uses=1] + store int %j, int * %cast223 + %reg118 = add uint %cast224, 1 ; [#uses=1] + %cond220 = setle uint %reg118, 13 ; [#uses=1] + br bool %cond220, label %bb2, label %bb3 + +bb3: ;[#uses=2] + ret void +end