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,21 +0,0 @@
; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
; PR3408
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"
target triple = "x86_64-unknown-linux-gnu"
%struct.Cls = type { i32, i8, [2 x %struct.Cls*], [2 x %struct.Lit*] }
%struct.Lit = type { i8 }
define void @picosat_main_bb13.i.i71.outer_bb132.i.i.i.outer(%struct.Cls**, %struct.Cls**, i32 %collect.i.i.i.1.lcssa, i32 %lcollect.i.i.i.2.lcssa, %struct.Cls*** %rhead.tmp.0236.out, i32* %collect.i.i.i.2.out, i32* %lcollect.i.i.i.3.ph.ph.ph.out) nounwind {
newFuncRoot:
br label %codeRepl
bb133.i.i.i.exitStub: ; preds = %codeRepl
ret void
bb130.i.i.i: ; preds = %codeRepl
%rhead.tmp.0236.lcssa82 = phi %struct.Cls** [ null, %codeRepl ] ; <%struct.Cls**> [#uses=0]
br label %codeRepl
codeRepl: ; preds = %bb130.i.i.i, %newFuncRoot
br i1 false, label %bb130.i.i.i, label %bb133.i.i.i.exitStub
}

View File

@ -1,95 +0,0 @@
; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -S | FileCheck %s
; CHECK-NOT: [ {{.}}tmp224
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"
%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
%struct.Index_Map = type { i32, %struct.item_set** }
%struct.Item = type { [4 x i16], %struct.rule* }
%struct.__sFILEX = type opaque
%struct.__sbuf = type { i8*, i32 }
%struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
%struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
%struct.list = type { i8*, %struct.list* }
%struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
%struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
%struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
%struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
%struct.plank = type { i8*, %struct.list*, i32 }
%struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
%struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
%struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
%struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
@outfile = external global %struct.FILE* ; <%struct.FILE**> [#uses=1]
@str1 = external constant [11 x i8] ; <[11 x i8]*> [#uses=1]
@operators = weak global %struct.list* null ; <%struct.list**> [#uses=1]
define i32 @opsOfArity(i32 %arity) {
entry:
%arity_addr = alloca i32 ; <i32*> [#uses=2]
%retval = alloca i32, align 4 ; <i32*> [#uses=2]
%tmp = alloca i32, align 4 ; <i32*> [#uses=2]
%c = alloca i32, align 4 ; <i32*> [#uses=4]
%l = alloca %struct.list*, align 4 ; <%struct.list**> [#uses=5]
%op = alloca %struct.operator*, align 4 ; <%struct.operator**> [#uses=3]
store i32 %arity, i32* %arity_addr
store i32 0, i32* %c
%tmp1 = load %struct.list*, %struct.list** @operators ; <%struct.list*> [#uses=1]
store %struct.list* %tmp1, %struct.list** %l
br label %bb21
bb: ; preds = %bb21
%tmp3 = getelementptr %struct.list, %struct.list* %tmp22, i32 0, i32 0 ; <i8**> [#uses=1]
%tmp4 = load i8*, i8** %tmp3 ; <i8*> [#uses=1]
%tmp45 = bitcast i8* %tmp4 to %struct.operator* ; <%struct.operator*> [#uses=1]
store %struct.operator* %tmp45, %struct.operator** %op
%tmp6 = load %struct.operator*, %struct.operator** %op ; <%struct.operator*> [#uses=1]
%tmp7 = getelementptr %struct.operator, %struct.operator* %tmp6, i32 0, i32 5 ; <i32*> [#uses=1]
%tmp8 = load i32, i32* %tmp7 ; <i32> [#uses=1]
%tmp9 = load i32, i32* %arity_addr ; <i32> [#uses=1]
icmp eq i32 %tmp8, %tmp9 ; <i1>:0 [#uses=1]
zext i1 %0 to i8 ; <i8>:1 [#uses=1]
icmp ne i8 %1, 0 ; <i1>:2 [#uses=1]
br i1 %2, label %cond_true, label %cond_next
cond_true: ; preds = %bb
%tmp10 = load %struct.operator*, %struct.operator** %op ; <%struct.operator*> [#uses=1]
%tmp11 = getelementptr %struct.operator, %struct.operator* %tmp10, i32 0, i32 2 ; <i32*> [#uses=1]
%tmp12 = load i32, i32* %tmp11 ; <i32> [#uses=1]
%tmp13 = load %struct.FILE*, %struct.FILE** @outfile ; <%struct.FILE*> [#uses=1]
%tmp14 = getelementptr [11 x i8], [11 x i8]* @str1, i32 0, i32 0 ; <i8*> [#uses=1]
%tmp15 = call i32 (%struct.FILE*, i8*, ...) @fprintf( %struct.FILE* %tmp13, i8* %tmp14, i32 %tmp12 ) ; <i32> [#uses=0]
%tmp16 = load i32, i32* %c ; <i32> [#uses=1]
%tmp17 = add i32 %tmp16, 1 ; <i32> [#uses=1]
store i32 %tmp17, i32* %c
br label %cond_next
cond_next: ; preds = %cond_true, %bb
%tmp19 = getelementptr %struct.list, %struct.list* %tmp22, i32 0, i32 1 ; <%struct.list**> [#uses=1]
%tmp20 = load %struct.list*, %struct.list** %tmp19 ; <%struct.list*> [#uses=1]
store %struct.list* %tmp20, %struct.list** %l
br label %bb21
bb21: ; preds = %cond_next, %entry
%l.in = phi %struct.list** [ @operators, %entry ], [ %tmp19, %cond_next ]
%tmp22 = load %struct.list*, %struct.list** %l.in ; <%struct.list*> [#uses=1]
icmp ne %struct.list* %tmp22, null ; <i1>:3 [#uses=1]
zext i1 %3 to i8 ; <i8>:4 [#uses=1]
icmp ne i8 %4, 0 ; <i1>:5 [#uses=1]
br i1 %5, label %bb, label %bb23
bb23: ; preds = %bb21
%tmp24 = load i32, i32* %c ; <i32> [#uses=1]
store i32 %tmp24, i32* %tmp
%tmp25 = load i32, i32* %tmp ; <i32> [#uses=1]
store i32 %tmp25, i32* %retval
br label %return
return: ; preds = %bb23
%retval26 = load i32, i32* %retval ; <i32> [#uses=1]
ret i32 %retval26
}
declare i32 @fprintf(%struct.FILE*, i8*, ...)

View File

@ -1,39 +0,0 @@
; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
; ModuleID = 'PhiSelfReference-1.bc'
define void @snrm2(i32 %incx) {
entry:
br i1 false, label %START, label %return
START: ; preds = %entry
br i1 false, label %bb85, label %cond_false93
bb52: ; preds = %bb85
br i1 false, label %bb307, label %cond_next71
cond_next71: ; preds = %bb52
ret void
bb85: ; preds = %START
br i1 false, label %bb52, label %bb88
bb88: ; preds = %bb85
ret void
cond_false93: ; preds = %START
ret void
bb243: ; preds = %bb307
br label %bb307
bb307: ; preds = %bb243, %bb52
%sx_addr.2.pn = phi float* [ %sx_addr.5, %bb243 ], [ null, %bb52 ] ; <float*> [#uses=1]
%sx_addr.5 = getelementptr float, float* %sx_addr.2.pn, i32 %incx ; <float*> [#uses=1]
br i1 false, label %bb243, label %bb310
bb310: ; preds = %bb307
ret void
return: ; preds = %entry
ret void
}

View File

@ -1,33 +0,0 @@
; RUN: opt < %s -loop-rotate -S | FileCheck %s
; Test alloca in -loop-rotate.
; We expect a different value for %ptr each iteration (according to the
; definition of alloca). I.e. each @use must be paired with an alloca.
; CHECK: call void @use(i8* %
; CHECK: %ptr = alloca i8
@e = global i16 10
declare void @use(i8*)
define void @test() {
entry:
%end = load i16, i16* @e
br label %loop
loop:
%n.phi = phi i16 [ %n, %loop.fin ], [ 0, %entry ]
%ptr = alloca i8
%cond = icmp eq i16 %n.phi, %end
br i1 %cond, label %exit, label %loop.fin
loop.fin:
%n = add i16 %n.phi, 1
call void @use(i8* %ptr)
br label %loop
exit:
ret void
}

View File

@ -1,63 +0,0 @@
; RUN: opt -S -loop-rotate < %s | FileCheck %s
; RUN: opt -S -passes='require<targetir>,require<assumptions>,loop(rotate)' < %s | FileCheck %s
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"
; PR5319 - The "arrayidx" gep should be hoisted, not duplicated. We should
; end up with one phi node.
define void @test1() nounwind ssp {
; CHECK-LABEL: @test1(
entry:
%array = alloca [20 x i32], align 16
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp slt i32 %i.0, 100
%arrayidx = getelementptr inbounds [20 x i32], [20 x i32]* %array, i64 0, i64 0
br i1 %cmp, label %for.body, label %for.end
; CHECK: for.body:
; CHECK-NEXT: phi i32 [ 0
; CHECK-NEXT: store i32 0
for.body: ; preds = %for.cond
store i32 0, i32* %arrayidx, align 16
%inc = add nsw i32 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
%arrayidx.lcssa = phi i32* [ %arrayidx, %for.cond ]
call void @g(i32* %arrayidx.lcssa) nounwind
ret void
}
declare void @g(i32*)
; CHECK-LABEL: @test2(
define void @test2() nounwind ssp {
entry:
%array = alloca [20 x i32], align 16
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp slt i32 %i.0, 100
; CHECK: call void @f
; CHECK-NOT: call void @f
call void @f() noduplicate
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%inc = add nsw i32 %i.0, 1
call void @h()
br label %for.cond
for.end: ; preds = %for.cond
ret void
; CHECK: }
}
declare void @f() noduplicate
declare void @h()

View File

@ -1,41 +0,0 @@
; RUN: opt < %s -loop-rotate -S | FileCheck %s
target triple = "x86_64-pc-windows-msvc"
declare void @always_throws()
define i32 @test() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
invoke void @always_throws()
to label %continue unwind label %catch.dispatch
continue:
unreachable
catch.dispatch:
%t0 = catchswitch within none [label %catch] unwind to caller
catch:
%t1 = catchpad within %t0 [i8* null, i32 64, i8* null]
catchret from %t1 to label %for.cond
for.cond:
%sum = phi i32 [ %add, %for.body ], [ 0, %catch ]
%i = phi i32 [ %inc, %for.body ], [ 0, %catch ]
%cmp = icmp slt i32 %i, 1
br i1 %cmp, label %for.body, label %return
for.body:
%add = add nsw i32 1, %sum
%inc = add nsw i32 %i, 1
br label %for.cond
return:
ret i32 0
}
; CHECK: catch:
; CHECK-NEXT: catchpad
; CHECK-NEXT: catchret
declare i32 @__CxxFrameHandler3(...)

View File

@ -1,31 +0,0 @@
; RUN: opt -S -loop-rotate < %s | FileCheck %s
@e = global i32 10
declare void @f1(i32) convergent
declare void @f2(i32)
; The call to f1 in the loop header shouldn't be duplicated (meaning, loop
; rotation shouldn't occur), because f1 is convergent.
; CHECK: call void @f1
; CHECK-NOT: call void @f1
define void @test(i32 %x) {
entry:
br label %loop
loop:
%n.phi = phi i32 [ %n, %loop.fin ], [ 0, %entry ]
call void @f1(i32 %n.phi)
%cond = icmp eq i32 %n.phi, %x
br i1 %cond, label %exit, label %loop.fin
loop.fin:
%n = add i32 %n.phi, 1
call void @f2(i32 %n)
br label %loop
exit:
ret void
}

View File

@ -1,173 +0,0 @@
; RUN: opt -loop-rotate -disable-output -verify-dom-info -verify-loop-info < %s
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"
; PR8955 - Rotating an outer loop that has a condbr for a latch block.
define void @test1() nounwind ssp {
entry:
br label %lbl_283
lbl_283: ; preds = %if.end, %entry
br i1 undef, label %if.else, label %if.then
if.then: ; preds = %lbl_283
br i1 undef, label %if.end, label %for.condthread-pre-split
for.condthread-pre-split: ; preds = %if.then
br label %for.cond
for.cond: ; preds = %for.cond, %for.condthread-pre-split
br i1 undef, label %lbl_281, label %for.cond
lbl_281: ; preds = %if.end, %for.cond
br label %if.end
if.end: ; preds = %lbl_281, %if.then
br i1 undef, label %lbl_283, label %lbl_281
if.else: ; preds = %lbl_283
ret void
}
%struct.relation = type { [4 x i16], i32, [4 x i16], i32, i32 }
define void @test2() {
entry:
br i1 false, label %bb139, label %bb10.i44
bb10.i44: ; preds = %entry
ret void
bb127: ; preds = %bb139
br label %bb139
bb139: ; preds = %bb127, %entry
br i1 false, label %bb127, label %bb142
bb142: ; preds = %bb139
%r91.0.lcssa = phi %struct.relation* [ null, %bb139 ] ; <%struct.relation*> [#uses=0]
ret void
}
define void @test3() {
entry:
br i1 false, label %bb139, label %cond_true
cond_true: ; preds = %entry
ret void
bb90: ; preds = %bb139
br i1 false, label %bb136, label %cond_next121
cond_next121: ; preds = %bb90
br i1 false, label %bb136, label %bb127
bb127: ; preds = %cond_next121
br label %bb136
bb136: ; preds = %bb127, %cond_next121, %bb90
%changes.1 = phi i32 [ %changes.2, %bb90 ], [ %changes.2, %cond_next121 ], [ 1, %bb127 ] ; <i32> [#uses=1]
br label %bb139
bb139: ; preds = %bb136, %entry
%changes.2 = phi i32 [ %changes.1, %bb136 ], [ 0, %entry ] ; <i32> [#uses=3]
br i1 false, label %bb90, label %bb142
bb142: ; preds = %bb139
%changes.2.lcssa = phi i32 [ %changes.2, %bb139 ] ; <i32> [#uses=0]
ret void
}
define void @test4() {
entry:
br i1 false, label %cond_false485, label %bb405
bb405: ; preds = %entry
ret void
cond_false485: ; preds = %entry
br label %bb830
bb511: ; preds = %bb830
br i1 false, label %bb816, label %bb830
cond_next667: ; preds = %bb816
br i1 false, label %cond_next695, label %bb680
bb676: ; preds = %bb680
br label %bb680
bb680: ; preds = %bb676, %cond_next667
%iftmp.68.0 = zext i1 false to i8 ; <i8> [#uses=1]
br i1 false, label %bb676, label %cond_next695
cond_next695: ; preds = %bb680, %cond_next667
%iftmp.68.2 = phi i8 [ %iftmp.68.0, %bb680 ], [ undef, %cond_next667 ] ; <i8> [#uses=0]
ret void
bb816: ; preds = %bb816, %bb511
br i1 false, label %cond_next667, label %bb816
bb830: ; preds = %bb511, %cond_false485
br i1 false, label %bb511, label %bb835
bb835: ; preds = %bb830
ret void
}
%struct.NSArray = type { %struct.NSObject }
%struct.NSObject = type { %struct.objc_class* }
%struct.NSRange = type { i64, i64 }
%struct._message_ref_t = type { %struct.NSObject* (%struct.NSObject*, %struct._message_ref_t*, ...)*, %struct.objc_selector* }
%struct.objc_class = type opaque
%struct.objc_selector = type opaque
@"\01L_OBJC_MESSAGE_REF_26" = external global %struct._message_ref_t ; <%struct._message_ref_t*> [#uses=1]
define %struct.NSArray* @test5(%struct.NSArray* %self, %struct._message_ref_t* %_cmd) {
entry:
br label %bb116
bb116: ; preds = %bb131, %entry
%tmp123 = call %struct.NSRange null( %struct.NSObject* null, %struct._message_ref_t* @"\01L_OBJC_MESSAGE_REF_26", %struct.NSArray* null ) ; <%struct.NSRange> [#uses=1]
br i1 false, label %bb141, label %bb131
bb131: ; preds = %bb116
%mrv_gr125 = extractvalue %struct.NSRange %tmp123, 1 ; <i64> [#uses=0]
br label %bb116
bb141: ; preds = %bb116
ret %struct.NSArray* null
}
define void @test6(i8* %msg) {
entry:
br label %bb15
bb6: ; preds = %bb15
%gep.upgrd.1 = zext i32 %offset.1 to i64 ; <i64> [#uses=1]
%tmp11 = getelementptr i8, i8* %msg, i64 %gep.upgrd.1 ; <i8*> [#uses=0]
br label %bb15
bb15: ; preds = %bb6, %entry
%offset.1 = add i32 0, 1 ; <i32> [#uses=2]
br i1 false, label %bb6, label %bb17
bb17: ; preds = %bb15
%offset.1.lcssa = phi i32 [ %offset.1, %bb15 ] ; <i32> [#uses=0]
%payload_type.1.lcssa = phi i32 [ 0, %bb15 ] ; <i32> [#uses=0]
ret void
}
; PR9523 - Non-canonical loop.
define void @test7(i8* %P) nounwind {
entry:
indirectbr i8* %P, [label %"3", label %"5"]
"3": ; preds = %"4", %entry
br i1 undef, label %"5", label %"4"
"4": ; preds = %"3"
br label %"3"
"5": ; preds = %"3", %entry
ret void
}
; PR21968
define void @test8(i1 %C, i8* %P) #0 {
entry:
br label %for.cond
for.cond: ; preds = %for.inc, %entry
br i1 %C, label %l_bad, label %for.body
for.body: ; preds = %for.cond
indirectbr i8* %P, [label %for.inc, label %l_bad]
for.inc: ; preds = %for.body
br label %for.cond
l_bad: ; preds = %for.body, %for.cond
ret void
}

View File

@ -1,88 +0,0 @@
; RUN: opt -S -loop-rotate < %s | FileCheck %s
source_filename = "/tmp/loop.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.13.0"
; Function Attrs: nounwind ssp uwtable
define void @f(float* %input, i64 %n, i64 %s) local_unnamed_addr #0 !dbg !8 {
entry:
call void @llvm.dbg.value(metadata float* %input, metadata !15, metadata !DIExpression()), !dbg !20
call void @llvm.dbg.value(metadata i64 %n, metadata !16, metadata !DIExpression()), !dbg !21
call void @llvm.dbg.value(metadata i64 %s, metadata !17, metadata !DIExpression()), !dbg !22
call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23
; CHECK: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23
; CHECK-NOT: call void @llvm.dbg.value(metadata i64 0, metadata !18, metadata !DIExpression()), !dbg !23
br label %for.cond, !dbg !24
for.cond: ; preds = %for.body, %entry
; CHECK: %i.02 = phi i64 [ 0, %for.body.lr.ph ], [ %add, %for.body ]
%i.0 = phi i64 [ 0, %entry ], [ %add, %for.body ]
call void @llvm.dbg.value(metadata i64 %i.0, metadata !18, metadata !DIExpression()), !dbg !23
%cmp = icmp slt i64 %i.0, %n, !dbg !25
br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !27
for.cond.cleanup: ; preds = %for.cond
ret void, !dbg !28
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds float, float* %input, i64 %i.0, !dbg !29
%0 = load float, float* %arrayidx, align 4, !dbg !29, !tbaa !30
call void @bar(float %0), !dbg !34
%add = add nsw i64 %i.0, %s, !dbg !35
call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23
; CHECK: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23
; CHECK-NOT: call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata !DIExpression()), !dbg !23
br label %for.cond, !dbg !36, !llvm.loop !37
}
declare void @bar(float) local_unnamed_addr #1
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
attributes #0 = { nounwind ssp uwtable }
attributes #2 = { nounwind readnone speculatable }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
!llvm.ident = !{!7}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 316689) (llvm/trunk 316685)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "/tmp/loop.c", directory: "/Data/llvm")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{i32 7, !"PIC Level", i32 2}
!7 = !{!"clang version 6.0.0 (trunk 316689) (llvm/trunk 316685)"}
!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !14)
!9 = !DISubroutineType(types: !10)
!10 = !{null, !11, !13, !13}
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
!12 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
!13 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed)
!14 = !{!15, !16, !17, !18}
!15 = !DILocalVariable(name: "input", arg: 1, scope: !8, file: !1, line: 2, type: !11)
!16 = !DILocalVariable(name: "n", arg: 2, scope: !8, file: !1, line: 2, type: !13)
!17 = !DILocalVariable(name: "s", arg: 3, scope: !8, file: !1, line: 2, type: !13)
!18 = !DILocalVariable(name: "i", scope: !19, file: !1, line: 3, type: !13)
!19 = distinct !DILexicalBlock(scope: !8, file: !1, line: 3, column: 3)
!20 = !DILocation(line: 2, column: 15, scope: !8)
!21 = !DILocation(line: 2, column: 32, scope: !8)
!22 = !DILocation(line: 2, column: 45, scope: !8)
!23 = !DILocation(line: 3, column: 18, scope: !19)
!24 = !DILocation(line: 3, column: 8, scope: !19)
!25 = !DILocation(line: 3, column: 26, scope: !26)
!26 = distinct !DILexicalBlock(scope: !19, file: !1, line: 3, column: 3)
!27 = !DILocation(line: 3, column: 3, scope: !19)
!28 = !DILocation(line: 5, column: 1, scope: !8)
!29 = !DILocation(line: 4, column: 9, scope: !26)
!30 = !{!31, !31, i64 0}
!31 = !{!"float", !32, i64 0}
!32 = !{!"omnipotent char", !33, i64 0}
!33 = !{!"Simple C/C++ TBAA"}
!34 = !DILocation(line: 4, column: 5, scope: !26)
!35 = !DILocation(line: 3, column: 31, scope: !26)
!36 = !DILocation(line: 3, column: 3, scope: !26)
!37 = distinct !{!37, !27, !38}
!38 = !DILocation(line: 4, column: 17, scope: !19)

View File

@ -1,158 +0,0 @@
; RUN: opt -S -loop-rotate < %s | FileCheck %s
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
define i32 @tak(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !0 {
; CHECK-LABEL: define i32 @tak(
; CHECK: entry
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %x
; CHECK: tail call void @llvm.dbg.value(metadata i32 %call
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then, %entry
%x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ]
%y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ]
%z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ]
tail call void @llvm.dbg.value(metadata i32 %x.tr, metadata !6, metadata !DIExpression()), !dbg !7
tail call void @llvm.dbg.value(metadata i32 %y.tr, metadata !8, metadata !DIExpression()), !dbg !9
tail call void @llvm.dbg.value(metadata i32 %z.tr, metadata !10, metadata !DIExpression()), !dbg !11
%cmp = icmp slt i32 %y.tr, %x.tr, !dbg !12
br i1 %cmp, label %if.then, label %if.end, !dbg !12
if.then: ; preds = %tailrecurse
%sub = sub nsw i32 %x.tr, 1, !dbg !14
%call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !14
%sub6 = sub nsw i32 %y.tr, 1, !dbg !14
%call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !14
%sub11 = sub nsw i32 %z.tr, 1, !dbg !14
%call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !14
br label %tailrecurse
if.end: ; preds = %tailrecurse
br label %return, !dbg !16
return: ; preds = %if.end
ret i32 %z.tr, !dbg !17
}
define i32 @tak2(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !21 {
; CHECK-LABEL: define i32 @tak2(
; CHECK: entry
; CHECK: tail call void @llvm.dbg.value(metadata i32 %x.tr
; CHECK: tail call void @llvm.dbg.value(metadata i32 undef
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.then, %entry
%x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ]
%y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ]
%z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ]
%cmp = icmp slt i32 %y.tr, %x.tr, !dbg !22
br i1 %cmp, label %if.then, label %if.end, !dbg !22
if.then: ; preds = %tailrecurse
tail call void @llvm.dbg.value(metadata i32 %x.tr, metadata !36, metadata !DIExpression()), !dbg !37
tail call void @llvm.dbg.value(metadata i32 %y.tr, metadata !38, metadata !DIExpression()), !dbg !39
tail call void @llvm.dbg.value(metadata i32 %z.tr, metadata !40, metadata !DIExpression()), !dbg !41
%sub = sub nsw i32 %x.tr, 1, !dbg !24
%call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !24
%sub6 = sub nsw i32 %y.tr, 1, !dbg !24
%call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !24
%sub11 = sub nsw i32 %z.tr, 1, !dbg !24
%call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !24
br label %tailrecurse
if.end: ; preds = %tailrecurse
tail call void @llvm.dbg.value(metadata i32 %x.tr, metadata !36, metadata !DIExpression()), !dbg !37
tail call void @llvm.dbg.value(metadata i32 %y.tr, metadata !38, metadata !DIExpression()), !dbg !39
tail call void @llvm.dbg.value(metadata i32 %z.tr, metadata !40, metadata !DIExpression()), !dbg !41
br label %return, !dbg !26
return: ; preds = %if.end
ret i32 %z.tr, !dbg !27
}
@channelColumns = external global i64
@horzPlane = external global i8*, align 8
define void @FindFreeHorzSeg(i64 %startCol, i64 %row, i64* %rowStart) {
; Ensure that the loop increment basic block is rotated into the tail of the
; body, even though it contains a debug intrinsic call.
; CHECK-LABEL: define void @FindFreeHorzSeg(
; CHECK: %dec = add
; CHECK-NEXT: tail call void @llvm.dbg.value
; CHECK: %cmp = icmp
; CHECK: br i1 %cmp
; CHECK: phi i64 [ %{{[^,]*}}, %{{[^,]*}} ]
; CHECK-NEXT: br label %for.end
entry:
br label %for.cond
for.cond:
%i.0 = phi i64 [ %startCol, %entry ], [ %dec, %for.inc ]
%cmp = icmp eq i64 %i.0, 0
br i1 %cmp, label %for.end, label %for.body
for.body:
%0 = load i64, i64* @channelColumns, align 8
%mul = mul i64 %0, %row
%add = add i64 %mul, %i.0
%1 = load i8*, i8** @horzPlane, align 8
%arrayidx = getelementptr inbounds i8, i8* %1, i64 %add
%2 = load i8, i8* %arrayidx, align 1
%tobool = icmp eq i8 %2, 0
br i1 %tobool, label %for.inc, label %for.end
for.inc:
%dec = add i64 %i.0, -1
tail call void @llvm.dbg.value(metadata i64 %dec, metadata !DILocalVariable(scope: !0), metadata !DIExpression()), !dbg !DILocation(scope: !0)
br label %for.cond
for.end:
%add1 = add i64 %i.0, 1
store i64 %add1, i64* %rowStart, align 8
ret void
}
!llvm.module.flags = !{!20}
!llvm.dbg.cu = !{!2}
!0 = distinct !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !18, scope: !1, type: !3)
!1 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame")
!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 125492)", isOptimized: true, emissionKind: FullDebug, file: !18)
!3 = !DISubroutineType(types: !4)
!4 = !{!5}
!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!6 = !DILocalVariable(name: "x", line: 32, arg: 1, scope: !0, file: !1, type: !5)
!7 = !DILocation(line: 32, column: 13, scope: !0)
!8 = !DILocalVariable(name: "y", line: 32, arg: 2, scope: !0, file: !1, type: !5)
!9 = !DILocation(line: 32, column: 20, scope: !0)
!10 = !DILocalVariable(name: "z", line: 32, arg: 3, scope: !0, file: !1, type: !5)
!11 = !DILocation(line: 32, column: 27, scope: !0)
!12 = !DILocation(line: 33, column: 3, scope: !13)
!13 = distinct !DILexicalBlock(line: 32, column: 30, file: !18, scope: !0)
!14 = !DILocation(line: 34, column: 5, scope: !15)
!15 = distinct !DILexicalBlock(line: 33, column: 14, file: !18, scope: !13)
!16 = !DILocation(line: 36, column: 3, scope: !13)
!17 = !DILocation(line: 37, column: 1, scope: !13)
!18 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame")
!20 = !{i32 1, !"Debug Info Version", i32 3}
!21 = distinct !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !18, scope: !1, type: !3)
!22 = !DILocation(line: 33, column: 3, scope: !23)
!23 = distinct !DILexicalBlock(line: 32, column: 30, file: !18, scope: !21)
!24 = !DILocation(line: 34, column: 5, scope: !25)
!25 = distinct !DILexicalBlock(line: 33, column: 14, file: !18, scope: !23)
!26 = !DILocation(line: 36, column: 3, scope: !23)
!27 = !DILocation(line: 37, column: 1, scope: !23)
!36 = !DILocalVariable(name: "x", line: 32, arg: 1, scope: !21, file: !1, type: !5)
!37 = !DILocation(line: 32, column: 13, scope: !21)
!38 = !DILocalVariable(name: "y", line: 32, arg: 2, scope: !21, file: !1, type: !5)
!39 = !DILocation(line: 32, column: 20, scope: !21)
!40 = !DILocalVariable(name: "z", line: 32, arg: 3, scope: !21, file: !1, type: !5)
!41 = !DILocation(line: 32, column: 27, scope: !21)

View File

@ -1,43 +0,0 @@
; RUN: opt < %s -S -loop-rotate -disable-output -verify-loop-info -verify-dom-info
; PR5502
define void @z80_do_opcodes() nounwind {
entry:
br label %while.cond
while.cond: ; preds = %end_opcode, %entry
br label %while.body
while.body: ; preds = %while.cond
br label %indirectgoto
run_opcode: ; preds = %indirectgoto
%tmp276 = load i8, i8* undef ; <i8> [#uses=1]
br label %indirectgoto
if.else295: ; preds = %divide_late
br label %end_opcode
end_opcode: ; preds = %indirectgoto, %sw.default42406, %sw.default, %if.else295
%opcode.2 = phi i8 [ %opcode.0, %indirectgoto ], [ 0, %sw.default42406 ], [ undef, %sw.default ], [ %opcode.0, %if.else295 ] ; <i8> [#uses=0]
switch i32 undef, label %while.cond [
i32 221, label %sw.bb11691
i32 253, label %sw.bb30351
]
sw.bb11691: ; preds = %end_opcode
br label %sw.default
sw.default: ; preds = %sw.bb11691
br label %end_opcode
sw.bb30351: ; preds = %end_opcode
br label %sw.default42406
sw.default42406: ; preds = %sw.bb30351
br label %end_opcode
indirectgoto: ; preds = %run_opcode, %while.body
%opcode.0 = phi i8 [ undef, %while.body ], [ %tmp276, %run_opcode ] ; <i8> [#uses=2]
indirectbr i8* undef, [label %run_opcode, label %if.else295, label %end_opcode]
}

View File

@ -1,236 +0,0 @@
; RUN: opt -S -loop-rotate < %s -verify-loop-info -verify-dom-info | FileCheck %s
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-macosx10.8.0"
; PR7447
define i32 @test1([100 x i32]* nocapture %a) nounwind readonly {
entry:
br label %for.cond
for.cond: ; preds = %for.cond1, %entry
%sum.0 = phi i32 [ 0, %entry ], [ %sum.1, %for.cond1 ]
%i.0 = phi i1 [ true, %entry ], [ false, %for.cond1 ]
br i1 %i.0, label %for.cond1, label %return
for.cond1: ; preds = %for.cond, %land.rhs
%sum.1 = phi i32 [ %add, %land.rhs ], [ %sum.0, %for.cond ]
%i.1 = phi i32 [ %inc, %land.rhs ], [ 0, %for.cond ]
%cmp2 = icmp ult i32 %i.1, 100
br i1 %cmp2, label %land.rhs, label %for.cond
land.rhs: ; preds = %for.cond1
%conv = zext i32 %i.1 to i64
%arrayidx = getelementptr inbounds [100 x i32], [100 x i32]* %a, i64 0, i64 %conv
%0 = load i32, i32* %arrayidx, align 4
%add = add i32 %0, %sum.1
%cmp4 = icmp ugt i32 %add, 1000
%inc = add i32 %i.1, 1
br i1 %cmp4, label %return, label %for.cond1
return: ; preds = %for.cond, %land.rhs
%retval.0 = phi i32 [ 1000, %land.rhs ], [ %sum.0, %for.cond ]
ret i32 %retval.0
; CHECK-LABEL: @test1(
; CHECK: for.cond1.preheader:
; CHECK: %sum.04 = phi i32 [ 0, %entry ], [ %sum.1.lcssa, %for.cond.loopexit ]
; CHECK: br label %for.cond1
; CHECK: for.cond1:
; CHECK: %sum.1 = phi i32 [ %add, %land.rhs ], [ %sum.04, %for.cond1.preheader ]
; CHECK: %i.1 = phi i32 [ %inc, %land.rhs ], [ 0, %for.cond1.preheader ]
; CHECK: %cmp2 = icmp ult i32 %i.1, 100
; CHECK: br i1 %cmp2, label %land.rhs, label %for.cond.loopexit
}
define void @test2(i32 %x) nounwind {
entry:
br label %for.cond
for.cond: ; preds = %if.end, %entry
%i.0 = phi i32 [ 0, %entry ], [ %inc, %if.end ]
%cmp = icmp eq i32 %i.0, %x
br i1 %cmp, label %return.loopexit, label %for.body
for.body: ; preds = %for.cond
%call = tail call i32 @foo(i32 %i.0) nounwind
%tobool = icmp eq i32 %call, 0
br i1 %tobool, label %if.end, label %a
if.end: ; preds = %for.body
%call1 = tail call i32 @foo(i32 42) nounwind
%inc = add i32 %i.0, 1
br label %for.cond
a: ; preds = %for.body
%call2 = tail call i32 @bar(i32 1) nounwind
br label %return
return.loopexit: ; preds = %for.cond
br label %return
return: ; preds = %return.loopexit, %a
ret void
; CHECK-LABEL: @test2(
; CHECK: if.end:
; CHECK: %inc = add i32 %i.02, 1
; CHECK: %cmp = icmp eq i32 %inc, %x
; CHECK: br i1 %cmp, label %for.cond.return.loopexit_crit_edge, label %for.body
}
declare i32 @foo(i32)
declare i32 @bar(i32)
@_ZTIi = external constant i8*
; Verify dominators.
define void @test3(i32 %x) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
%cmp2 = icmp eq i32 0, %x
br i1 %cmp2, label %try.cont.loopexit, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.03 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
invoke void @_Z3fooi(i32 %i.03)
to label %for.inc unwind label %lpad
for.inc: ; preds = %for.body
%inc = add i32 %i.03, 1
%cmp = icmp eq i32 %inc, %x
br i1 %cmp, label %for.cond.try.cont.loopexit_crit_edge, label %for.body
lpad: ; preds = %for.body
%0 = landingpad { i8*, i32 }
catch i8* bitcast (i8** @_ZTIi to i8*)
%1 = extractvalue { i8*, i32 } %0, 0
%2 = extractvalue { i8*, i32 } %0, 1
%3 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) nounwind
%matches = icmp eq i32 %2, %3
br i1 %matches, label %catch, label %eh.resume
catch: ; preds = %lpad
%4 = tail call i8* @__cxa_begin_catch(i8* %1) nounwind
br i1 true, label %invoke.cont2.loopexit, label %for.body.i.lr.ph
for.body.i.lr.ph: ; preds = %catch
br label %for.body.i
for.body.i: ; preds = %for.body.i.lr.ph, %for.inc.i
%i.0.i1 = phi i32 [ 0, %for.body.i.lr.ph ], [ %inc.i, %for.inc.i ]
invoke void @_Z3fooi(i32 %i.0.i1)
to label %for.inc.i unwind label %lpad.i
for.inc.i: ; preds = %for.body.i
%inc.i = add i32 %i.0.i1, 1
%cmp.i = icmp eq i32 %inc.i, 0
br i1 %cmp.i, label %for.cond.i.invoke.cont2.loopexit_crit_edge, label %for.body.i
lpad.i: ; preds = %for.body.i
%5 = landingpad { i8*, i32 }
catch i8* bitcast (i8** @_ZTIi to i8*)
%6 = extractvalue { i8*, i32 } %5, 0
%7 = extractvalue { i8*, i32 } %5, 1
%matches.i = icmp eq i32 %7, %3
br i1 %matches.i, label %catch.i, label %lpad1.body
catch.i: ; preds = %lpad.i
%8 = tail call i8* @__cxa_begin_catch(i8* %6) nounwind
invoke void @test3(i32 0)
to label %invoke.cont2.i unwind label %lpad1.i
invoke.cont2.i: ; preds = %catch.i
tail call void @__cxa_end_catch() nounwind
br label %invoke.cont2
lpad1.i: ; preds = %catch.i
%9 = landingpad { i8*, i32 }
cleanup
%10 = extractvalue { i8*, i32 } %9, 0
%11 = extractvalue { i8*, i32 } %9, 1
tail call void @__cxa_end_catch() nounwind
br label %lpad1.body
for.cond.i.invoke.cont2.loopexit_crit_edge: ; preds = %for.inc.i
br label %invoke.cont2.loopexit
invoke.cont2.loopexit: ; preds = %for.cond.i.invoke.cont2.loopexit_crit_edge, %catch
br label %invoke.cont2
invoke.cont2: ; preds = %invoke.cont2.loopexit, %invoke.cont2.i
tail call void @__cxa_end_catch() nounwind
br label %try.cont
for.cond.try.cont.loopexit_crit_edge: ; preds = %for.inc
br label %try.cont.loopexit
try.cont.loopexit: ; preds = %for.cond.try.cont.loopexit_crit_edge, %entry
br label %try.cont
try.cont: ; preds = %try.cont.loopexit, %invoke.cont2
ret void
lpad1.body: ; preds = %lpad1.i, %lpad.i
%exn.slot.0.i = phi i8* [ %10, %lpad1.i ], [ %6, %lpad.i ]
%ehselector.slot.0.i = phi i32 [ %11, %lpad1.i ], [ %7, %lpad.i ]
tail call void @__cxa_end_catch() nounwind
br label %eh.resume
eh.resume: ; preds = %lpad1.body, %lpad
%exn.slot.0 = phi i8* [ %exn.slot.0.i, %lpad1.body ], [ %1, %lpad ]
%ehselector.slot.0 = phi i32 [ %ehselector.slot.0.i, %lpad1.body ], [ %2, %lpad ]
%lpad.val = insertvalue { i8*, i32 } undef, i8* %exn.slot.0, 0
%lpad.val5 = insertvalue { i8*, i32 } %lpad.val, i32 %ehselector.slot.0, 1
resume { i8*, i32 } %lpad.val5
}
declare void @_Z3fooi(i32)
declare i32 @__gxx_personality_v0(...)
declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone
declare i8* @__cxa_begin_catch(i8*)
declare void @__cxa_end_catch()
define void @test4() nounwind uwtable {
entry:
br label %"7"
"3": ; preds = %"7"
br i1 undef, label %"31", label %"4"
"4": ; preds = %"3"
%. = select i1 undef, float 0x3F50624DE0000000, float undef
%0 = add i32 %1, 1
br label %"7"
"7": ; preds = %"4", %entry
%1 = phi i32 [ %0, %"4" ], [ 0, %entry ]
%2 = icmp slt i32 %1, 100
br i1 %2, label %"3", label %"8"
"8": ; preds = %"7"
br i1 undef, label %"9", label %"31"
"9": ; preds = %"8"
br label %"33"
"27": ; preds = %"31"
unreachable
"31": ; preds = %"8", %"3"
br i1 undef, label %"27", label %"32"
"32": ; preds = %"31"
br label %"33"
"33": ; preds = %"32", %"9"
ret void
}

View File

@ -1,34 +0,0 @@
; RUN: opt -S < %s -loop-rotate -licm -verify-dom-info -verify-loop-info | FileCheck %s
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios8.0.0"
;CHECK: for.inc:
;CHECK-NEXT: %incdec.ptr.i = getelementptr
; Function Attrs: alwaysinline inlinehint nounwind readonly ssp
define linkonce_odr hidden i64 @_ZNSt3__14findINS_11__wrap_iterIPiEEiEET_S4_S4_RKT0_(i64 %__first.coerce, i64 %__last.coerce, i32* nocapture readonly dereferenceable(4) %__value_) {
entry:
%coerce.val.ip = inttoptr i64 %__first.coerce to i32*
%coerce.val.ip2 = inttoptr i64 %__last.coerce to i32*
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%coerce.val.ip9 = phi i32* [ %incdec.ptr.i, %for.inc ], [ %coerce.val.ip, %entry ]
%lnot.i = icmp eq i32* %coerce.val.ip9, %coerce.val.ip2
br i1 %lnot.i, label %for.end, label %for.body
for.body: ; preds = %for.cond
%0 = load i32, i32* %coerce.val.ip9, align 4
%1 = load i32, i32* %__value_, align 4
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %for.end, label %for.inc
for.inc: ; preds = %for.body
%incdec.ptr.i = getelementptr inbounds i32, i32* %coerce.val.ip9, i64 1
br label %for.cond
for.end: ; preds = %for.cond, %for.body
%coerce.val.ip9.lcssa = phi i32* [ %coerce.val.ip9, %for.cond ], [ %coerce.val.ip9, %for.body ]
%coerce.val.pi = ptrtoint i32* %coerce.val.ip9.lcssa to i64
ret i64 %coerce.val.pi
}

View File

@ -1,30 +0,0 @@
; REQUIRES: asserts
; RUN: opt < %s -S -Os -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OS
; RUN: opt < %s -S -Oz -debug -debug-only=loop-rotate 2>&1 | FileCheck %s -check-prefix=OZ
; Loop should be rotated for -Os but not for -Oz.
; OS: rotating Loop at depth 1
; OZ-NOT: rotating Loop at depth 1
@e = global i32 10
declare void @use(i32)
define void @test() {
entry:
%end = load i32, i32* @e
br label %loop
loop:
%n.phi = phi i32 [ %n, %loop.fin ], [ 0, %entry ]
%cond = icmp eq i32 %n.phi, %end
br i1 %cond, label %exit, label %loop.fin
loop.fin:
%n = add i32 %n.phi, 1
call void @use(i32 %n)
br label %loop
exit:
ret void
}

View File

@ -1,81 +0,0 @@
; RUN: opt -S -loop-rotate < %s | FileCheck %s
;CHECK-LABEL: func
;CHECK-LABEL: entry
;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %a
;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 1, metadata ![[I_VAR:[0-9]+]], metadata !DIExpression())
;CHECK-LABEL: for.body:
;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ]
;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 [[I]], metadata ![[I_VAR]], metadata !DIExpression())
; CHECK: ![[I_VAR]] = !DILocalVariable(name: "i",{{.*}})
; Function Attrs: noinline nounwind
define void @func(i32 %a) local_unnamed_addr #0 !dbg !6 {
entry:
tail call void @llvm.dbg.value(metadata i32 %a, metadata !10, metadata !11), !dbg !12
tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !11), !dbg !15
br label %for.cond, !dbg !16
for.cond: ; preds = %for.body, %entry
%i.0 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
tail call void @llvm.dbg.value(metadata i32 %i.0, metadata !13, metadata !11), !dbg !15
%cmp = icmp slt i32 %i.0, 10, !dbg !17
br i1 %cmp, label %for.body, label %for.end, !dbg !20
for.body: ; preds = %for.cond
%add = add nsw i32 %i.0, %a, !dbg !22
%call = tail call i32 @func2(i32 %i.0, i32 %add) #3, !dbg !24
%inc = add nsw i32 %i.0, 1, !dbg !25
tail call void @llvm.dbg.value(metadata i32 %inc, metadata !13, metadata !11), !dbg !15
br label %for.cond, !dbg !27, !llvm.loop !28
for.end: ; preds = %for.cond
ret void, !dbg !31
}
declare i32 @func2(i32, i32) local_unnamed_addr
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
attributes #0 = { noinline nounwind }
attributes #2 = { nounwind readnone }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!llvm.ident = !{!5}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0 (http://llvm.org/git/clang.git 0f3ed908c1f13f83da4b240f7595eb8d05e0a754) (http://llvm.org/git/llvm.git 8e270f5a6b8ceb0f3ac3ef1ffb83c5e29b44ae68)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "debug-phi.c", directory: "/work/projects/src/tests/debug")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{!"clang version 5.0.0 (http://llvm.org/git/clang.git 0f3ed908c1f13f83da4b240f7595eb8d05e0a754) (http://llvm.org/git/llvm.git 8e270f5a6b8ceb0f3ac3ef1ffb83c5e29b44ae68)"}
!6 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!7 = !DISubroutineType(types: !8)
!8 = !{null, !9}
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!10 = !DILocalVariable(name: "a", arg: 1, scope: !6, file: !1, line: 2, type: !9)
!11 = !DIExpression()
!12 = !DILocation(line: 2, column: 15, scope: !6)
!13 = !DILocalVariable(name: "i", scope: !14, file: !1, line: 3, type: !9)
!14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3, column: 3)
!15 = !DILocation(line: 3, column: 11, scope: !14)
!16 = !DILocation(line: 3, column: 7, scope: !14)
!17 = !DILocation(line: 3, column: 20, scope: !18)
!18 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 1)
!19 = distinct !DILexicalBlock(scope: !14, file: !1, line: 3, column: 3)
!20 = !DILocation(line: 3, column: 3, scope: !21)
!21 = !DILexicalBlockFile(scope: !14, file: !1, discriminator: 1)
!22 = !DILocation(line: 4, column: 15, scope: !23)
!23 = distinct !DILexicalBlock(scope: !19, file: !1, line: 3, column: 31)
!24 = !DILocation(line: 4, column: 5, scope: !23)
!25 = !DILocation(line: 3, column: 27, scope: !26)
!26 = !DILexicalBlockFile(scope: !19, file: !1, discriminator: 2)
!27 = !DILocation(line: 3, column: 3, scope: !26)
!28 = distinct !{!28, !29, !30}
!29 = !DILocation(line: 3, column: 3, scope: !14)
!30 = !DILocation(line: 5, column: 3, scope: !14)
!31 = !DILocation(line: 6, column: 1, scope: !6)

View File

@ -1,40 +0,0 @@
; RUN: opt -S -loop-rotate < %s | FileCheck %s
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"
; PR5837
define void @test(i32 %N, double* %G) nounwind ssp {
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%j.0 = phi i64 [ 1, %entry ], [ %inc, %for.body ] ; <i64> [#uses=5]
%cmp = icmp slt i64 %j.0, 1000 ; <i1> [#uses=1]
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds double, double* %G, i64 %j.0 ; <double*> [#uses=1]
%tmp3 = load double, double* %arrayidx ; <double> [#uses=1]
%sub = sub i64 %j.0, 1 ; <i64> [#uses=1]
%arrayidx6 = getelementptr inbounds double, double* %G, i64 %sub ; <double*> [#uses=1]
%tmp7 = load double, double* %arrayidx6 ; <double> [#uses=1]
%add = fadd double %tmp3, %tmp7 ; <double> [#uses=1]
%arrayidx10 = getelementptr inbounds double, double* %G, i64 %j.0 ; <double*> [#uses=1]
store double %add, double* %arrayidx10
%inc = add nsw i64 %j.0, 1 ; <i64> [#uses=1]
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
; Should only end up with one phi.
; CHECK-LABEL: define void @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label %for.body
; CHECK: for.body:
; CHECK-NEXT: %j.01 = phi i64
; CHECK-NOT: br
; CHECK: br i1 %cmp, label %for.body, label %for.end
; CHECK: for.end:
; CHECK-NEXT: ret void

View File

@ -1,24 +0,0 @@
; RUN: opt < %s -loop-rotate -S | FileCheck %s
@a = external global i8, align 4
@tmp = global i8* @a
define void @f() {
; CHECK-LABEL: define void @f(
; CHECK: getelementptr i8, i8* @a, i32 0
entry:
br label %for.preheader
for.preheader:
br i1 undef, label %if.then8, label %for.body
for.body:
br i1 undef, label %if.end, label %if.then8
if.end:
%arrayidx = getelementptr i8, i8* @a, i32 0
br label %for.preheader
if.then8:
unreachable
}

View File

@ -1,38 +0,0 @@
; RUN: opt < %s -loop-deletion -loop-rotate -verify-dom-info -verify-loop-info -disable-output
; PR 2639
%struct.HexxagonMove = type { i8, i8, i32 }
define void @_ZN16HexxagonMoveList7addMoveER12HexxagonMove() {
entry:
br i1 false, label %bb9.preheader, label %bb11
bb9.preheader: ; preds = %entry
br label %bb9
bb1: ; preds = %bb9
br i1 false, label %bb3, label %bb8
bb3: ; preds = %bb1
br label %bb5
bb4: ; preds = %bb5
br label %bb5
bb5: ; preds = %bb4, %bb3
%exitcond = icmp eq i32 0, 0 ; <i1> [#uses=1]
br i1 %exitcond, label %bb7, label %bb4
bb7: ; preds = %bb5
store %struct.HexxagonMove* null, %struct.HexxagonMove** null, align 4
br label %bb8
bb8: ; preds = %bb7, %bb1
br label %bb9
bb9: ; preds = %bb8, %bb9.preheader
br i1 false, label %bb11, label %bb1
bb11: ; preds = %bb9, %entry
ret void
}

View File

@ -1,27 +0,0 @@
; RUN: opt < %s -loop-rotate -verify-dom-info -verify-loop-info -disable-output
define void @func() {
bb0:
br label %bb1
bb1: ; preds = %bb4, %bb0
%0 = phi i16 [ %2, %bb4 ], [ 0, %bb0 ]
%1 = icmp sle i16 %0, 2
br i1 %1, label %bb2, label %bb5
bb2: ; preds = %bb1
br i1 undef, label %bb6, label %bb4
bb3: ; No predecessors!
br label %bb6
bb4: ; preds = %bb2
%2 = add i16 undef, 1
br label %bb1
bb5: ; preds = %bb1
br label %bb6
bb6: ; preds = %bb5, %bb3, %bb2
unreachable
}

View File

@ -1,75 +0,0 @@
;RUN: opt %s -passes='adce,loop(rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate 2>&1 | FileCheck %s
;REQUIRES: asserts
; This test is to make sure we invalidate the post dominator pass after loop rotate simplifies the loop latch.
; The adce passes are here to make sure post dominator analysis is required.
; CHECK: Starting llvm::Function pass manager run.
; CHECK-NEXT: Running pass: ADCEPass on f
; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on f
; CHECK-NEXT: Running analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Running pass: FunctionToLoopPassAdaptor{{.*}} on f
; CHECK-NEXT: Starting llvm::Function pass manager run.
; CHECK-NEXT: Running pass: LoopSimplifyPass on f
; CHECK-NEXT: Running analysis: LoopAnalysis on f
; CHECK-NEXT: Running analysis: AssumptionAnalysis on f
; CHECK-NEXT: Running pass: LCSSAPass on f
; CHECK-NEXT: Finished llvm::Function pass manager run.
; CHECK-NEXT: Running analysis: AAManager on f
; CHECK-NEXT: Running analysis: TargetLibraryAnalysis on f
; CHECK-NEXT: Running analysis: ScalarEvolutionAnalysis on f
; CHECK-NEXT: Running analysis: TargetIRAnalysis on f
; CHECK-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
; CHECK-NEXT: Starting Loop pass manager run.
; CHECK-NEXT: Running pass: LoopRotatePass on Loop at depth 1 containing: %bb<header><exiting>,%bb4<latch>
; CHECK-NEXT: Folding loop latch bb4 into bb
; CHECK-NEXT: Invalidating all non-preserved analyses for: bb
; CHECK-NEXT: Finished Loop pass manager run.
; CHECK-NEXT: Invalidating all non-preserved analyses for: f
; CHECK-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Running pass: ADCEPass on f
; CHECK-NEXT: Running analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Finished llvm::Function pass manager run.
; CHECK-LABEL: define i8 @f() {
; CHECK-NEXT : entry:
; CHECK-NEXT : br label %bb
; CHECK-NEXT :
; CHECK-NEXT : bb: ; preds = %bb, %entry
; CHECK-NEXT : %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb ]
; CHECK-NEXT : %tmp5 = icmp eq i8 %mode.0, 1
; CHECK-NEXT : %indvar.next = add i8 %mode.0, 1
; CHECK-NEXT : br i1 %tmp5, label %bb5, label %bb
; CHECK-NEXT :
; CHECK-NEXT : bb5: ; preds = %bb
; CHECK-NEXT : tail call void @raise_exception() #0
; CHECK-NEXT : unreachable
; CHECK-NEXT : }
; CHECK-NEXT :
; CHECK-NEXT : ; Function Attrs: noreturn
; CHECK-NEXT : declare void @raise_exception() #0
; CHECK-NEXT :
; CHECK-NEXT : attributes #0 = { noreturn }
define i8 @f() {
entry:
br label %bb
bb: ; preds = %bb4, %entry
%mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ]
%tmp5 = icmp eq i8 %mode.0, 1
br i1 %tmp5, label %bb5, label %bb4
bb4: ; preds = %bb2
%indvar.next = add i8 %mode.0, 1
br label %bb
bb5: ; preds = %bb2
tail call void @raise_exception() #0
unreachable
}
; Function Attrs: noreturn
declare void @raise_exception() #0
attributes #0 = { noreturn }

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