diff options
author | Dan Gohman <gohman@apple.com> | 2009-11-20 20:51:18 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-11-20 20:51:18 +0000 |
commit | a58a04921deba911d6ead8d24f495cec234681c1 (patch) | |
tree | b051c1c24f3d53ceea308c0a6ca0ddb599f21e57 /test/Transforms | |
parent | 6a2392131e2e5b8c4123d69cc959831b4fe719ca (diff) | |
download | llvm-a58a04921deba911d6ead8d24f495cec234681c1.tar.gz llvm-a58a04921deba911d6ead8d24f495cec234681c1.tar.bz2 llvm-a58a04921deba911d6ead8d24f495cec234681c1.tar.xz |
Make Loop::getLoopLatch() work on loops which don't have preheaders, as
it may be used in contexts where preheader insertion may have failed due
to an indirectbr.
Make LoopSimplify's LoopSimplify::SeparateNestedLoop properly fail in
the case that it would require splitting an indirectbr edge.
These fix PR5502.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89484 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/LoopRotate/indirectbr.ll | 43 | ||||
-rw-r--r-- | test/Transforms/LoopSimplify/indirectbr.ll | 17 |
2 files changed, 60 insertions, 0 deletions
diff --git a/test/Transforms/LoopRotate/indirectbr.ll b/test/Transforms/LoopRotate/indirectbr.ll new file mode 100644 index 0000000000..9c82aa8834 --- /dev/null +++ b/test/Transforms/LoopRotate/indirectbr.ll @@ -0,0 +1,43 @@ +; 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* 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] +} diff --git a/test/Transforms/LoopSimplify/indirectbr.ll b/test/Transforms/LoopSimplify/indirectbr.ll index b0238473b6..2e4549d1e9 100644 --- a/test/Transforms/LoopSimplify/indirectbr.ll +++ b/test/Transforms/LoopSimplify/indirectbr.ll @@ -81,3 +81,20 @@ L1: %y = phi i64 [ %z, %L0 ], [ 1, %entry ] ret i64 %y } + +define void @pr5502() nounwind { +entry: + br label %while.cond + +while.cond: + br i1 undef, label %while.body, label %while.end + +while.body: + indirectbr i8* undef, [label %end_opcode, label %end_opcode] + +end_opcode: + br i1 false, label %end_opcode, label %while.cond + +while.end: + ret void +} |