Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

@ -1,57 +0,0 @@
; RUN: opt < %s -loop-reduce -disable-output
define void @try_swap() {
entry:
br i1 false, label %cond_continue.0.i, label %cond_false.0.i
cond_false.0.i: ; preds = %entry
ret void
cond_continue.0.i: ; preds = %entry
br i1 false, label %cond_continue.1.i, label %cond_false.1.i
cond_false.1.i: ; preds = %cond_continue.0.i
ret void
cond_continue.1.i: ; preds = %cond_continue.0.i
br i1 false, label %endif.3.i, label %else.0.i
endif.3.i: ; preds = %cond_continue.1.i
br i1 false, label %my_irand.exit82, label %endif.0.i62
else.0.i: ; preds = %cond_continue.1.i
ret void
endif.0.i62: ; preds = %endif.3.i
ret void
my_irand.exit82: ; preds = %endif.3.i
br i1 false, label %else.2, label %then.4
then.4: ; preds = %my_irand.exit82
ret void
else.2: ; preds = %my_irand.exit82
br i1 false, label %find_affected_nets.exit, label %loopentry.1.i107.outer.preheader
loopentry.1.i107.outer.preheader: ; preds = %else.2
ret void
find_affected_nets.exit: ; preds = %else.2
br i1 false, label %save_region_occ.exit, label %loopentry.1
save_region_occ.exit: ; preds = %find_affected_nets.exit
br i1 false, label %no_exit.1.preheader, label %loopexit.1
loopentry.1: ; preds = %find_affected_nets.exit
ret void
no_exit.1.preheader: ; preds = %save_region_occ.exit
ret void
loopexit.1: ; preds = %save_region_occ.exit
br i1 false, label %then.10, label %loopentry.3
then.10: ; preds = %loopexit.1
ret void
loopentry.3: ; preds = %endif.16, %loopexit.1
%indvar342 = phi i32 [ %indvar.next343, %endif.16 ], [ 0, %loopexit.1 ] ; <i32> [#uses=2]
br i1 false, label %loopexit.3, label %endif.16
endif.16: ; preds = %loopentry.3
%indvar.next343 = add i32 %indvar342, 1 ; <i32> [#uses=1]
br label %loopentry.3
loopexit.3: ; preds = %loopentry.3
br label %loopentry.4
loopentry.4: ; preds = %loopentry.4, %loopexit.3
%indvar340 = phi i32 [ 0, %loopexit.3 ], [ %indvar.next341, %loopentry.4 ] ; <i32> [#uses=2]
%tmp. = add i32 %indvar340, %indvar342 ; <i32> [#uses=1]
%tmp.526 = load i32*, i32** null ; <i32*> [#uses=1]
%gep.upgrd.1 = zext i32 %tmp. to i64 ; <i64> [#uses=1]
%tmp.528 = getelementptr i32, i32* %tmp.526, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
store i32 0, i32* %tmp.528
%indvar.next341 = add i32 %indvar340, 1 ; <i32> [#uses=1]
br label %loopentry.4
}

View File

@ -1,17 +0,0 @@
; RUN: opt < %s -loop-reduce -disable-output
define i32 @image_to_texture(i32 %indvar454) {
loopentry.1.outer:
%j.2.1.ph = bitcast i32 %indvar454 to i32 ; <i32> [#uses=1]
br label %loopentry.1
loopentry.1: ; preds = %loopentry.1, %loopentry.1.outer
%i.3 = phi i32 [ 0, %loopentry.1.outer ], [ %i.3.be, %loopentry.1 ] ; <i32> [#uses=2]
%tmp.390 = load i32, i32* null ; <i32> [#uses=1]
%tmp.392 = mul i32 %tmp.390, %j.2.1.ph ; <i32> [#uses=1]
%tmp.394 = add i32 %tmp.392, %i.3 ; <i32> [#uses=1]
%i.3.be = add i32 %i.3, 1 ; <i32> [#uses=1]
br i1 false, label %loopentry.1, label %label.6
label.6: ; preds = %loopentry.1
ret i32 %tmp.394
}

View File

@ -1,32 +0,0 @@
; RUN: opt < %s -loop-reduce -disable-output
define void @main() {
entry:
br label %loopentry.0
loopentry.0: ; preds = %then.5, %entry
%arg_index.1.ph = phi i32 [ 1, %entry ], [ %arg_index.1.ph.be, %then.5 ] ; <i32> [#uses=1]
br i1 false, label %no_exit.0, label %loopexit.0
no_exit.0: ; preds = %loopentry.0
%arg_index.1.1 = add i32 0, %arg_index.1.ph ; <i32> [#uses=2]
br i1 false, label %then.i55, label %endif.i61
then.i55: ; preds = %no_exit.0
br i1 false, label %then.4, label %else.1
endif.i61: ; preds = %no_exit.0
ret void
then.4: ; preds = %then.i55
%tmp.19993 = add i32 %arg_index.1.1, 2 ; <i32> [#uses=0]
ret void
else.1: ; preds = %then.i55
br i1 false, label %then.i86, label %loopexit.i97
then.i86: ; preds = %else.1
ret void
loopexit.i97: ; preds = %else.1
br i1 false, label %then.5, label %else.2
then.5: ; preds = %loopexit.i97
%arg_index.1.ph.be = add i32 %arg_index.1.1, 2 ; <i32> [#uses=1]
br label %loopentry.0
else.2: ; preds = %loopexit.i97
ret void
loopexit.0: ; preds = %loopentry.0
ret void
}

View File

@ -1,71 +0,0 @@
; RUN: opt < %s -loop-reduce -disable-output
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-apple-darwin9"
define i8* @foo( i8* %ABC) {
entry:
switch i8 0, label %bb129 [
i8 0, label %UnifiedReturnBlock
i8 9, label %UnifiedReturnBlock
i8 32, label %UnifiedReturnBlock
i8 35, label %UnifiedReturnBlock
i8 37, label %bb16.preheader
]
bb16.preheader: ; preds = %entry
br label %bb16
bb16: ; preds = %cond_next102, %bb16.preheader
%indvar = phi i32 [ %indvar.next, %cond_next102 ], [ 0, %bb16.preheader ] ; <i32> [#uses=2]
%ABC.2146.0.rec = mul i32 %indvar, 3 ; <i32> [#uses=1]
br i1 false, label %UnifiedReturnBlock.loopexit, label %cond_next102
cond_next102: ; preds = %bb16
%tmp138145.rec = add i32 %ABC.2146.0.rec, 3 ; <i32> [#uses=1]
%tmp138145 = getelementptr i8, i8* %ABC, i32 %tmp138145.rec ; <i8*> [#uses=4]
%indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
switch i8 0, label %bb129.loopexit [
i8 0, label %UnifiedReturnBlock.loopexit
i8 9, label %UnifiedReturnBlock.loopexit
i8 32, label %UnifiedReturnBlock.loopexit
i8 35, label %UnifiedReturnBlock.loopexit
i8 37, label %bb16
]
bb129.loopexit: ; preds = %cond_next102
br label %bb129
bb129: ; preds = %bb129.loopexit, %entry
ret i8* null
UnifiedReturnBlock.loopexit: ; preds = %cond_next102, %cond_next102, %cond_next102, %cond_next102, %bb16
%UnifiedRetVal.ph = phi i8* [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ null, %bb16 ] ; <i8*> [#uses=0]
br label %UnifiedReturnBlock
UnifiedReturnBlock: ; preds = %UnifiedReturnBlock.loopexit, %entry, %entry, %entry, %entry
ret i8* null
}
define i8* @bar() {
entry:
switch i8 0, label %bb158 [
i8 37, label %bb74
i8 58, label %cond_true
i8 64, label %bb11
]
bb11: ; preds = %entry
ret i8* null
cond_true: ; preds = %entry
ret i8* null
bb74: ; preds = %entry
ret i8* null
bb158: ; preds = %entry
ret i8* null
}

View File

@ -1,35 +0,0 @@
; RUN: opt < %s -loop-reduce -S | grep add | count 2
; PR 2662
; Provide legal integer types.
target datalayout = "n8:16:32:64"
@g_3 = common global i16 0 ; <i16*> [#uses=2]
@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
define void @func_1() nounwind {
entry:
br label %bb
bb: ; preds = %bb, %entry
%l_2.0.reg2mem.0 = phi i16 [ 0, %entry ], [ %t1, %bb ] ; <i16> [#uses=2]
%t0 = shl i16 %l_2.0.reg2mem.0, 1 ; <i16>:0 [#uses=1]
store volatile i16 %t0, i16* @g_3, align 2
%t1 = add i16 %l_2.0.reg2mem.0, -3 ; <i16>:1 [#uses=2]
%t2 = icmp slt i16 %t1, 1 ; <i1>:2 [#uses=1]
br i1 %t2, label %bb, label %return
return: ; preds = %bb
ret void
}
define i32 @main() nounwind {
entry:
tail call void @func_1( ) nounwind
load volatile i16, i16* @g_3, align 2 ; <i16>:0 [#uses=1]
zext i16 %0 to i32 ; <i32>:1 [#uses=1]
tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), i32 %1 ) nounwind ; <i32>:2 [#uses=0]
ret i32 0
}
declare i32 @printf(i8*, ...) nounwind

View File

@ -1,52 +0,0 @@
; RUN: opt < %s -loop-reduce -S | grep phi | count 2
; PR 2779
; Provide legal integer types.
target datalayout = "n8:16:32:64"
@g_19 = common global i32 0 ; <i32*> [#uses=3]
@"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1]
define i32 @func_8(i8 zeroext %p_9) nounwind {
entry:
ret i32 1
}
define i32 @func_3(i8 signext %p_5) nounwind {
entry:
ret i32 1
}
define void @func_1() nounwind {
entry:
br label %bb
bb: ; preds = %bb, %entry
%indvar = phi i16 [ 0, %entry ], [ %indvar.next, %bb ] ; <i16> [#uses=2]
%tmp = sub i16 0, %indvar ; <i16> [#uses=1]
%tmp27 = trunc i16 %tmp to i8 ; <i8> [#uses=1]
load i32, i32* @g_19, align 4 ; <i32>:0 [#uses=2]
add i32 %0, 1 ; <i32>:1 [#uses=1]
store i32 %1, i32* @g_19, align 4
trunc i32 %0 to i8 ; <i8>:2 [#uses=1]
tail call i32 @func_8( i8 zeroext %2 ) nounwind ; <i32>:3 [#uses=0]
shl i8 %tmp27, 2 ; <i8>:4 [#uses=1]
add i8 %4, -112 ; <i8>:5 [#uses=1]
tail call i32 @func_3( i8 signext %5 ) nounwind ; <i32>:6 [#uses=0]
%indvar.next = add i16 %indvar, 1 ; <i16> [#uses=2]
%exitcond = icmp eq i16 %indvar.next, -28 ; <i1> [#uses=1]
br i1 %exitcond, label %return, label %bb
return: ; preds = %bb
ret void
}
define i32 @main() nounwind {
entry:
tail call void @func_1( ) nounwind
load i32, i32* @g_19, align 4 ; <i32>:0 [#uses=1]
tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @"\01LC", i32 0, i32 0), i32 %0 ) nounwind ; <i32>:1 [#uses=0]
ret i32 0
}
declare i32 @printf(i8*, ...) nounwind

View File

@ -1,39 +0,0 @@
; RUN: opt < %s -loop-reduce -S | grep phi | count 1
; RUN: opt < %s -loop-reduce -S | grep mul | count 1
; ModuleID = '<stdin>'
; Make sure examining a fuller expression outside the loop doesn't cause us to create a second
; IV of stride %3.
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"
target triple = "i386-apple-darwin9.5"
%struct.anon = type { %struct.obj*, %struct.obj* }
%struct.obj = type { i16, i16, { %struct.anon } }
@heap_size = external global i32 ; <i32*> [#uses=1]
@"\01LC85" = external constant [39 x i8] ; <[39 x i8]*> [#uses=1]
declare i32 @sprintf(i8*, i8*, ...) nounwind
define %struct.obj* @gc_status(%struct.obj* %args) nounwind {
entry:
br label %bb1.i
bb.i2: ; preds = %bb2.i3
%indvar.next24 = add i32 %m.0.i, 1 ; <i32> [#uses=1]
br label %bb1.i
bb1.i: ; preds = %bb.i2, %entry
%m.0.i = phi i32 [ 0, %entry ], [ %indvar.next24, %bb.i2 ] ; <i32> [#uses=4]
%0 = icmp slt i32 %m.0.i, 0 ; <i1> [#uses=1]
br i1 %0, label %bb2.i3, label %nactive_heaps.exit
bb2.i3: ; preds = %bb1.i
%1 = load %struct.obj*, %struct.obj** null, align 4 ; <%struct.obj*> [#uses=1]
%2 = icmp eq %struct.obj* %1, null ; <i1> [#uses=1]
br i1 %2, label %nactive_heaps.exit, label %bb.i2
nactive_heaps.exit: ; preds = %bb2.i3, %bb1.i
%3 = load i32, i32* @heap_size, align 4 ; <i32> [#uses=1]
%4 = mul i32 %3, %m.0.i ; <i32> [#uses=1]
%5 = sub i32 %4, 0 ; <i32> [#uses=1]
%6 = tail call i32 (i8*, i8*, ...) @sprintf(i8* null, i8* getelementptr ([39 x i8], [39 x i8]* @"\01LC85", i32 0, i32 0), i32 %m.0.i, i32 0, i32 %5, i32 0) nounwind ; <i32> [#uses=0]
ret %struct.obj* null
}

View File

@ -1,48 +0,0 @@
; RUN: opt < %s -loop-reduce -S | FileCheck %s
; The multiply in bb2 must not be reduced to an add, as the sext causes the
; %1 argument to become negative after a while.
; CHECK: sext i8
; CHECK: mul i32
; CHECK: store i32
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"
target triple = "i386-apple-darwin9.6"
@table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2]
define i32 @main() nounwind {
bb4.thread:
br label %bb2
bb2: ; preds = %bb4, %bb2, %bb4.thread
%i.0.reg2mem.0.ph = phi i32 [ 0, %bb4.thread ], [ %i.0.reg2mem.0.ph, %bb2 ], [ %indvar.next9, %bb4 ] ; <i32> [#uses=4]
%j.0.reg2mem.0 = phi i32 [ 0, %bb4.thread ], [ %indvar.next, %bb2 ], [ 0, %bb4 ] ; <i32> [#uses=3]
%0 = trunc i32 %j.0.reg2mem.0 to i8 ; <i8> [#uses=1]
%1 = sext i8 %0 to i32 ; <i32> [#uses=1]
%2 = mul i32 %1, %i.0.reg2mem.0.ph ; <i32> [#uses=1]
%3 = getelementptr [32 x [256 x i32]], [32 x [256 x i32]]* @table, i32 0, i32 %i.0.reg2mem.0.ph, i32 %j.0.reg2mem.0 ; <i32*> [#uses=1]
store i32 %2, i32* %3, align 4
%indvar.next = add i32 %j.0.reg2mem.0, 1 ; <i32> [#uses=2]
%exitcond = icmp eq i32 %indvar.next, 256 ; <i1> [#uses=1]
br i1 %exitcond, label %bb4, label %bb2
bb4: ; preds = %bb2
%indvar.next9 = add i32 %i.0.reg2mem.0.ph, 1 ; <i32> [#uses=2]
%exitcond10 = icmp eq i32 %indvar.next9, 32 ; <i1> [#uses=1]
br i1 %exitcond10, label %bb5, label %bb2
bb5: ; preds = %bb4
%4 = load i32, i32* getelementptr ([32 x [256 x i32]], [32 x [256 x i32]]* @table, i32 0, i32 9, i32 132), align 16 ; <i32> [#uses=1]
%5 = icmp eq i32 %4, -1116 ; <i1> [#uses=1]
br i1 %5, label %bb7, label %bb6
bb6: ; preds = %bb5
tail call void @abort() noreturn nounwind
unreachable
bb7: ; preds = %bb5
ret i32 0
}
declare void @abort() noreturn nounwind

View File

@ -1,52 +0,0 @@
; ModuleID = '<stdin>'
; RUN: opt < %s -loop-reduce -S | FileCheck %s
; PR10386
declare i1 @foo()
declare i8* @bar(i8*,i8*,i8*,i8*)
define void @f(i64* %a,i64* %b,i64* %c,i64* %d,i64* %e,i64* %f,i64* %g) nounwind uwtable {
entry:
br label %b_throw.preheader
D_BREAK_LBL: ; preds = %indirectgoto
call i1 @foo()
br label %indirectgoto
H_CONST_LBL: ; preds = %indirectgoto
call i1 @foo()
br label %body_failed
H_MPZ_LBL: ; preds = %indirectgoto
%boo3 = call i1 @foo()
br i1 %boo3, label %body_failed, label %while.cond.i
while.cond.i: ; preds = %while.body.i15795, %if.then.i15791
%phi = phi i64 [ %tmp20916, %while.body.i15795 ], [ 0, %H_MPZ_LBL ]
%tmp20916 = add i64 %phi, 1
%incdec.ptr.i15793 = getelementptr i64, i64* %pc.0.lcssa.i1610719352, i64 %tmp20916
%boo2 = call i1 @foo()
br i1 %boo2, label %indirectgoto, label %while.body.i15795
while.body.i15795: ; preds = %while.cond.i
%tmp20.i = load i64, i64* %incdec.ptr.i15793, align 8
%boo1 = call i1 @foo()
br i1 %boo1, label %while.cond.i, label %body_failed
b_throw.preheader: ; preds = %body_failed, %entry
call i1 @foo()
br label %indirectgoto
body_failed:
%pc.0.lcssa.i1610719364 = phi i64* [ %pc.0.lcssa.i1610719352, %indirectgoto ], [ %pc.0.lcssa.i1610719352, %H_MPZ_LBL ], [ %b, %H_CONST_LBL ], [ %pc.0.lcssa.i1610719352, %while.body.i15795 ]
call i1 @foo()
br label %b_throw.preheader
indirectgoto:
%pc.0.lcssa.i1610719352 = phi i64* [ %pc.0.lcssa.i1610719352, %D_BREAK_LBL ], [ %a, %b_throw.preheader ], [ %d, %while.cond.i ]
%p = call i8* @bar(i8* blockaddress(@f, %D_BREAK_LBL), i8* blockaddress(@f, %H_CONST_LBL), i8* blockaddress(@f, %H_MPZ_LBL), i8* blockaddress(@f, %body_failed) )
indirectbr i8* %p, [label %D_BREAK_LBL, label %H_CONST_LBL, label %H_MPZ_LBL, label %body_failed]
}
; CHECK: %p = call i8* @bar(i8* blockaddress(@f, %D_BREAK_LBL), i8* blockaddress(@f, %H_CONST_LBL), i8* blockaddress(@f, %H_MPZ_LBL), i8* blockaddress(@f, %body_failed))
; CHECK: indirectbr i8* %p, [label %D_BREAK_LBL, label %H_CONST_LBL, label %H_MPZ_LBL, label %body_failed]

View File

@ -1,85 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; Test LSR's use of SplitCriticalEdge during phi rewriting.
target triple = "x86-apple-darwin"
; Provide legal integer types.
target datalayout = "n8:16:32:64"
; Verify that identical edges are merged. rdar://problem/6453893
; CHECK-LABEL: @test1(
; CHECK: bb89:
; CHECK: phi i8* [ %lsr.iv.next1, %bbA.bb89_crit_edge ], [ %lsr.iv.next1, %bbB.bb89_crit_edge ]{{$}}
define i8* @test1() {
entry:
br label %loop
loop:
%rec = phi i32 [ %next, %loop ], [ 0, %entry ]
%next = add i32 %rec, 1
%tmp75 = getelementptr i8, i8* null, i32 %next
br i1 false, label %loop, label %loopexit
loopexit:
br i1 false, label %bbA, label %bbB
bbA:
switch i32 0, label %bb89 [
i32 47, label %bb89
i32 58, label %bb89
]
bbB:
switch i8 0, label %bb89 [
i8 47, label %bb89
i8 58, label %bb89
]
bb89:
%tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ]
br label %exit
exit:
ret i8* %tmp75phi
}
; Handle single-predecessor phis: PR13756
; CHECK-LABEL: @test2(
; CHECK: bb89:
; CHECK: phi i8* [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ]{{$}}
define i8* @test2() {
entry:
br label %loop
loop:
%rec = phi i32 [ %next, %loop ], [ 0, %entry ]
%next = add i32 %rec, 1
%tmp75 = getelementptr i8, i8* null, i32 %next
br i1 false, label %loop, label %loopexit
loopexit:
br i1 false, label %bbA, label %bbB
bbA:
switch i32 0, label %bb89 [
i32 47, label %bb89
i32 58, label %bb89
]
bbB:
switch i8 0, label %exit [
i8 47, label %exit
i8 58, label %exit
]
bb89:
%tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ]
br label %exit
exit:
%result = phi i8* [ %tmp75phi, %bb89 ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ]
ret i8* %result
}

View File

@ -1,57 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; Test LSR's intelligence regarding phi reuse.
; Verify that scaled GEPs are not reused. rdar://5064068
target triple = "x86-apple-darwin"
; Provide legal integer types.
target datalayout = "n8:16:32:64"
; CHECK-LABEL: @test(
; multiplies are hoisted out of the loop
; CHECK: while.body.lr.ph:
; CHECK: shl i64
; CHECK: shl i64
; GEPs are ugly
; CHECK: while.body:
; CHECK: phi
; CHECK: phi
; CHECK: phi
; CHECK: phi
; CHECK-NOT: phi
; CHECK: bitcast float* {{.*}} to i1*
; CHECK: bitcast float* {{.*}} to i1*
; CHECK: getelementptr i1, i1*
; CHECK: getelementptr i1, i1*
define float @test(float* nocapture %A, float* nocapture %B, i32 %N, i32 %IA, i32 %IB) nounwind uwtable readonly ssp {
entry:
%cmp1 = icmp sgt i32 %N, 0
br i1 %cmp1, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%idx.ext = sext i32 %IA to i64
%idx.ext2 = sext i32 %IB to i64
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%A.addr.05 = phi float* [ %A, %while.body.lr.ph ], [ %add.ptr, %while.body ]
%B.addr.04 = phi float* [ %B, %while.body.lr.ph ], [ %add.ptr3, %while.body ]
%N.addr.03 = phi i32 [ %N, %while.body.lr.ph ], [ %sub, %while.body ]
%Sum0.02 = phi float [ 0.000000e+00, %while.body.lr.ph ], [ %add, %while.body ]
%0 = load float, float* %A.addr.05, align 4
%1 = load float, float* %B.addr.04, align 4
%mul = fmul float %0, %1
%add = fadd float %Sum0.02, %mul
%add.ptr = getelementptr inbounds float, float* %A.addr.05, i64 %idx.ext
%add.ptr3 = getelementptr inbounds float, float* %B.addr.04, i64 %idx.ext2
%sub = add nsw i32 %N.addr.03, -1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.end
while.end: ; preds = %while.body, %entry
%Sum0.0.lcssa = phi float [ 0.000000e+00, %entry ], [ %add, %while.body ]
ret float %Sum0.0.lcssa
}

View File

@ -1,111 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; Test TransformForPostIncUse and LSR's expansion of expressions in
; post-inc form to ensure the implementation can handle expressions
; DAGs, not just trees.
target triple = "x86_64-apple-darwin"
; Verify that -loop-reduce runs without "hanging" and reuses post-inc
; expansions.
; CHECK-LABEL: @test(
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK: icmp
; CHECK-NOT: icmp
define void @test(i8* %base, i32 %a0) nounwind {
entry:
br label %bb1
bb1:
%n0 = sub i32 0, %a0
%t0 = icmp ugt i32 %n0, -4
%m0 = select i1 %t0, i32 %n0, i32 -4
%a1 = add i32 %m0, %a0
%n1 = sub i32 0, %a1
%t1 = icmp ugt i32 %n1, -4
%m1 = select i1 %t1, i32 %n1, i32 -4
%a2 = add i32 %m1, %a1
%n2 = sub i32 0, %a2
%t2 = icmp ugt i32 %n2, -4
%m2 = select i1 %t2, i32 %n2, i32 -4
%a3 = add i32 %m2, %a2
%n3 = sub i32 0, %a3
%t3 = icmp ugt i32 %n3, -4
%m3 = select i1 %t3, i32 %n3, i32 -4
%a4 = add i32 %m3, %a3
%n4 = sub i32 0, %a4
%t4 = icmp ugt i32 %n4, -4
%m4 = select i1 %t4, i32 %n4, i32 -4
%a5 = add i32 %m4, %a4
%n5 = sub i32 0, %a5
%t5 = icmp ugt i32 %n5, -4
%m5 = select i1 %t5, i32 %n5, i32 -4
%a6 = add i32 %m5, %a5
%n6 = sub i32 0, %a6
%t6 = icmp ugt i32 %n6, -4
%m6 = select i1 %t6, i32 %n6, i32 -4
%a7 = add i32 %m6, %a6
%n7 = sub i32 0, %a7
%t7 = icmp ugt i32 %n7, -4
%m7 = select i1 %t7, i32 %n7, i32 -4
%a8 = add i32 %m7, %a7
%n8 = sub i32 0, %a8
%t8 = icmp ugt i32 %n8, -4
%m8 = select i1 %t8, i32 %n8, i32 -4
%a9 = add i32 %m8, %a8
%n9 = sub i32 0, %a9
%t9 = icmp ugt i32 %n9, -4
%m9 = select i1 %t9, i32 %n9, i32 -4
%a10 = add i32 %m9, %a9
%n10 = sub i32 0, %a10
%t10 = icmp ugt i32 %n10, -4
%m10 = select i1 %t10, i32 %n10, i32 -4
%a11 = add i32 %m10, %a10
%n11 = sub i32 0, %a11
%t11 = icmp ugt i32 %n11, -4
%m11 = select i1 %t11, i32 %n11, i32 -4
%a12 = add i32 %m11, %a11
%n12 = sub i32 0, %a12
%t12 = icmp ugt i32 %n12, -4
%m12 = select i1 %t12, i32 %n12, i32 -4
%a13 = add i32 %m12, %a12
%n13 = sub i32 0, %a13
%t13 = icmp ugt i32 %n13, -4
%m13 = select i1 %t13, i32 %n13, i32 -4
%a14 = add i32 %m13, %a13
%n14 = sub i32 0, %a14
%t14 = icmp ugt i32 %n14, -4
%m14 = select i1 %t14, i32 %n14, i32 -4
%a15 = add i32 %m14, %a14
%n15 = sub i32 0, %a15
%t15 = icmp ugt i32 %n15, -4
%m15 = select i1 %t15, i32 %n15, i32 -4
%a16 = add i32 %m15, %a15
%gep = getelementptr i8, i8* %base, i32 %a16
%ofs = add i32 %a16, 4
%limit = getelementptr i8, i8* %base, i32 %ofs
br label %loop
loop:
%iv = phi i8* [ %gep, %bb1 ], [ %inc, %loop ]
%inc = getelementptr inbounds i8, i8* %iv, i64 1
%exitcond = icmp eq i8* %inc, %limit
br i1 %exitcond, label %loop, label %exit
exit:
ret void
}

View File

@ -1,27 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; Test SCEVExpander reusing a phi->gep->phi IV when SCEV "wrongly"
; reports the expression as an IntegerTy.
target triple = "x86_64-apple-darwin"
; CHECK-LABEL: @test(
; CHECK: phi
; CHECK-NOT: phi
define void @test(i32 %rowStride) ssp align 2 {
entry:
%cond = select i1 undef, i32 %rowStride, i32 4
br label %for.end
for.end.critedge: ; preds = %for.end
br label %for.end
for.end: ; preds = %for.end.critedge, %entry
br i1 undef, label %for.body83, label %for.end.critedge
for.body83: ; preds = %for.body83, %for.end
%ptr.0157 = phi i8* [ %add.ptr96, %for.body83 ], [ null, %for.end ]
store i8 undef, i8* %ptr.0157, align 1
%add.ptr96 = getelementptr inbounds i8, i8* %ptr.0157, i32 %cond
br label %for.body83
}

View File

@ -1,39 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; PR11571: handle a postinc user outside of for.body7 that requires
; recursive expansion of a quadratic recurrence within for.body7. LSR
; needs to forget that for.body7 is a postinc loop during expansion.
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:32:32-n8:16:32-S128"
target triple = "i386-unknown-freebsd10.0"
@b = external global [121 x i32]
; CHECK-LABEL: @vb(
; Outer recurrence:
; CHECK: %lsr.iv1 = phi [121 x i32]*
; Inner recurrence:
; CHECK: %lsr.iv = phi i32
; Outer step (relative to inner recurrence):
; CHECK: %scevgep = getelementptr i1, i1* %{{.*}}, i32 %lsr.iv
; Outer use:
; CHECK: %lsr.iv3 = phi [121 x i32]* [ %lsr.iv1, %for.body43.preheader ]
define void @vb() nounwind {
for.cond.preheader:
br label %for.body7
for.body7:
%indvars.iv77 = phi i32 [ %indvars.iv.next78, %for.body7 ], [ 1, %for.cond.preheader ]
%bf.072 = phi i32 [ %t1, %for.body7 ], [ 0, %for.cond.preheader ]
%t1 = add i32 %bf.072, %indvars.iv77
%indvars.iv.next78 = add i32 %indvars.iv77, 1
br i1 undef, label %for.body43, label %for.body7
for.body43:
%bf.459 = phi i32 [ %inc44, %for.body43 ], [ %t1, %for.body7 ]
%inc44 = add nsw i32 %bf.459, 1
%arrayidx45 = getelementptr inbounds [121 x i32], [121 x i32]* @b, i32 0, i32 %bf.459
%t2 = load i32, i32* %arrayidx45, align 4
br label %for.body43
}

View File

@ -1,88 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; <rdar://10619599> "SelectionDAGBuilder shouldn't visit PHI nodes!" assert.
; <rdar://10655343> SCEVExpander segfault on simple test case
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-f128:128:128-n8:16:32"
target triple = "i386-apple-darwin"
; LSR should convert the inner loop (bb7.us) IV (j.01.us) into float*.
; This involves a nested AddRec, the outer AddRec's loop invariant components
; cannot find a preheader, so they should be expanded in the loop header
; (bb7.lr.ph.us) below the existing phi i.12.us.
; Currently, LSR won't kick in on such loops.
; CHECK-LABEL: @nopreheader(
; CHECK: bb7.us:
; CHECK-NOT: phi float*
; CHECK: %j.01.us = phi i32
; CHECK-NOT: phi float*
define void @nopreheader(float* nocapture %a, i32 %n) nounwind {
entry:
%0 = sdiv i32 %n, undef
indirectbr i8* undef, [label %bb10.preheader]
bb10.preheader: ; preds = %bb4
indirectbr i8* undef, [label %bb8.preheader.lr.ph, label %return]
bb8.preheader.lr.ph: ; preds = %bb10.preheader
indirectbr i8* null, [label %bb7.lr.ph.us, label %bb9]
bb7.lr.ph.us: ; preds = %bb9.us, %bb8.preheader.lr.ph
%i.12.us = phi i32 [ %2, %bb9.us ], [ 0, %bb8.preheader.lr.ph ]
%tmp30 = mul i32 %0, %i.12.us
indirectbr i8* undef, [label %bb7.us]
bb7.us: ; preds = %bb7.lr.ph.us, %bb7.us
%j.01.us = phi i32 [ 0, %bb7.lr.ph.us ], [ %1, %bb7.us ]
%tmp31 = add i32 %tmp30, %j.01.us
%scevgep9 = getelementptr float, float* %a, i32 %tmp31
store float undef, float* %scevgep9, align 1
%1 = add nsw i32 %j.01.us, 1
indirectbr i8* undef, [label %bb9.us, label %bb7.us]
bb9.us: ; preds = %bb7.us
%2 = add nsw i32 %i.12.us, 1
indirectbr i8* undef, [label %bb7.lr.ph.us, label %return]
bb9: ; preds = %bb9, %bb8.preheader.lr.ph
indirectbr i8* undef, [label %bb9, label %return]
return: ; preds = %bb9, %bb9.us, %bb10.preheader
ret void
}
; In this case, SCEVExpander simply cannot materialize the AddRecExpr
; that LSR picks. We must detect that %bb8.preheader does not have a
; preheader and avoid performing LSR on %bb7.
; CHECK-LABEL: @nopreheader2(
; CHECK: bb7:
; CHECK: %indvar = phi i32
define fastcc void @nopreheader2([200 x i32]* nocapture %Array2) nounwind {
entry:
indirectbr i8* undef, [label %bb]
bb: ; preds = %bb, %entry
indirectbr i8* undef, [label %bb3, label %bb]
bb3: ; preds = %bb3, %bb
indirectbr i8* undef, [label %bb8.preheader, label %bb3]
bb8.preheader: ; preds = %bb9, %bb3
%indvar5 = phi i32 [ %indvar.next6, %bb9 ], [ 0, %bb3 ]
%tmp26 = add i32 %indvar5, 13
indirectbr i8* null, [label %bb7]
bb7: ; preds = %bb8.preheader, %bb7
%indvar = phi i32 [ 0, %bb8.preheader ], [ %indvar.next, %bb7 ]
%scevgep = getelementptr [200 x i32], [200 x i32]* %Array2, i32 %tmp26, i32 %indvar
store i32 undef, i32* %scevgep, align 4
%indvar.next = add i32 %indvar, 1
indirectbr i8* undef, [label %bb9, label %bb7]
bb9: ; preds = %bb7
%indvar.next6 = add i32 %indvar5, 1
indirectbr i8* undef, [label %return, label %bb8.preheader]
return: ; preds = %bb9
ret void
}

View File

@ -1,113 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; <rdar://10701050> "Cannot split an edge from an IndirectBrInst" assert.
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
; while.cond197 is a dominates the simplified loop while.cond238 but
; has no with no preheader.
;
; CHECK-LABEL: @nopreheader(
; CHECK: %while.cond238
; CHECK: phi i64
; CHECK-NOT: phi
; CHECK: indirectbr
define void @nopreheader(i8* %end) nounwind {
entry:
br label %while.cond179
while.cond179: ; preds = %if.end434, %if.end369, %if.end277, %if.end165
%s.1 = phi i8* [ undef, %if.end434 ], [ %incdec.ptr356, %if.end348 ], [ undef, %entry ]
indirectbr i8* undef, [label %land.rhs184, label %while.end453]
land.rhs184: ; preds = %while.cond179
indirectbr i8* undef, [label %while.end453, label %while.cond197]
while.cond197: ; preds = %land.rhs202, %land.rhs184
%0 = phi i64 [ %indvar.next11, %land.rhs202 ], [ 0, %land.rhs184 ]
indirectbr i8* undef, [label %land.rhs202, label %while.end215]
land.rhs202: ; preds = %while.cond197
%indvar.next11 = add i64 %0, 1
indirectbr i8* undef, [label %while.end215, label %while.cond197]
while.end215: ; preds = %land.rhs202, %while.cond197
indirectbr i8* undef, [label %PREMATURE, label %if.end221]
if.end221: ; preds = %while.end215
indirectbr i8* undef, [label %while.cond238.preheader, label %lor.lhs.false227]
lor.lhs.false227: ; preds = %if.end221
indirectbr i8* undef, [label %while.cond238.preheader, label %if.else]
while.cond238.preheader: ; preds = %lor.lhs.false227, %if.end221
%tmp16 = add i64 %0, 2
indirectbr i8* undef, [label %while.cond238]
while.cond238: ; preds = %land.rhs243, %while.cond238.preheader
%1 = phi i64 [ %indvar.next15, %land.rhs243 ], [ 0, %while.cond238.preheader ]
%tmp36 = add i64 %tmp16, %1
%s.3 = getelementptr i8, i8* %s.1, i64 %tmp36
%cmp241 = icmp ult i8* %s.3, %end
indirectbr i8* undef, [label %land.rhs243, label %while.end256]
land.rhs243: ; preds = %while.cond238
%indvar.next15 = add i64 %1, 1
indirectbr i8* undef, [label %while.end256, label %while.cond238]
while.end256: ; preds = %land.rhs243, %while.cond238
indirectbr i8* undef, [label %PREMATURE]
if.else: ; preds = %lor.lhs.false227
indirectbr i8* undef, [label %if.then297, label %if.else386]
if.then297: ; preds = %if.else
indirectbr i8* undef, [label %PREMATURE, label %if.end307]
if.end307: ; preds = %if.then297
indirectbr i8* undef, [label %if.end314, label %FAIL]
if.end314: ; preds = %if.end307
indirectbr i8* undef, [label %if.end340]
if.end340: ; preds = %while.end334
indirectbr i8* undef, [label %PREMATURE, label %if.end348]
if.end348: ; preds = %if.end340
%incdec.ptr356 = getelementptr inbounds i8, i8* undef, i64 2
indirectbr i8* undef, [label %while.cond179]
if.else386: ; preds = %if.else
indirectbr i8* undef, [label %while.end453, label %if.end434]
if.end434: ; preds = %if.then428, %if.end421
indirectbr i8* undef, [label %while.cond179]
while.end453: ; preds = %if.else386, %land.rhs184, %while.cond179
indirectbr i8* undef, [label %PREMATURE, label %if.end459]
if.end459: ; preds = %while.end453
indirectbr i8* undef, [label %if.then465, label %FAIL]
if.then465: ; preds = %if.end459
indirectbr i8* undef, [label %return, label %if.then479]
if.then479: ; preds = %if.then465
indirectbr i8* undef, [label %return]
FAIL: ; preds = %if.end459, %if.end307, %land.lhs.true142, %land.lhs.true131, %while.end
indirectbr i8* undef, [label %DECL_FAIL]
PREMATURE: ; preds = %while.end453, %while.end415, %if.end340, %while.end334, %if.then297, %while.end256, %while.end215
indirectbr i8* undef, [label %return, label %if.then495]
if.then495: ; preds = %PREMATURE
indirectbr i8* undef, [label %return]
DECL_FAIL: ; preds = %if.then488, %FAIL, %land.lhs.true99, %lor.lhs.false, %if.end83, %if.then39, %if.end
indirectbr i8* undef, [label %return]
return: ; preds = %if.then512, %if.end504, %DECL_FAIL, %if.then495, %PREMATURE, %if.then479, %if.then465, %if.then69, %if.end52, %if.end19, %if.then
ret void
}

View File

@ -1,155 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; <rdar://problem/11049788> Segmentation fault: 11 in LoopStrengthReduce
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin10.0.0"
; IVUsers should not consider tmp128 a valid user because it is not in a
; simplified loop nest.
; CHECK-LABEL: @nopreheader(
; CHECK: for.cond:
; CHECK: %tmp128 = add i64 %0, %indvar65
define void @nopreheader(i8* %cmd) nounwind ssp {
entry:
indirectbr i8* undef, [label %while.cond]
while.cond: ; preds = %while.body, %entry
%0 = phi i64 [ %indvar.next48, %while.body ], [ 0, %entry ]
indirectbr i8* undef, [label %while.end, label %while.body]
while.body: ; preds = %lor.rhs, %lor.lhs.false17, %lor.lhs.false11, %lor.lhs.false, %land.rhs
%indvar.next48 = add i64 %0, 1
indirectbr i8* undef, [label %while.cond]
while.end: ; preds = %lor.rhs, %while.cond
indirectbr i8* undef, [label %if.end152]
if.end152: ; preds = %lor.lhs.false144, %if.end110
indirectbr i8* undef, [label %lor.lhs.false184, label %for.cond]
lor.lhs.false184: ; preds = %lor.lhs.false177
indirectbr i8* undef, [label %return, label %for.cond]
for.cond: ; preds = %for.inc, %lor.lhs.false184, %if.end152
%indvar65 = phi i64 [ %indvar.next66, %for.inc ], [ 0, %lor.lhs.false184 ], [ 0, %if.end152 ]
%tmp128 = add i64 %0, %indvar65
%s.4 = getelementptr i8, i8* %cmd, i64 %tmp128
%tmp195 = load i8, i8* %s.4, align 1
indirectbr i8* undef, [label %return, label %land.rhs198]
land.rhs198: ; preds = %for.cond
indirectbr i8* undef, [label %return, label %for.inc]
for.inc: ; preds = %lor.rhs234, %land.lhs.true228, %land.lhs.true216, %land.lhs.true204
%indvar.next66 = add i64 %indvar65, 1
indirectbr i8* undef, [label %for.cond]
return: ; preds = %if.end677, %doshell, %if.then96
ret void
}
; Another case with a dominating loop that does not contain the IV
; User. Just make sure it doesn't assert.
define void @nopreheader2() nounwind ssp {
entry:
indirectbr i8* undef, [label %while.cond, label %return]
while.cond: ; preds = %while.cond.backedge, %entry
indirectbr i8* undef, [label %while.cond.backedge, label %lor.rhs]
lor.rhs: ; preds = %while.cond
indirectbr i8* undef, [label %while.cond.backedge, label %while.end]
while.cond.backedge: ; preds = %lor.rhs, %while.cond
indirectbr i8* undef, [label %while.cond]
while.end: ; preds = %lor.rhs
indirectbr i8* undef, [label %if.then18, label %return]
if.then18: ; preds = %while.end
indirectbr i8* undef, [label %if.end35, label %lor.lhs.false]
lor.lhs.false: ; preds = %if.then18
indirectbr i8* undef, [label %if.end35, label %return]
if.end35: ; preds = %lor.lhs.false, %if.then18
indirectbr i8* undef, [label %while.cond36]
while.cond36: ; preds = %while.body49, %if.end35
%0 = phi i64 [ %indvar.next13, %while.body49 ], [ 0, %if.end35 ]
indirectbr i8* undef, [label %while.body49, label %lor.rhs42]
lor.rhs42: ; preds = %while.cond36
indirectbr i8* undef, [label %while.body49, label %while.end52]
while.body49: ; preds = %lor.rhs42, %while.cond36
%indvar.next13 = add i64 %0, 1
indirectbr i8* undef, [label %while.cond36]
while.end52: ; preds = %lor.rhs42
indirectbr i8* undef, [label %land.lhs.true, label %return]
land.lhs.true: ; preds = %while.end52
indirectbr i8* undef, [label %while.cond66.preheader, label %return]
while.cond66.preheader: ; preds = %land.lhs.true
indirectbr i8* undef, [label %while.cond66]
while.cond66: ; preds = %while.body77, %while.cond66.preheader
indirectbr i8* undef, [label %land.rhs, label %while.cond81.preheader]
land.rhs: ; preds = %while.cond66
indirectbr i8* undef, [label %while.body77, label %while.cond81.preheader]
while.cond81.preheader: ; preds = %land.rhs, %while.cond66
%tmp45 = add i64 undef, %0
%tmp46 = add i64 %tmp45, undef
indirectbr i8* undef, [label %while.cond81]
while.body77: ; preds = %land.rhs
indirectbr i8* undef, [label %while.cond66]
while.cond81: ; preds = %while.body94, %while.cond81.preheader
%tmp25 = add i64 %tmp46, undef
indirectbr i8* undef, [label %while.body94, label %lor.rhs87]
lor.rhs87: ; preds = %while.cond81
indirectbr i8* undef, [label %while.body94, label %return]
while.body94: ; preds = %lor.rhs87, %while.cond81
indirectbr i8* undef, [label %while.cond81]
return: ; preds = %if.end216, %land.lhs.true183, %land.lhs.true, %while.end52, %lor.lhs.false, %while.end, %entry
ret void
}
; Test a phi operand IV User dominated by a no-preheader loop.
define void @nopreheader3() nounwind uwtable ssp align 2 {
entry:
indirectbr i8* blockaddress(@nopreheader3, %if.end10), [label %if.end22, label %if.end10]
if.end10: ; preds = %entry
indirectbr i8* blockaddress(@nopreheader3, %if.end6.i), [label %if.end22, label %if.end6.i]
if.end6.i: ; preds = %if.end10
indirectbr i8* blockaddress(@nopreheader3, %while.cond2.preheader.i.i), [label %if.then12, label %while.cond2.preheader.i.i]
while.cond2.preheader.i.i: ; preds = %while.end.i18.i, %if.end6.i
indirectbr i8* blockaddress(@nopreheader3, %while.cond2.i.i), [label %while.cond2.i.i]
while.cond2.i.i: ; preds = %while.cond2.i.i, %while.cond2.preheader.i.i
%i1.1.i14.i = phi i32 [ %add.i15.i, %while.cond2.i.i ], [ undef, %while.cond2.preheader.i.i ]
%add.i15.i = add nsw i32 %i1.1.i14.i, undef
indirectbr i8* blockaddress(@nopreheader3, %while.end.i18.i), [label %while.cond2.i.i, label %while.end.i18.i]
while.end.i18.i: ; preds = %while.cond2.i.i
indirectbr i8* blockaddress(@nopreheader3, %while.cond2.preheader.i.i), [label %if.then12, label %while.cond2.preheader.i.i]
if.then12: ; preds = %while.end.i18.i, %if.end6.i
%i1.0.lcssa.i.i = phi i32 [ undef, %if.end6.i ], [ %i1.1.i14.i, %while.end.i18.i ]
indirectbr i8* blockaddress(@nopreheader3, %if.end22), [label %if.end22]
if.end22: ; preds = %if.then12, %if.end10, %entry
ret void
}

View File

@ -1,49 +0,0 @@
; RUN: opt < %s -loop-reduce -S
; PR11950: isHighCostExpansion crashes on ConstExpr
;
; The crash happened during IVChain analysis (CollectChains). We don't
; really care how LSR decides to transform this loop, so we don't
; check it. As long as the analysis doesn't crash we're ok.
target datalayout = "e-p:64:64:64-n32:64"
%struct.this_structure_s.0.5 = type { [6144 x [8 x i32]], [6144 x [8 x i32]], [6147 x [4 x i32]], [8 x i32], [2 x i8*], [2 x i8*], [6144 x i8], [6144 x i32], [6144 x i32], [4 x [4 x i8]] }
define internal fastcc void @someFunction(%struct.this_structure_s.0.5* nocapture %scratch, i32 %stage, i32 %cbSize) nounwind {
entry:
%0 = getelementptr inbounds %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 4, i32 %stage
%1 = load i8*, i8** %0, align 4
%2 = getelementptr inbounds %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 5, i32 %stage
%3 = load i8*, i8** %2, align 4
%4 = getelementptr inbounds %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 2, i32 0, i32 0
%tmp11 = shl i32 %stage, 1
%tmp1325 = or i32 %tmp11, 1
br label %__label_D_1608
__label_D_1608: ; preds = %__label_D_1608, %entry
%i.12 = phi i32 [ 0, %entry ], [ %10, %__label_D_1608 ]
%tmp = shl i32 %i.12, 2
%lvar_g.13 = getelementptr i32, i32* %4, i32 %tmp
%tmp626 = or i32 %tmp, 1
%scevgep = getelementptr i32, i32* %4, i32 %tmp626
%tmp727 = or i32 %tmp, 2
%scevgep8 = getelementptr i32, i32* %4, i32 %tmp727
%tmp928 = or i32 %tmp, 3
%scevgep10 = getelementptr i32, i32* %4, i32 %tmp928
%scevgep12 = getelementptr %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 9, i32 %tmp11, i32 %i.12
%scevgep14 = getelementptr %struct.this_structure_s.0.5, %struct.this_structure_s.0.5* %scratch, i32 0, i32 9, i32 %tmp1325, i32 %i.12
%5 = load i8, i8* %scevgep12, align 1
%6 = sext i8 %5 to i32
%7 = load i8, i8* %scevgep14, align 1
%8 = sext i8 %7 to i32
store i32 0, i32* %lvar_g.13, align 4
store i32 %8, i32* %scevgep, align 4
store i32 %6, i32* %scevgep8, align 4
%9 = add nsw i32 %8, %6
store i32 %9, i32* %scevgep10, align 4
%10 = add nsw i32 %i.12, 1
%exitcond = icmp eq i32 %10, 3
br i1 %exitcond, label %return, label %__label_D_1608
return: ; preds = %__label_D_1608
ret void
}

View File

@ -1,86 +0,0 @@
; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; PR11356: likely wrong code bug
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin"
@g_66 = global [1 x i32] zeroinitializer, align 4
@g_775 = global i32 0, align 4
@g_752 = global i32 0, align 4
@g_3 = global i32 0, align 4
; Ensure that %div.i.i.us is not hoisted.
; CHECK-LABEL: @main(
; CHECK: for.body.i.i.us:
; CHECK: %div.i.i.i.us
; CHECK: %cmp5.i.i.us
define i32 @main() nounwind uwtable ssp {
entry:
%l_2 = alloca [1 x i32], align 4
%arrayidx = getelementptr inbounds [1 x i32], [1 x i32]* %l_2, i64 0, i64 0
store i32 0, i32* %arrayidx, align 4
%tmp = load i32, i32* @g_3, align 4
%idxprom = sext i32 %tmp to i64
%arrayidx1 = getelementptr inbounds [1 x i32], [1 x i32]* %l_2, i64 0, i64 %idxprom
%tmp1 = load i32, i32* %arrayidx1, align 4
%conv.i.i = and i32 %tmp1, 65535
%tobool.i.i.i = icmp ne i32 %tmp, 0
br label %codeRepl
codeRepl.loopexit.us-lcssa: ; preds = %for.body.i.i, %codeRepl5
br label %codeRepl.loopexit
codeRepl.loopexit: ; preds = %codeRepl.loopexit.us-lcssa.us, %codeRepl.loopexit.us-lcssa
br label %codeRepl
codeRepl: ; preds = %codeRepl.loopexit, %entry
br i1 %tobool.i.i.i, label %codeRepl.split.us, label %codeRepl.codeRepl.split_crit_edge
codeRepl.codeRepl.split_crit_edge: ; preds = %codeRepl
br label %codeRepl.split
codeRepl.split.us: ; preds = %codeRepl
br label %for.cond.i.i.us
for.cond.i.i.us: ; preds = %for.inc.i.i.us, %codeRepl.split.us
%tmp2 = phi i32 [ 0, %codeRepl.split.us ], [ %add.i.i.us, %for.inc.i.i.us ]
br label %codeRepl5.us
for.inc.i.i.us: ; preds = %for.body.i.i.us
%add.i.i.us = add nsw i32 %tmp2, 1
store i32 %add.i.i.us, i32* @g_752, align 4
br label %for.cond.i.i.us
for.body.i.i.us: ; preds = %codeRepl5.us
%div.i.i.i.us = udiv i32 1, %conv.i.i
%cmp5.i.i.us = icmp eq i32 %div.i.i.i.us, %tmp2
br i1 %cmp5.i.i.us, label %codeRepl.loopexit.us-lcssa.us, label %for.inc.i.i.us
codeRepl5.us: ; preds = %for.cond.i.i.us
br i1 true, label %codeRepl.loopexit.us-lcssa.us, label %for.body.i.i.us
codeRepl.loopexit.us-lcssa.us: ; preds = %codeRepl5.us, %for.body.i.i.us
br label %codeRepl.loopexit
codeRepl.split: ; preds = %codeRepl.codeRepl.split_crit_edge
br label %for.cond.i.i
for.cond.i.i: ; preds = %for.inc.i.i, %codeRepl.split
%tmp3 = phi i32 [ 0, %codeRepl.split ], [ %add.i.i, %for.inc.i.i ]
br label %codeRepl5
codeRepl5: ; preds = %for.cond.i.i
br i1 true, label %codeRepl.loopexit.us-lcssa, label %for.body.i.i
for.body.i.i: ; preds = %codeRepl5
%cmp5.i.i = icmp eq i32 0, %tmp3
br i1 %cmp5.i.i, label %codeRepl.loopexit.us-lcssa, label %for.inc.i.i
for.inc.i.i: ; preds = %for.body.i.i
%add.i.i = add nsw i32 %tmp3, 1
store i32 %add.i.i, i32* @g_752, align 4
br label %for.cond.i.i
func_4.exit: ; No predecessors!
ret i32 0
}

Some files were not shown because too many files have changed in this diff Show More