diff options
Diffstat (limited to 'test/Transforms/LoopRotate')
-rw-r--r-- | test/Transforms/LoopRotate/alloca.ll | 33 | ||||
-rw-r--r-- | test/Transforms/LoopRotate/dg.exp | 3 | ||||
-rw-r--r-- | test/Transforms/LoopRotate/lit.local.cfg | 1 | ||||
-rw-r--r-- | test/Transforms/LoopRotate/simplifylatch.ll | 39 |
4 files changed, 73 insertions, 3 deletions
diff --git a/test/Transforms/LoopRotate/alloca.ll b/test/Transforms/LoopRotate/alloca.ll new file mode 100644 index 0000000..fd217ea --- /dev/null +++ b/test/Transforms/LoopRotate/alloca.ll @@ -0,0 +1,33 @@ +; 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* @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 +} diff --git a/test/Transforms/LoopRotate/dg.exp b/test/Transforms/LoopRotate/dg.exp deleted file mode 100644 index f200589..0000000 --- a/test/Transforms/LoopRotate/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] diff --git a/test/Transforms/LoopRotate/lit.local.cfg b/test/Transforms/LoopRotate/lit.local.cfg new file mode 100644 index 0000000..19eebc0 --- /dev/null +++ b/test/Transforms/LoopRotate/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.ll', '.c', '.cpp'] diff --git a/test/Transforms/LoopRotate/simplifylatch.ll b/test/Transforms/LoopRotate/simplifylatch.ll new file mode 100644 index 0000000..f422724 --- /dev/null +++ b/test/Transforms/LoopRotate/simplifylatch.ll @@ -0,0 +1,39 @@ +; RUN: opt -S < %s -loop-rotate -verify-dom-info -verify-loop-info | FileCheck %s +; PR2624 unroll multiple exits + +@mode_table = global [4 x i32] zeroinitializer ; <[4 x i32]*> [#uses=1] + +; CHECK: @f +; CHECK-NOT: bb4 +define i8 @f() { +entry: + tail call i32 @fegetround( ) ; <i32>:0 [#uses=1] + br label %bb + +bb: ; preds = %bb4, %entry + %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ] ; <i8> [#uses=4] + zext i8 %mode.0 to i32 ; <i32>:1 [#uses=1] + getelementptr [4 x i32]* @mode_table, i32 0, i32 %1 ; <i32*>:2 [#uses=1] + load i32* %2, align 4 ; <i32>:3 [#uses=1] + icmp eq i32 %3, %0 ; <i1>:4 [#uses=1] + br i1 %4, label %bb1, label %bb2 + +bb1: ; preds = %bb + ret i8 %mode.0 + +bb2: ; preds = %bb + icmp eq i8 %mode.0, 1 ; <i1>:5 [#uses=1] + br i1 %5, label %bb5, label %bb4 + +bb4: ; preds = %bb2 + %indvar.next = add i8 %mode.0, 1 ; <i8> [#uses=1] + br label %bb + +bb5: ; preds = %bb2 + tail call void @raise_exception( ) noreturn + unreachable +} + +declare i32 @fegetround() + +declare void @raise_exception() noreturn |