From 0142677fe21b177a885a6843088a92cee754fce5 Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Mon, 2 Jul 2007 08:02:14 +0000 Subject: [PATCH] Test case for recent patch for IndVarSimplify.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37838 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../iterationCount_zext_or_trunc.ll | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/Transforms/IndVarsSimplify/iterationCount_zext_or_trunc.ll diff --git a/test/Transforms/IndVarsSimplify/iterationCount_zext_or_trunc.ll b/test/Transforms/IndVarsSimplify/iterationCount_zext_or_trunc.ll new file mode 100644 index 00000000000..0331f23f285 --- /dev/null +++ b/test/Transforms/IndVarsSimplify/iterationCount_zext_or_trunc.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | opt -indvars -disable-output + +; ModuleID = 'testcase.bc' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" +target triple = "i686-pc-linux-gnu" + +define i32 @testcase(i5 zext %k) { +entry: + br label %bb2 + +bb: ; preds = %bb2 + %tmp1 = add i32 %tmp2, %result ; [#uses=1] + %indvar_next1 = add i5 %k_0, 1 ; [#uses=1] + br label %bb2 + +bb2: ; preds = %bb, %entry + %k_0 = phi i5 [ 0, %entry ], [ %indvar_next1, %bb ] ; [#uses=2] + %result = phi i32 [ 0, %entry ], [ %tmp1, %bb ] ; [#uses=2] + %tmp2 = zext i5 %k_0 to i32 ; [#uses=1] + %exitcond = icmp eq i32 %tmp2, 16 ; [#uses=1] + br i1 %exitcond, label %bb3, label %bb + +bb3: ; preds = %bb2 + ret i32 %result +}