diff options
author | Shih-wei Liao <sliao@google.com> | 2010-02-10 11:10:31 -0800 |
---|---|---|
committer | Shih-wei Liao <sliao@google.com> | 2010-02-10 11:10:31 -0800 |
commit | e264f62ca09a8f65c87a46d562a4d0f9ec5d457e (patch) | |
tree | 59e3d57ef656cef79afa708ae0a3daf25cd91fcf /test/Other | |
download | external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.zip external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.gz external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.bz2 |
Check in LLVM r95781.
Diffstat (limited to 'test/Other')
26 files changed, 1095 insertions, 0 deletions
diff --git a/test/Other/2002-01-31-CallGraph.ll b/test/Other/2002-01-31-CallGraph.ll new file mode 100644 index 0000000..0e4c877 --- /dev/null +++ b/test/Other/2002-01-31-CallGraph.ll @@ -0,0 +1,13 @@ +; Call graph construction crash: Not handling indirect calls right +; +; RUN: opt < %s -analyze -print-callgraph >& /dev/null +; + + %FunTy = type i32 (i32) + +define void @invoke(%FunTy* %x) { + %foo = call i32 %x( i32 123 ) ; <i32> [#uses=0] + ret void +} + + diff --git a/test/Other/2002-02-24-InlineBrokePHINodes.ll b/test/Other/2002-02-24-InlineBrokePHINodes.ll new file mode 100644 index 0000000..db26942 --- /dev/null +++ b/test/Other/2002-02-24-InlineBrokePHINodes.ll @@ -0,0 +1,23 @@ +; Inlining used to break PHI nodes. This tests that they are correctly updated +; when a node is split around the call instruction. The verifier caught the error. +; +; RUN: opt < %s -inline +; + +define i64 @test(i64 %X) { + ret i64 %X +} + +define i64 @fib(i64 %n) { +; <label>:0 + %T = icmp ult i64 %n, 2 ; <i1> [#uses=1] + br i1 %T, label %BaseCase, label %RecurseCase + +RecurseCase: ; preds = %0 + %result = call i64 @test( i64 %n ) ; <i64> [#uses=0] + br label %BaseCase + +BaseCase: ; preds = %RecurseCase, %0 + %X = phi i64 [ 1, %0 ], [ 2, %RecurseCase ] ; <i64> [#uses=1] + ret i64 %X +} diff --git a/test/Other/2002-03-11-ConstPropCrash.ll b/test/Other/2002-03-11-ConstPropCrash.ll new file mode 100644 index 0000000..a6d4f5b --- /dev/null +++ b/test/Other/2002-03-11-ConstPropCrash.ll @@ -0,0 +1,24 @@ +; When constant propogating terminator instructions, the basic block iterator +; was not updated to refer to the final position of the new terminator. This +; can be bad, f.e. because constproping a terminator can lead to the +; destruction of PHI nodes, which invalidates the iterator! +; +; Fixed by adding new arguments to ConstantFoldTerminator +; +; RUN: opt < %s -constprop + +define void @build_tree(i32 %ml) { +; <label>:0 + br label %bb2 + +bb2: ; preds = %bb2, %0 + %reg137 = phi i32 [ %reg140, %bb2 ], [ 12, %0 ] ; <i32> [#uses=1] + %reg138 = phi i32 [ %reg139, %bb2 ], [ 0, %0 ] ; <i32> [#uses=1] + %reg139 = add i32 %reg138, 1 ; <i32> [#uses=1] + %reg140 = add i32 %reg137, -1 ; <i32> [#uses=1] + br i1 false, label %bb2, label %bb3 + +bb3: ; preds = %bb2 + ret void +} + diff --git a/test/Other/2003-02-19-LoopInfoNestingBug.ll b/test/Other/2003-02-19-LoopInfoNestingBug.ll new file mode 100644 index 0000000..13f8351 --- /dev/null +++ b/test/Other/2003-02-19-LoopInfoNestingBug.ll @@ -0,0 +1,29 @@ +; LoopInfo is incorrectly calculating loop nesting! In this case it doesn't +; figure out that loop "Inner" should be nested inside of leep "LoopHeader", +; and instead nests it just inside loop "Top" +; +; RUN: opt < %s -analyze -loops | \ +; RUN: grep { Loop at depth 3 containing: %Inner<header><latch><exiting>} +; +define void @test() { + br label %Top + +Top: ; preds = %Out, %0 + br label %LoopHeader + +Next: ; preds = %LoopHeader + br i1 false, label %Inner, label %Out + +Inner: ; preds = %Inner, %Next + br i1 false, label %Inner, label %LoopHeader + +LoopHeader: ; preds = %Inner, %Top + br label %Next + +Out: ; preds = %Next + br i1 false, label %Top, label %Done + +Done: ; preds = %Out + ret void +} + diff --git a/test/Other/2004-08-16-PackedConstantInlineStore.ll b/test/Other/2004-08-16-PackedConstantInlineStore.ll new file mode 100644 index 0000000..36ac4fd --- /dev/null +++ b/test/Other/2004-08-16-PackedConstantInlineStore.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llvm-dis +@bar = external global <2 x i32> ; <<2 x i32>*> [#uses=1] + +define void @main() { + store <2 x i32> < i32 0, i32 1 >, <2 x i32>* @bar + ret void +} + diff --git a/test/Other/2004-08-16-PackedGlobalConstant.ll b/test/Other/2004-08-16-PackedGlobalConstant.ll new file mode 100644 index 0000000..9130ccb --- /dev/null +++ b/test/Other/2004-08-16-PackedGlobalConstant.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llvm-dis + +@foo = global <2 x i32> < i32 0, i32 1 > ; <<2 x i32>*> [#uses=1] +@bar = external global <2 x i32> ; <<2 x i32>*> [#uses=1] + +define void @main() { + %t0 = load <2 x i32>* @foo ; <<2 x i32>> [#uses=1] + store <2 x i32> %t0, <2 x i32>* @bar + ret void +} + diff --git a/test/Other/2004-08-16-PackedSelect.ll b/test/Other/2004-08-16-PackedSelect.ll new file mode 100644 index 0000000..c1d6214 --- /dev/null +++ b/test/Other/2004-08-16-PackedSelect.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llvm-dis + +@foo = external global <4 x float> ; <<4 x float>*> [#uses=1] +@bar = external global <4 x float> ; <<4 x float>*> [#uses=1] + +define void @main() { + %t0 = load <4 x float>* @foo ; <<4 x float>> [#uses=3] + %t1 = fadd <4 x float> %t0, %t0 ; <<4 x float>> [#uses=1] + %t2 = select i1 true, <4 x float> %t0, <4 x float> %t1 ; <<4 x float>> [#uses=1] + store <4 x float> %t2, <4 x float>* @bar + ret void +} + diff --git a/test/Other/2004-08-16-PackedSimple.ll b/test/Other/2004-08-16-PackedSimple.ll new file mode 100644 index 0000000..81cecd4 --- /dev/null +++ b/test/Other/2004-08-16-PackedSimple.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llvm-dis + +@foo = external global <4 x float> ; <<4 x float>*> [#uses=1] +@bar = external global <4 x float> ; <<4 x float>*> [#uses=1] + +define void @main() { + %t0 = load <4 x float>* @foo ; <<4 x float>> [#uses=3] + %t2 = fadd <4 x float> %t0, %t0 ; <<4 x float>> [#uses=1] + %t3 = select i1 false, <4 x float> %t0, <4 x float> %t2 ; <<4 x float>> [#uses=1] + store <4 x float> %t3, <4 x float>* @bar + ret void +} + diff --git a/test/Other/2004-08-20-PackedControlFlow.ll b/test/Other/2004-08-20-PackedControlFlow.ll new file mode 100644 index 0000000..3943570 --- /dev/null +++ b/test/Other/2004-08-20-PackedControlFlow.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as > /dev/null + + %v4f = type <4 x float> +@foo = external global %v4f ; <%v4f*> [#uses=1] +@bar = external global %v4f ; <%v4f*> [#uses=1] + +define void @main() { + br label %A + +C: ; preds = %B + store %v4f %t2, %v4f* @bar + ret void + +B: ; preds = %A + %t2 = fadd %v4f %t0, %t0 ; <%v4f> [#uses=1] + br label %C + +A: ; preds = %0 + %t0 = load %v4f* @foo ; <%v4f> [#uses=2] + br label %B +} + diff --git a/test/Other/2006-02-05-PassManager.ll b/test/Other/2006-02-05-PassManager.ll new file mode 100644 index 0000000..0ab5411 --- /dev/null +++ b/test/Other/2006-02-05-PassManager.ll @@ -0,0 +1,5 @@ +; RUN: opt < %s -domtree -gvn -domtree -constmerge -disable-output + +define i32 @test1() { + unreachable +} diff --git a/test/Other/2007-04-24-eliminate-mostly-empty-blocks.ll b/test/Other/2007-04-24-eliminate-mostly-empty-blocks.ll new file mode 100644 index 0000000..c436e07 --- /dev/null +++ b/test/Other/2007-04-24-eliminate-mostly-empty-blocks.ll @@ -0,0 +1,309 @@ +;RUN: opt < %s -codegenprepare -disable-output + +define void @foo() { +entry: + br i1 false, label %cond_next31, label %cond_true + +cond_true: ; preds = %entry + br i1 false, label %cond_true19, label %cond_next31 + +cond_true19: ; preds = %cond_true + br i1 false, label %bb510, label %cond_next31 + +cond_next31: ; preds = %cond_true19, %cond_true, %entry + br i1 false, label %cond_true61, label %cond_next78 + +cond_true61: ; preds = %cond_next31 + br label %cond_next78 + +cond_next78: ; preds = %cond_true61, %cond_next31 + br i1 false, label %cond_true93, label %bb.preheader + +cond_true93: ; preds = %cond_next78 + br label %bb.preheader + +bb.preheader: ; preds = %cond_true93, %cond_next78 + %iftmp.11.0.ph.ph = phi i16 [ 0, %cond_true93 ], [ 0, %cond_next78 ] ; <i16> [#uses=1] + br label %bb + +bb: ; preds = %cond_next499, %bb.preheader + %n.1 = phi i16 [ %iftmp.11.0.ph.ph, %cond_next499 ], [ 0, %bb.preheader ] ; <i16> [#uses=0] + br i1 false, label %bb148.preheader, label %bb493 + +bb148.preheader: ; preds = %bb + br label %bb148 + +bb148: ; preds = %cond_next475, %bb148.preheader + br i1 false, label %cond_next175, label %bb184 + +cond_next175: ; preds = %bb148 + br i1 false, label %bb184, label %bb185 + +bb184: ; preds = %cond_next175, %bb148 + br label %bb185 + +bb185: ; preds = %bb184, %cond_next175 + br i1 false, label %bb420.preheader, label %cond_true198 + +bb420.preheader: ; preds = %bb185 + br label %bb420 + +cond_true198: ; preds = %bb185 + br i1 false, label %bb294, label %cond_next208 + +cond_next208: ; preds = %cond_true198 + br i1 false, label %cond_next249, label %cond_true214 + +cond_true214: ; preds = %cond_next208 + br i1 false, label %bb294, label %cond_next262 + +cond_next249: ; preds = %cond_next208 + br i1 false, label %bb294, label %cond_next262 + +cond_next262: ; preds = %cond_next249, %cond_true214 + br label %bb269 + +bb269: ; preds = %cond_next285, %cond_next262 + br i1 false, label %cond_next285, label %cond_true279 + +cond_true279: ; preds = %bb269 + br label %cond_next285 + +cond_next285: ; preds = %cond_true279, %bb269 + br i1 false, label %bb269, label %cond_next446.loopexit + +bb294: ; preds = %cond_next249, %cond_true214, %cond_true198 + br i1 false, label %cond_next336, label %cond_true301 + +cond_true301: ; preds = %bb294 + br i1 false, label %cond_false398, label %cond_true344 + +cond_next336: ; preds = %bb294 + br i1 false, label %cond_false398, label %cond_true344 + +cond_true344: ; preds = %cond_next336, %cond_true301 + br i1 false, label %cond_false381, label %cond_true351 + +cond_true351: ; preds = %cond_true344 + br label %cond_next387 + +cond_false381: ; preds = %cond_true344 + br label %cond_next387 + +cond_next387: ; preds = %cond_false381, %cond_true351 + br label %cond_next401 + +cond_false398: ; preds = %cond_next336, %cond_true301 + br label %cond_next401 + +cond_next401: ; preds = %cond_false398, %cond_next387 + br i1 false, label %cond_next475, label %cond_true453 + +bb420: ; preds = %cond_next434, %bb420.preheader + br i1 false, label %cond_next434, label %cond_true428 + +cond_true428: ; preds = %bb420 + br label %cond_next434 + +cond_next434: ; preds = %cond_true428, %bb420 + br i1 false, label %bb420, label %cond_next446.loopexit1 + +cond_next446.loopexit: ; preds = %cond_next285 + br label %cond_next446 + +cond_next446.loopexit1: ; preds = %cond_next434 + br label %cond_next446 + +cond_next446: ; preds = %cond_next446.loopexit1, %cond_next446.loopexit + br i1 false, label %cond_next475, label %cond_true453 + +cond_true453: ; preds = %cond_next446, %cond_next401 + br i1 false, label %cond_true458, label %cond_next475 + +cond_true458: ; preds = %cond_true453 + br label %cond_next475 + +cond_next475: ; preds = %cond_true458, %cond_true453, %cond_next446, %cond_next401 + br i1 false, label %bb493.loopexit, label %bb148 + +bb493.loopexit: ; preds = %cond_next475 + br label %bb493 + +bb493: ; preds = %bb493.loopexit, %bb + br i1 false, label %cond_next499, label %bb510.loopexit + +cond_next499: ; preds = %bb493 + br label %bb + +bb510.loopexit: ; preds = %bb493 + br label %bb510 + +bb510: ; preds = %bb510.loopexit, %cond_true19 + br i1 false, label %cond_next524, label %cond_true517 + +cond_true517: ; preds = %bb510 + br label %cond_next524 + +cond_next524: ; preds = %cond_true517, %bb510 + br i1 false, label %cond_next540, label %cond_true533 + +cond_true533: ; preds = %cond_next524 + br label %cond_next540 + +cond_next540: ; preds = %cond_true533, %cond_next524 + br i1 false, label %cond_true554, label %cond_next560 + +cond_true554: ; preds = %cond_next540 + br label %cond_next560 + +cond_next560: ; preds = %cond_true554, %cond_next540 + br i1 false, label %cond_true566, label %cond_next572 + +cond_true566: ; preds = %cond_next560 + br label %cond_next572 + +cond_next572: ; preds = %cond_true566, %cond_next560 + br i1 false, label %bb608.preheader, label %bb791.preheader + +bb608.preheader: ; preds = %cond_next797.us, %cond_next572 + br label %bb608 + +bb608: ; preds = %cond_next771, %bb608.preheader + br i1 false, label %cond_false627, label %cond_true613 + +cond_true613: ; preds = %bb608 + br label %cond_next640 + +cond_false627: ; preds = %bb608 + br label %cond_next640 + +cond_next640: ; preds = %cond_false627, %cond_true613 + br i1 false, label %cond_true653, label %cond_next671 + +cond_true653: ; preds = %cond_next640 + br label %cond_next671 + +cond_next671: ; preds = %cond_true653, %cond_next640 + br i1 false, label %cond_true683, label %cond_next724 + +cond_true683: ; preds = %cond_next671 + br i1 false, label %cond_next724, label %L1 + +cond_next724: ; preds = %cond_true683, %cond_next671 + br i1 false, label %cond_true735, label %L1 + +cond_true735: ; preds = %cond_next724 + br label %L1 + +L1: ; preds = %cond_true735, %cond_next724, %cond_true683 + br i1 false, label %cond_true745, label %cond_next771 + +cond_true745: ; preds = %L1 + br label %cond_next771 + +cond_next771: ; preds = %cond_true745, %L1 + br i1 false, label %bb608, label %bb791.preheader.loopexit + +bb791.preheader.loopexit: ; preds = %cond_next771 + br label %bb791.preheader + +bb791.preheader: ; preds = %bb791.preheader.loopexit, %cond_next572 + br i1 false, label %cond_next797.us, label %bb809.split + +cond_next797.us: ; preds = %bb791.preheader + br label %bb608.preheader + +bb809.split: ; preds = %bb791.preheader + br i1 false, label %cond_next827, label %cond_true820 + +cond_true820: ; preds = %bb809.split + br label %cond_next827 + +cond_next827: ; preds = %cond_true820, %bb809.split + br i1 false, label %cond_true833, label %cond_next840 + +cond_true833: ; preds = %cond_next827 + br label %cond_next840 + +cond_next840: ; preds = %cond_true833, %cond_next827 + br i1 false, label %bb866, label %bb1245 + +bb866: ; preds = %bb1239, %cond_next840 + br i1 false, label %cond_true875, label %bb911 + +cond_true875: ; preds = %bb866 + br label %cond_next1180 + +bb911: ; preds = %bb866 + switch i32 0, label %bb1165 [ + i32 0, label %bb915 + i32 1, label %bb932 + i32 2, label %bb941 + i32 3, label %bb1029 + i32 4, label %bb1036 + i32 5, label %bb1069 + i32 6, label %L3 + ] + +bb915: ; preds = %cond_next1171, %bb911 + br i1 false, label %cond_next1171, label %cond_next1180 + +bb932: ; preds = %cond_next1171, %bb911 + br label %L1970 + +bb941: ; preds = %cond_next1171, %bb911 + br label %L1970 + +L1970: ; preds = %bb941, %bb932 + br label %bb1165 + +bb1029: ; preds = %cond_next1171, %bb911 + br label %L4 + +bb1036: ; preds = %cond_next1171, %bb911 + br label %L4 + +bb1069: ; preds = %cond_next1171, %bb911 + br i1 false, label %cond_next1121, label %cond_true1108 + +L3: ; preds = %cond_next1171, %bb911 + br i1 false, label %cond_next1121, label %cond_true1108 + +cond_true1108: ; preds = %L3, %bb1069 + br label %L4 + +cond_next1121: ; preds = %L3, %bb1069 + br label %L4 + +L4: ; preds = %cond_next1121, %cond_true1108, %bb1036, %bb1029 + br label %bb1165 + +bb1165: ; preds = %cond_next1171, %L4, %L1970, %bb911 + br i1 false, label %cond_next1171, label %cond_next1180 + +cond_next1171: ; preds = %bb1165, %bb915 + switch i32 0, label %bb1165 [ + i32 0, label %bb915 + i32 1, label %bb932 + i32 2, label %bb941 + i32 3, label %bb1029 + i32 4, label %bb1036 + i32 5, label %bb1069 + i32 6, label %L3 + ] + +cond_next1180: ; preds = %bb1165, %bb915, %cond_true875 + br label %bb1239 + +bb1239: ; preds = %cond_next1251, %cond_next1180 + br i1 false, label %bb866, label %bb1245 + +bb1245: ; preds = %bb1239, %cond_next840 + br i1 false, label %cond_next1251, label %bb1257 + +cond_next1251: ; preds = %bb1245 + br label %bb1239 + +bb1257: ; preds = %bb1245 + ret void +} diff --git a/test/Other/2007-06-05-PassID.ll b/test/Other/2007-06-05-PassID.ll new file mode 100644 index 0000000..2554b8b --- /dev/null +++ b/test/Other/2007-06-05-PassID.ll @@ -0,0 +1,11 @@ +;RUN: opt < %s -analyze -dot-cfg-only 2>/dev/null +;PR 1497 + +define void @foo() { +entry: + br label %return + +return: ; preds = %entry + ret void +} + diff --git a/test/Other/2007-06-28-PassManager.ll b/test/Other/2007-06-28-PassManager.ll new file mode 100644 index 0000000..0ed2759 --- /dev/null +++ b/test/Other/2007-06-28-PassManager.ll @@ -0,0 +1,7 @@ +; RUN: opt < %s -analyze -inline +; PR1526 +; RUN: opt < %s -analyze -indvars +; PR1539 +define i32 @test1() { + ret i32 0 +} diff --git a/test/Other/2007-09-10-PassManager.ll b/test/Other/2007-09-10-PassManager.ll new file mode 100644 index 0000000..ded15e5 --- /dev/null +++ b/test/Other/2007-09-10-PassManager.ll @@ -0,0 +1,32 @@ +; RUN: opt < %s -loop-unswitch -indvars -disable-output +; Require SCEV before LCSSA. +define void @foo() { +entry: + %i = alloca i32, align 4 ; <i32*> [#uses=5] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + store i32 0, i32* %i, align 4 + br label %bb3 + +bb: ; preds = %bb3 + %tmp = load i32* %i, align 4 ; <i32> [#uses=1] + call void @bar( i32 %tmp ) + %tmp1 = load i32* %i, align 4 ; <i32> [#uses=1] + %tmp2 = add i32 %tmp1, 1 ; <i32> [#uses=1] + store i32 %tmp2, i32* %i, align 4 + br label %bb3 + +bb3: ; preds = %bb, %entry + %tmp4 = load i32* %i, align 4 ; <i32> [#uses=1] + %tmp5 = icmp sle i32 %tmp4, 9 ; <i1> [#uses=1] + %tmp56 = zext i1 %tmp5 to i8 ; <i8> [#uses=1] + %toBool = icmp ne i8 %tmp56, 0 ; <i1> [#uses=1] + br i1 %toBool, label %bb, label %bb7 + +bb7: ; preds = %bb3 + br label %return + +return: ; preds = %bb7 + ret void +} + +declare void @bar(i32) diff --git a/test/Other/2008-02-14-PassManager.ll b/test/Other/2008-02-14-PassManager.ll new file mode 100644 index 0000000..bdaf933 --- /dev/null +++ b/test/Other/2008-02-14-PassManager.ll @@ -0,0 +1,5 @@ +; RUN: opt < %s -loop-unroll -loop-rotate -simplifycfg -disable-output +; PR2028 +define i32 @test1() { + ret i32 0 +} diff --git a/test/Other/2008-03-19-PassManager.ll b/test/Other/2008-03-19-PassManager.ll new file mode 100644 index 0000000..e208222 --- /dev/null +++ b/test/Other/2008-03-19-PassManager.ll @@ -0,0 +1,58 @@ +; PR 2034 +; RUN: opt < %s -anders-aa -instcombine -gvn -disable-output + %struct.FULL = type { i32, i32, [1000 x float*] } + +define i32 @sgesl(%struct.FULL* %a, i32* %ipvt, float* %b, i32 %job) { +entry: + %a_addr = alloca %struct.FULL* ; <%struct.FULL**> [#uses=1] + %ipvt_addr = alloca i32* ; <i32**> [#uses=1] + %b_addr = alloca float* ; <float**> [#uses=1] + %job_addr = alloca i32 ; <i32*> [#uses=1] + %akk = alloca float* ; <float**> [#uses=2] + %k = alloca i32 ; <i32*> [#uses=1] + %l = alloca i32 ; <i32*> [#uses=1] + %n = alloca i32 ; <i32*> [#uses=1] + %nm1 = alloca i32 ; <i32*> [#uses=1] + %tmp5 = load i32* %job_addr, align 4 ; <i32> [#uses=1] + %tmp6 = icmp eq i32 %tmp5, 0 ; <i1> [#uses=1] + %tmp67 = zext i1 %tmp6 to i8 ; <i8> [#uses=1] + %toBool = icmp ne i8 %tmp67, 0 ; <i1> [#uses=1] + br i1 %toBool, label %cond_true, label %cond_next137 + +cond_true: ; preds = %entry + %tmp732 = load i32* %nm1, align 4 ; <i32> [#uses=1] + %tmp743 = icmp slt i32 0, %tmp732 ; <i1> [#uses=1] + %tmp74754 = zext i1 %tmp743 to i8 ; <i8> [#uses=1] + %toBool765 = icmp ne i8 %tmp74754, 0 ; <i1> [#uses=1] + br i1 %toBool765, label %bb, label %bb77 + +bb: ; preds = %cond_true + %tmp9 = load %struct.FULL** %a_addr, align 4 ; <%struct.FULL*> [#uses=1] + %tmp10 = getelementptr %struct.FULL* %tmp9, i32 0, i32 2 ; <[1000 x float*]*> [#uses=1] + %tmp11 = getelementptr [1000 x float*]* %tmp10, i32 0, i32 0 ; <float**> [#uses=1] + %tmp12 = load float** %tmp11, align 4 ; <float*> [#uses=1] + %tmp13 = load i32* %k, align 4 ; <i32> [#uses=1] + %tmp14 = getelementptr float* %tmp12, i32 %tmp13 ; <float*> [#uses=1] + store float* %tmp14, float** %akk, align 4 + %tmp17 = load float** %b_addr, align 4 ; <float*> [#uses=0] + %tmp18 = load i32* %l, align 4 ; <i32> [#uses=0] + ret i32 0 + +bb77: ; preds = %cond_true + ret i32 0 + +cond_next137: ; preds = %entry + %tmp18922 = load i32* %n, align 4 ; <i32> [#uses=1] + %tmp19023 = icmp slt i32 0, %tmp18922 ; <i1> [#uses=1] + %tmp19019124 = zext i1 %tmp19023 to i8 ; <i8> [#uses=1] + %toBool19225 = icmp ne i8 %tmp19019124, 0 ; <i1> [#uses=1] + br i1 %toBool19225, label %bb138, label %bb193 + +bb138: ; preds = %cond_next137 + store float* null, float** %akk, align 4 + ret i32 0 + +bb193: ; preds = %cond_next137 + %tmp196 = load i32** %ipvt_addr, align 4 ; <i32*> [#uses=0] + ret i32 0 +} diff --git a/test/Other/2008-06-04-FieldSizeInPacked.ll b/test/Other/2008-06-04-FieldSizeInPacked.ll new file mode 100644 index 0000000..d90209f --- /dev/null +++ b/test/Other/2008-06-04-FieldSizeInPacked.ll @@ -0,0 +1,14 @@ +; RUN: opt < %s -instcombine -S | grep true + +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" + %packed = type <{ x86_fp80, i8 }> + %unpacked = type { x86_fp80, i8 } + +define i1 @q() nounwind { +entry: + %char_p = getelementptr %packed* null, i32 0, i32 1 ; <i8*> [#uses=1] + %char_u = getelementptr %unpacked* null, i32 0, i32 1 ; <i8*> [#uses=1] + %res = icmp eq i8* %char_p, %char_u ; <i1> [#uses=1] + ret i1 %res +} diff --git a/test/Other/2008-08-14-PassManager.ll b/test/Other/2008-08-14-PassManager.ll new file mode 100644 index 0000000..8d6a6d8 --- /dev/null +++ b/test/Other/2008-08-14-PassManager.ll @@ -0,0 +1,5 @@ +; RUN: opt < %s -loop-deletion -loop-index-split -disable-output +; PR2640 +define i32 @test1() { + ret i32 0 +} diff --git a/test/Other/2008-10-06-RemoveDeadPass.ll b/test/Other/2008-10-06-RemoveDeadPass.ll new file mode 100644 index 0000000..7cec2c5 --- /dev/null +++ b/test/Other/2008-10-06-RemoveDeadPass.ll @@ -0,0 +1,11 @@ +; RUN: opt < %s -inline -internalize -disable-output +define void @foo() nounwind { + ret void +} + +define void @main(...) nounwind { + call void @foo() + ret void +} + + diff --git a/test/Other/2008-10-15-MissingSpace.ll b/test/Other/2008-10-15-MissingSpace.ll new file mode 100644 index 0000000..a61fa61 --- /dev/null +++ b/test/Other/2008-10-15-MissingSpace.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llvm-dis | not grep {void@} +; PR2894 +declare void @g() +define void @f() { + invoke void @g() to label %c unwind label %c + c: ret void +} diff --git a/test/Other/2009-03-31-CallGraph.ll b/test/Other/2009-03-31-CallGraph.ll new file mode 100644 index 0000000..d6653ec --- /dev/null +++ b/test/Other/2009-03-31-CallGraph.ll @@ -0,0 +1,31 @@ +; RUN: opt < %s -inline -prune-eh -disable-output +define void @f2() { + invoke void @f6() + to label %ok1 unwind label %lpad1 + +ok1: + ret void + +lpad1: + invoke void @f4() + to label %ok2 unwind label %lpad2 + +ok2: + call void @f8() + unreachable + +lpad2: + unreachable +} + +declare void @f3() + +define void @f4() { + call void @f3() + ret void +} + +declare void @f6() nounwind + +declare void @f8() + diff --git a/test/Other/2009-06-05-no-implicit-float.ll b/test/Other/2009-06-05-no-implicit-float.ll new file mode 100644 index 0000000..3f07170 --- /dev/null +++ b/test/Other/2009-06-05-no-implicit-float.ll @@ -0,0 +1,4 @@ + +; RUN: opt < %s -verify -S | grep noimplicitfloat +declare void @f() noimplicitfloat + diff --git a/test/Other/2009-09-14-function-elements.ll b/test/Other/2009-09-14-function-elements.ll new file mode 100644 index 0000000..883d76d --- /dev/null +++ b/test/Other/2009-09-14-function-elements.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as %s -disable-output 2>/dev/null + +; Arrays and structures with function types (not function pointers) are illegal. + +@foo = external global [4 x i32 (i32)] +@bar = external global { i32 (i32) } diff --git a/test/Other/constant-fold-gep.ll b/test/Other/constant-fold-gep.ll new file mode 100644 index 0000000..2888b3d --- /dev/null +++ b/test/Other/constant-fold-gep.ll @@ -0,0 +1,428 @@ +; "PLAIN" - No optimizations. This tests the target-independent +; constant folder. +; RUN: opt -S -o - < %s | FileCheck --check-prefix=PLAIN %s + +; "OPT" - Optimizations but no targetdata. This tests target-independent +; folding in the optimizers. +; RUN: opt -S -o - -instcombine -globalopt < %s | FileCheck --check-prefix=OPT %s + +; "TO" - Optimizations and targetdata. This tests target-dependent +; folding in the optimizers. +; RUN: opt -S -o - -instcombine -globalopt -default-data-layout="e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" < %s | FileCheck --check-prefix=TO %s + +; "SCEV" - ScalarEvolution but no targetdata. +; RUN: opt -analyze -scalar-evolution < %s | FileCheck --check-prefix=SCEV %s + +; ScalarEvolution with targetdata isn't interesting on these testcases +; because ScalarEvolution doesn't attempt to duplicate all of instcombine's +; and the constant folders' folding. + +; PLAIN: %0 = type { i1, double } +; PLAIN: %1 = type { double, float, double, double } +; PLAIN: %2 = type { i1, i1* } +; PLAIN: %3 = type { i64, i64 } +; OPT: %0 = type { i1, double } +; OPT: %1 = type { double, float, double, double } +; OPT: %2 = type { i1, i1* } +; OPT: %3 = type { i64, i64 } + +; The automatic constant folder in opt does not have targetdata access, so +; it can't fold gep arithmetic, in general. However, the constant folder run +; from instcombine and global opt can use targetdata. + +; PLAIN: @G8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) +; PLAIN: @G1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) +; PLAIN: @F8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) +; PLAIN: @F1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) +; PLAIN: @H8 = global i8* getelementptr (i8* null, i32 -1) +; PLAIN: @H1 = global i1* getelementptr (i1* null, i32 -1) +; OPT: @G8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) +; OPT: @G1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) +; OPT: @F8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) +; OPT: @F1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) +; OPT: @H8 = global i8* getelementptr (i8* null, i32 -1) +; OPT: @H1 = global i1* getelementptr (i1* null, i32 -1) +; TO: @G8 = global i8* null +; TO: @G1 = global i1* null +; TO: @F8 = global i8* inttoptr (i64 -1 to i8*) +; TO: @F1 = global i1* inttoptr (i64 -1 to i1*) +; TO: @H8 = global i8* inttoptr (i64 -1 to i8*) +; TO: @H1 = global i1* inttoptr (i64 -1 to i1*) + +@G8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) +@G1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) +@F8 = global i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) +@F1 = global i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) +@H8 = global i8* getelementptr (i8* inttoptr (i32 0 to i8*), i32 -1) +@H1 = global i1* getelementptr (i1* inttoptr (i32 0 to i1*), i32 -1) + +; The target-independent folder should be able to do some clever +; simplifications on sizeof, alignof, and offsetof expressions. The +; target-dependent folder should fold these down to constants. + +; PLAIN: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) +; PLAIN: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; PLAIN: @c = constant i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) +; PLAIN: @d = constant i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) +; PLAIN: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) +; PLAIN: @f = constant i64 1 +; PLAIN: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; PLAIN: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; PLAIN: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; OPT: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) +; OPT: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; OPT: @c = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) +; OPT: @d = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) +; OPT: @e = constant i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) +; OPT: @f = constant i64 1 +; OPT: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; OPT: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; OPT: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; TO: @a = constant i64 18480 +; TO: @b = constant i64 8 +; TO: @c = constant i64 16 +; TO: @d = constant i64 88 +; TO: @e = constant i64 16 +; TO: @f = constant i64 1 +; TO: @g = constant i64 8 +; TO: @h = constant i64 8 +; TO: @i = constant i64 8 + +@a = constant i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) +@b = constant i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64) +@c = constant i64 ptrtoint (double* getelementptr ({double, double, double, double}* null, i64 0, i32 2) to i64) +@d = constant i64 ptrtoint (double* getelementptr ([13 x double]* null, i64 0, i32 11) to i64) +@e = constant i64 ptrtoint (double* getelementptr ({double, float, double, double}* null, i64 0, i32 2) to i64) +@f = constant i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64) +@g = constant i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64) +@h = constant i64 ptrtoint (double** getelementptr (double** null, i64 1) to i64) +@i = constant i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) + +; The target-dependent folder should cast GEP indices to integer-sized pointers. + +; PLAIN: @M = constant i64* getelementptr (i64* null, i32 1) +; PLAIN: @N = constant i64* getelementptr (%3* null, i32 0, i32 1) +; PLAIN: @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1) +; OPT: @M = constant i64* getelementptr (i64* null, i32 1) +; OPT: @N = constant i64* getelementptr (%3* null, i32 0, i32 1) +; OPT: @O = constant i64* getelementptr ([2 x i64]* null, i32 0, i32 1) +; TO: @M = constant i64* inttoptr (i64 8 to i64*) +; TO: @N = constant i64* inttoptr (i64 8 to i64*) +; TO: @O = constant i64* inttoptr (i64 8 to i64*) + +@M = constant i64* getelementptr (i64 *null, i32 1) +@N = constant i64* getelementptr ({ i64, i64 } *null, i32 0, i32 1) +@O = constant i64* getelementptr ([2 x i64] *null, i32 0, i32 1) + +; Duplicate all of the above as function return values rather than +; global initializers. + +; PLAIN: define i8* @goo8() nounwind { +; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8* +; PLAIN: ret i8* %t +; PLAIN: } +; PLAIN: define i1* @goo1() nounwind { +; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1* +; PLAIN: ret i1* %t +; PLAIN: } +; PLAIN: define i8* @foo8() nounwind { +; PLAIN: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8* +; PLAIN: ret i8* %t +; PLAIN: } +; PLAIN: define i1* @foo1() nounwind { +; PLAIN: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1* +; PLAIN: ret i1* %t +; PLAIN: } +; PLAIN: define i8* @hoo8() nounwind { +; PLAIN: %t = bitcast i8* getelementptr (i8* null, i32 -1) to i8* +; PLAIN: ret i8* %t +; PLAIN: } +; PLAIN: define i1* @hoo1() nounwind { +; PLAIN: %t = bitcast i1* getelementptr (i1* null, i32 -1) to i1* +; PLAIN: ret i1* %t +; PLAIN: } +; OPT: define i8* @goo8() nounwind { +; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) +; OPT: } +; OPT: define i1* @goo1() nounwind { +; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) +; OPT: } +; OPT: define i8* @foo8() nounwind { +; OPT: ret i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) +; OPT: } +; OPT: define i1* @foo1() nounwind { +; OPT: ret i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) +; OPT: } +; OPT: define i8* @hoo8() nounwind { +; OPT: ret i8* getelementptr (i8* null, i32 -1) +; OPT: } +; OPT: define i1* @hoo1() nounwind { +; OPT: ret i1* getelementptr (i1* null, i32 -1) +; OPT: } +; TO: define i8* @goo8() nounwind { +; TO: ret i8* null +; TO: } +; TO: define i1* @goo1() nounwind { +; TO: ret i1* null +; TO: } +; TO: define i8* @foo8() nounwind { +; TO: ret i8* inttoptr (i64 -1 to i8*) +; TO: } +; TO: define i1* @foo1() nounwind { +; TO: ret i1* inttoptr (i64 -1 to i1*) +; TO: } +; TO: define i8* @hoo8() nounwind { +; TO: ret i8* inttoptr (i64 -1 to i8*) +; TO: } +; TO: define i1* @hoo1() nounwind { +; TO: ret i1* inttoptr (i64 -1 to i1*) +; TO: } +; SCEV: Classifying expressions for: @goo8 +; SCEV: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8* +; SCEV: --> ((-1 * sizeof(i8)) + inttoptr (i32 1 to i8*)) +; SCEV: Classifying expressions for: @goo1 +; SCEV: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1* +; SCEV: --> ((-1 * sizeof(i1)) + inttoptr (i32 1 to i1*)) +; SCEV: Classifying expressions for: @foo8 +; SCEV: %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8* +; SCEV: --> ((-2 * sizeof(i8)) + inttoptr (i32 1 to i8*)) +; SCEV: Classifying expressions for: @foo1 +; SCEV: %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1* +; SCEV: --> ((-2 * sizeof(i1)) + inttoptr (i32 1 to i1*)) +; SCEV: Classifying expressions for: @hoo8 +; SCEV: --> (-1 * sizeof(i8)) +; SCEV: Classifying expressions for: @hoo1 +; SCEV: --> (-1 * sizeof(i1)) + +define i8* @goo8() nounwind { + %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -1) to i8* + ret i8* %t +} +define i1* @goo1() nounwind { + %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -1) to i1* + ret i1* %t +} +define i8* @foo8() nounwind { + %t = bitcast i8* getelementptr (i8* inttoptr (i32 1 to i8*), i32 -2) to i8* + ret i8* %t +} +define i1* @foo1() nounwind { + %t = bitcast i1* getelementptr (i1* inttoptr (i32 1 to i1*), i32 -2) to i1* + ret i1* %t +} +define i8* @hoo8() nounwind { + %t = bitcast i8* getelementptr (i8* inttoptr (i32 0 to i8*), i32 -1) to i8* + ret i8* %t +} +define i1* @hoo1() nounwind { + %t = bitcast i1* getelementptr (i1* inttoptr (i32 0 to i1*), i32 -1) to i1* + ret i1* %t +} + +; PLAIN: define i64 @fa() nounwind { +; PLAIN: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64 +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fb() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64 +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fc() nounwind { +; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) to i64 +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fd() nounwind { +; PLAIN: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) to i64 +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fe() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) to i64 +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @ff() nounwind { +; PLAIN: %t = bitcast i64 1 to i64 +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fg() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fh() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; PLAIN: ret i64 %t +; PLAIN: } +; PLAIN: define i64 @fi() nounwind { +; PLAIN: %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; PLAIN: ret i64 %t +; PLAIN: } +; OPT: define i64 @fa() nounwind { +; OPT: ret i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) +; OPT: } +; OPT: define i64 @fb() nounwind { +; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; OPT: } +; OPT: define i64 @fc() nounwind { +; OPT: ret i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) +; OPT: } +; OPT: define i64 @fd() nounwind { +; OPT: ret i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) +; OPT: } +; OPT: define i64 @fe() nounwind { +; OPT: ret i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) +; OPT: } +; OPT: define i64 @ff() nounwind { +; OPT: ret i64 1 +; OPT: } +; OPT: define i64 @fg() nounwind { +; OPT: ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; OPT: } +; OPT: define i64 @fh() nounwind { +; OPT: ret i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; OPT: } +; OPT: define i64 @fi() nounwind { +; OPT: ret i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; OPT: } +; TO: define i64 @fa() nounwind { +; TO: ret i64 18480 +; TO: } +; TO: define i64 @fb() nounwind { +; TO: ret i64 8 +; TO: } +; TO: define i64 @fc() nounwind { +; TO: ret i64 16 +; TO: } +; TO: define i64 @fd() nounwind { +; TO: ret i64 88 +; TO: } +; TO: define i64 @fe() nounwind { +; TO: ret i64 16 +; TO: } +; TO: define i64 @ff() nounwind { +; TO: ret i64 1 +; TO: } +; TO: define i64 @fg() nounwind { +; TO: ret i64 8 +; TO: } +; TO: define i64 @fh() nounwind { +; TO: ret i64 8 +; TO: } +; TO: define i64 @fi() nounwind { +; TO: ret i64 8 +; TO: } +; SCEV: Classifying expressions for: @fa +; SCEV: %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64 +; SCEV: --> (2310 * sizeof(double)) +; SCEV: Classifying expressions for: @fb +; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64 +; SCEV: --> alignof(double) +; SCEV: Classifying expressions for: @fc +; SCEV: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2) to i64 +; SCEV: --> (2 * sizeof(double)) +; SCEV: Classifying expressions for: @fd +; SCEV: %t = bitcast i64 mul nuw (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 11) to i64 +; SCEV: --> (11 * sizeof(double)) +; SCEV: Classifying expressions for: @fe +; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%1* null, i64 0, i32 2) to i64) to i64 +; SCEV: --> offsetof({ double, float, double, double }, 2) +; SCEV: Classifying expressions for: @ff +; SCEV: %t = bitcast i64 1 to i64 +; SCEV: --> 1 +; SCEV: Classifying expressions for: @fg +; SCEV: %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) +; SCEV: --> alignof(double) +; SCEV: Classifying expressions for: @fh +; SCEV: %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) +; SCEV: --> sizeof(i1*) +; SCEV: Classifying expressions for: @fi +; SCEV: %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) +; SCEV: --> alignof(i1*) + +define i64 @fa() nounwind { + %t = bitcast i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) to i64 + ret i64 %t +} +define i64 @fb() nounwind { + %t = bitcast i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64) to i64 + ret i64 %t +} +define i64 @fc() nounwind { + %t = bitcast i64 ptrtoint (double* getelementptr ({double, double, double, double}* null, i64 0, i32 2) to i64) to i64 + ret i64 %t +} +define i64 @fd() nounwind { + %t = bitcast i64 ptrtoint (double* getelementptr ([13 x double]* null, i64 0, i32 11) to i64) to i64 + ret i64 %t +} +define i64 @fe() nounwind { + %t = bitcast i64 ptrtoint (double* getelementptr ({double, float, double, double}* null, i64 0, i32 2) to i64) to i64 + ret i64 %t +} +define i64 @ff() nounwind { + %t = bitcast i64 ptrtoint (<{ i16, i128 }>* getelementptr ({i1, <{ i16, i128 }>}* null, i64 0, i32 1) to i64) to i64 + ret i64 %t +} +define i64 @fg() nounwind { + %t = bitcast i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64) to i64 + ret i64 %t +} +define i64 @fh() nounwind { + %t = bitcast i64 ptrtoint (double** getelementptr (double** null, i32 1) to i64) to i64 + ret i64 %t +} +define i64 @fi() nounwind { + %t = bitcast i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) to i64 + ret i64 %t +} + +; PLAIN: define i64* @fM() nounwind { +; PLAIN: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64* +; PLAIN: ret i64* %t +; PLAIN: } +; PLAIN: define i64* @fN() nounwind { +; PLAIN: %t = bitcast i64* getelementptr (%3* null, i32 0, i32 1) to i64* +; PLAIN: ret i64* %t +; PLAIN: } +; PLAIN: define i64* @fO() nounwind { +; PLAIN: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64* +; PLAIN: ret i64* %t +; PLAIN: } +; OPT: define i64* @fM() nounwind { +; OPT: ret i64* getelementptr (i64* null, i32 1) +; OPT: } +; OPT: define i64* @fN() nounwind { +; OPT: ret i64* getelementptr (%3* null, i32 0, i32 1) +; OPT: } +; OPT: define i64* @fO() nounwind { +; OPT: ret i64* getelementptr ([2 x i64]* null, i32 0, i32 1) +; OPT: } +; TO: define i64* @fM() nounwind { +; TO: ret i64* inttoptr (i64 8 to i64*) +; TO: } +; TO: define i64* @fN() nounwind { +; TO: ret i64* inttoptr (i64 8 to i64*) +; TO: } +; TO: define i64* @fO() nounwind { +; TO: ret i64* inttoptr (i64 8 to i64*) +; TO: } +; SCEV: Classifying expressions for: @fM +; SCEV: %t = bitcast i64* getelementptr (i64* null, i32 1) to i64* +; SCEV: --> sizeof(i64) +; SCEV: Classifying expressions for: @fN +; SCEV: %t = bitcast i64* getelementptr (%3* null, i32 0, i32 1) to i64* +; SCEV: --> sizeof(i64) +; SCEV: Classifying expressions for: @fO +; SCEV: %t = bitcast i64* getelementptr ([2 x i64]* null, i32 0, i32 1) to i64* +; SCEV: --> sizeof(i64) + +define i64* @fM() nounwind { + %t = bitcast i64* getelementptr (i64 *null, i32 1) to i64* + ret i64* %t +} +define i64* @fN() nounwind { + %t = bitcast i64* getelementptr ({ i64, i64 } *null, i32 0, i32 1) to i64* + ret i64* %t +} +define i64* @fO() nounwind { + %t = bitcast i64* getelementptr ([2 x i64] *null, i32 0, i32 1) to i64* + ret i64* %t +} diff --git a/test/Other/dg.exp b/test/Other/dg.exp new file mode 100644 index 0000000..f200589 --- /dev/null +++ b/test/Other/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] diff --git a/test/Other/invalid-commandline-option.ll b/test/Other/invalid-commandline-option.ll new file mode 100644 index 0000000..60840fa --- /dev/null +++ b/test/Other/invalid-commandline-option.ll @@ -0,0 +1,3 @@ +; RUN: not opt --foo |& grep {Unknown command line argument} + +; there is no --foo |