From 5b17790ba5b66a17b95aabcf8f0f750bc9170fd0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 Oct 2002 23:31:09 +0000 Subject: [PATCH] Checkin new "feature" test for cee llvm-svn: 4054 --- .../Transforms/CorrelatedExprs/whet.ll | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 llvm/test/Regression/Transforms/CorrelatedExprs/whet.ll diff --git a/llvm/test/Regression/Transforms/CorrelatedExprs/whet.ll b/llvm/test/Regression/Transforms/CorrelatedExprs/whet.ll new file mode 100644 index 000000000000..c1e92f8e6f13 --- /dev/null +++ b/llvm/test/Regression/Transforms/CorrelatedExprs/whet.ll @@ -0,0 +1,48 @@ +; This code snippet is derived from the following "whetstone" style code: +; int whet(int j) { +; if (j == 1) j = 2; +; else j = 7; +; if (j > 2) j = 0; +; else j = 3; +; if (j < 1) j = 10; +; else j = 0; +; return j; +;} +; +; This should eliminate all BB's except BB0, BB9, BB10 +; +; RUN: if as < %s | opt -cee -instcombine -simplifycfg | dis | grep 'bb[2-8]' +; RUN: then exit 1 +; RUN: else exit 0 +; RUN: fi + +implementation ; Functions: + +int %whet(int %j) { +bb0: ; No predecessors! + %cond220 = setne int %j, 1 ; [#uses=1] + br bool %cond220, label %bb3, label %bb4 + +bb3: ; preds = %bb0 + br label %bb4 + +bb4: ; preds = %bb3, %bb0 + %reg111 = phi int [ 7, %bb3 ], [ 2, %bb0 ] ; [#uses=1] + %cond222 = setle int %reg111, 2 ; [#uses=1] + br bool %cond222, label %bb6, label %bb7 + +bb6: ; preds = %bb4 + br label %bb7 + +bb7: ; preds = %bb6, %bb4 + %reg114 = phi int [ 3, %bb6 ], [ 0, %bb4 ] ; [#uses=1] + %cond225 = setgt int %reg114, 0 ; [#uses=1] + br bool %cond225, label %bb9, label %bb10 + +bb9: ; preds = %bb7 + br label %bb10 + +bb10: ; preds = %bb9, %bb7 + %reg117 = phi int [ 0, %bb9 ], [ 10, %bb7 ] ; [#uses=1] + ret int %reg117 +}