llvm.org GIT mirror llvm / c9cf350
Fix recent regression in gcc.dg/pr26719.c (6835035). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70386 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 10 years ago
2 changed file(s) with 48 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
811811 SCEVHandle Step = AR->getStepRecurrence(*this);
812812
813813 // Check whether the backedge-taken count can be losslessly casted to
814 // the addrec's type. The count is always unsigned.
814 // the addrec's type. The count needs to be the same whether sign
815 // extended or zero extended.
815816 SCEVHandle CastedBECount =
816817 getTruncateOrZeroExtend(BECount, Start->getType());
817818 if (BECount ==
818 getTruncateOrZeroExtend(CastedBECount, BECount->getType())) {
819 getTruncateOrZeroExtend(CastedBECount, BECount->getType()) &&
820 BECount ==
821 getTruncateOrSignExtend(CastedBECount, BECount->getType())) {
819822 const Type *WideTy =
820823 IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
821824 SCEVHandle SMul =
0 ; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep mul | count 3
1 ; The multiply in bb2 must not be reduced to an add, as the sext causes the
2 ; %1 argument to become negative after a while.
3 ; ModuleID = ''
4 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-f80:128:128"
5 target triple = "i386-apple-darwin9.6"
6 @table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2]
7
8 define i32 @main() nounwind {
9 bb4.thread:
10 br label %bb2
11
12 bb2: ; preds = %bb4, %bb2, %bb4.thread
13 %i.0.reg2mem.0.ph = phi i32 [ 0, %bb4.thread ], [ %i.0.reg2mem.0.ph, %bb2 ], [ %indvar.next9, %bb4 ] ; [#uses=4]
14 %j.0.reg2mem.0 = phi i32 [ 0, %bb4.thread ], [ %indvar.next, %bb2 ], [ 0, %bb4 ] ; [#uses=3]
15 %0 = trunc i32 %j.0.reg2mem.0 to i8 ; [#uses=1]
16 %1 = sext i8 %0 to i32 ; [#uses=1]
17 %2 = mul i32 %1, %i.0.reg2mem.0.ph ; [#uses=1]
18 %3 = getelementptr [32 x [256 x i32]]* @table, i32 0, i32 %i.0.reg2mem.0.ph, i32 %j.0.reg2mem.0 ; [#uses=1]
19 store i32 %2, i32* %3, align 4
20 %indvar.next = add i32 %j.0.reg2mem.0, 1 ; [#uses=2]
21 %exitcond = icmp eq i32 %indvar.next, 256 ; [#uses=1]
22 br i1 %exitcond, label %bb4, label %bb2
23
24 bb4: ; preds = %bb2
25 %indvar.next9 = add i32 %i.0.reg2mem.0.ph, 1 ; [#uses=2]
26 %exitcond10 = icmp eq i32 %indvar.next9, 32 ; [#uses=1]
27 br i1 %exitcond10, label %bb5, label %bb2
28
29 bb5: ; preds = %bb4
30 %4 = load i32* getelementptr ([32 x [256 x i32]]* @table, i32 0, i32 9, i32 132), align 16 ; [#uses=1]
31 %5 = icmp eq i32 %4, -1116 ; [#uses=1]
32 br i1 %5, label %bb7, label %bb6
33
34 bb6: ; preds = %bb5
35 tail call void @abort() noreturn nounwind
36 unreachable
37
38 bb7: ; preds = %bb5
39 ret i32 0
40 }
41
42 declare void @abort() noreturn nounwind