From e56f4a49b7cd62d05a41c88743eb5172b63788bc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 24 Jun 2009 01:22:30 +0000 Subject: [PATCH] Add a testcase demoing some of ScalarEvolution's new trip count logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74049 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/ScalarEvolution/trip-count6.ll | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/Analysis/ScalarEvolution/trip-count6.ll diff --git a/test/Analysis/ScalarEvolution/trip-count6.ll b/test/Analysis/ScalarEvolution/trip-count6.ll new file mode 100644 index 00000000000..a6674092e79 --- /dev/null +++ b/test/Analysis/ScalarEvolution/trip-count6.ll @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | opt -analyze -disable-output -scalar-evolution \ +; RUN: | grep {max backedge-taken count is 1\$} + +@mode_table = global [4 x i32] zeroinitializer ; <[4 x i32]*> [#uses=1] + +define i8 @f() { +entry: + tail call i32 @fegetround( ) ; :0 [#uses=1] + br label %bb + +bb: ; preds = %bb4, %entry + %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ] ; [#uses=4] + zext i8 %mode.0 to i32 ; :1 [#uses=1] + getelementptr [4 x i32]* @mode_table, i32 0, i32 %1 ; :2 [#uses=1] + load i32* %2, align 4 ; :3 [#uses=1] + icmp eq i32 %3, %0 ; :4 [#uses=1] + br i1 %4, label %bb1, label %bb2 + +bb1: ; preds = %bb + ret i8 %mode.0 + +bb2: ; preds = %bb + icmp eq i8 %mode.0, 1 ; :5 [#uses=1] + br i1 %5, label %bb5, label %bb4 + +bb4: ; preds = %bb2 + %indvar.next = add i8 %mode.0, 1 ; [#uses=1] + br label %bb + +bb5: ; preds = %bb2 + tail call void @raise_exception( ) noreturn + unreachable +} + +declare i32 @fegetround() + +declare void @raise_exception() noreturn