diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-08 22:20:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-08 22:20:55 +0000 |
commit | 44f87aca32be07fe3c8dfc1a0bbb178554d1e7d6 (patch) | |
tree | b04f302cc7a9893fc5613f87078747b5cd0e010f /test/Transforms/Reassociate | |
parent | 4fd56003ab29e3662c909bb10e47daa97ceb55ab (diff) | |
download | external_llvm-44f87aca32be07fe3c8dfc1a0bbb178554d1e7d6.zip external_llvm-44f87aca32be07fe3c8dfc1a0bbb178554d1e7d6.tar.gz external_llvm-44f87aca32be07fe3c8dfc1a0bbb178554d1e7d6.tar.bz2 |
New testcase for LICM reassociation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2560 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Reassociate')
-rw-r--r-- | test/Transforms/Reassociate/looptest.ll | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/looptest.ll b/test/Transforms/Reassociate/looptest.ll new file mode 100644 index 0000000..af516c6 --- /dev/null +++ b/test/Transforms/Reassociate/looptest.ll @@ -0,0 +1,59 @@ +; This testcase comes from this C fragment: +; +; void test(unsigned Num, int *Array) { +; unsigned i, j, k; +; +; for (i = 0; i != Num; ++i) +; for (j = 0; j != Num; ++j) +; for (k = 0; k != Num; ++k) +; printf("%d\n", i+k+j); /* Reassociate to (i+j)+k */ +;} +; +; In this case, we want to reassociate the specified expr so that i+j can be +; hoisted out of the inner most loop. +; +; RUN: if as < %s | opt -reassociate | dis | grep 115 | grep 117 +; RUN: then exit 1 +; RUN: else exit 0 +; RUN: fi + +%.LC0 = internal global [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1] + +declare int "printf"(sbyte*, ...) + +void "test"(uint %Num, int* %Array) { +bb0: ;[#uses=1] + %cond221 = seteq uint 0, %Num ; <bool> [#uses=3] + br bool %cond221, label %bb7, label %bb2 + +bb2: ;[#uses=3] + %reg115 = phi uint [ %reg120, %bb6 ], [ 0, %bb0 ] ; <uint> [#uses=2] + br bool %cond221, label %bb6, label %bb3 + +bb3: ;[#uses=3] + %reg116 = phi uint [ %reg119, %bb5 ], [ 0, %bb2 ] ; <uint> [#uses=2] + br bool %cond221, label %bb5, label %bb4 + +bb4: ;[#uses=3] + %reg117 = phi uint [ %reg118, %bb4 ], [ 0, %bb3 ] ; <uint> [#uses=2] + %reg113 = add uint %reg115, %reg117 ; <uint> [#uses=1] + %reg114 = add uint %reg113, %reg116 ; <uint> [#uses=1] + %cast227 = getelementptr [4 x sbyte]* %.LC0, uint 0, uint 0 ; <sbyte*> [#uses=1] + call int (sbyte*, ...)* %printf( sbyte* %cast227, uint %reg114 ) ; <int>:0 [#uses=0] + %reg118 = add uint %reg117, 1 ; <uint> [#uses=2] + %cond224 = setne uint %reg118, %Num ; <bool> [#uses=1] + br bool %cond224, label %bb4, label %bb5 + +bb5: ;[#uses=3] + %reg119 = add uint %reg116, 1 ; <uint> [#uses=2] + %cond225 = setne uint %reg119, %Num ; <bool> [#uses=1] + br bool %cond225, label %bb3, label %bb6 + +bb6: ;[#uses=3] + %reg120 = add uint %reg115, 1 ; <uint> [#uses=2] + %cond226 = setne uint %reg120, %Num ; <bool> [#uses=1] + br bool %cond226, label %bb2, label %bb7 + +bb7: ;[#uses=2] + ret void +} |