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/Assembler | |
download | external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.zip external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.gz external_llvm-e264f62ca09a8f65c87a46d562a4d0f9ec5d457e.tar.bz2 |
Check in LLVM r95781.
Diffstat (limited to 'test/Assembler')
128 files changed, 1820 insertions, 0 deletions
diff --git a/test/Assembler/2002-01-24-BadSymbolTableAssert.ll b/test/Assembler/2002-01-24-BadSymbolTableAssert.ll new file mode 100644 index 0000000..7c49e2b --- /dev/null +++ b/test/Assembler/2002-01-24-BadSymbolTableAssert.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as %s -o /dev/null + +; This testcase failed due to a bad assertion in SymbolTable.cpp, removed in +; the 1.20 revision. Basically the symbol table assumed that if there was an +; abstract type in the symbol table, [in this case for the entry %foo of type +; void(opaque)* ], that there should have also been named types by now. This +; was obviously not the case here, and this is valid. Assertion disabled. + +%bb = type i32 + +declare void @foo(i32) diff --git a/test/Assembler/2002-01-24-ValueRefineAbsType.ll b/test/Assembler/2002-01-24-ValueRefineAbsType.ll new file mode 100644 index 0000000..6e49674 --- /dev/null +++ b/test/Assembler/2002-01-24-ValueRefineAbsType.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as %s -o /dev/null + +; This testcase used to fail due to a lack of this diff in Value.cpp: +; diff -r1.16 Value.cpp +; 11c11 +; < #include "llvm/Type.h" +; --- +; > #include "llvm/DerivedTypes.h" +; 74c74,76 +; < assert(Ty.get() == (const Type*)OldTy &&"Can't refine anything but my type!"); +; --- +; > assert(Ty.get() == OldTy &&"Can't refine anything but my type!"); +; > if (OldTy == NewTy && !OldTy->isAbstract()) +; > Ty.removeUserFromConcrete(); +; +; This was causing an assertion failure, due to the "foo" Method object never +; releasing it's reference to the opaque %bb value. +; + +%bb = type i32 +%exception_descriptor = type i32 + +declare void @foo(i32) diff --git a/test/Assembler/2002-02-19-TypeParsing.ll b/test/Assembler/2002-02-19-TypeParsing.ll new file mode 100644 index 0000000..0df6784 --- /dev/null +++ b/test/Assembler/2002-02-19-TypeParsing.ll @@ -0,0 +1,3 @@ +; RUN: llvm-as %s -o /dev/null + +%Hosp = type { i32, i32, i32, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* }, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* }, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* }, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* } } diff --git a/test/Assembler/2002-03-08-NameCollision.ll b/test/Assembler/2002-03-08-NameCollision.ll new file mode 100644 index 0000000..b49789b --- /dev/null +++ b/test/Assembler/2002-03-08-NameCollision.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as %s -o /dev/null + +; Method arguments were being checked for collisions at the global scope before +; the method object was created by the parser. Because of this, false +; collisions could occur that would cause the following error message to be +; produced: +; +; Redefinition of value named 'X' in the 'int *' type plane! +; +; Fixed by delaying binding of variable names until _after_ the method symtab is +; created. +; +@X = global i32 4 ; <i32*> [#uses=0] + +declare i32 @xxx(i32*) diff --git a/test/Assembler/2002-03-08-NameCollision2.ll b/test/Assembler/2002-03-08-NameCollision2.ll new file mode 100644 index 0000000..1f7a4e1 --- /dev/null +++ b/test/Assembler/2002-03-08-NameCollision2.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as %s -o /dev/null + +; Another name collision problem. Here the problem was that if a forward +; declaration for a method was found, that this would cause spurious conflicts +; to be detected between locals and globals. +; +@Var = external global i32 ; <i32*> [#uses=0] + +define void @foo() { + %Var = alloca i32 ; <i32*> [#uses=0] + ret void +} diff --git a/test/Assembler/2002-04-04-PureVirtMethCall.ll b/test/Assembler/2002-04-04-PureVirtMethCall.ll new file mode 100644 index 0000000..29aed55 --- /dev/null +++ b/test/Assembler/2002-04-04-PureVirtMethCall.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as %s -o /dev/null + + type { { \2 *, \4 ** }, + { \2 *, \4 ** } + } + diff --git a/test/Assembler/2002-04-04-PureVirtMethCall2.ll b/test/Assembler/2002-04-04-PureVirtMethCall2.ll new file mode 100644 index 0000000..a096899 --- /dev/null +++ b/test/Assembler/2002-04-04-PureVirtMethCall2.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as %s -o /dev/null + +%t = type { { \2*, \2 }, + { \2*, \2 } + } diff --git a/test/Assembler/2002-04-05-TypeParsing.ll b/test/Assembler/2002-04-05-TypeParsing.ll new file mode 100644 index 0000000..f725944 --- /dev/null +++ b/test/Assembler/2002-04-05-TypeParsing.ll @@ -0,0 +1,3 @@ +; RUN: llvm-as %s -o /dev/null + + %Hosp = type { { \2*, { \2, %Hosp }* }, { \2*, { \2, %Hosp }* } } diff --git a/test/Assembler/2002-04-07-HexFloatConstants.ll b/test/Assembler/2002-04-07-HexFloatConstants.ll new file mode 100644 index 0000000..b0d7cc0 --- /dev/null +++ b/test/Assembler/2002-04-07-HexFloatConstants.ll @@ -0,0 +1,16 @@ +; This testcase checks to make sure that the assembler can handle floating +; point constants in IEEE hex format. This also checks that the disassembler, +; when presented with a FP constant that cannot be represented exactly in +; exponential form, outputs it correctly in hex format. This is a distillation +; of the bug that was causing the Olden Health benchmark to output incorrect +; results! +; +; RUN: opt -constprop -S > %t.1 < %s +; RUN: llvm-as < %s | llvm-dis | llvm-as | opt -constprop | \ +; RUN: llvm-dis > %t.2 +; RUN: diff %t.1 %t.2 + +define double @test() { + %tmp = fmul double 7.200000e+101, 0x427F4000 ; <double> [#uses=1] + ret double %tmp +} diff --git a/test/Assembler/2002-04-07-InfConstant.ll b/test/Assembler/2002-04-07-InfConstant.ll new file mode 100644 index 0000000..71837c9 --- /dev/null +++ b/test/Assembler/2002-04-07-InfConstant.ll @@ -0,0 +1,9 @@ +; The output formater prints out 1.0e100 as Inf! +; +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep 0x7FF0000000000000 + +define float @test() { + %tmp = fmul float 0x7FF0000000000000, 1.000000e+01 ; <float> [#uses=1] + ret float %tmp +} + diff --git a/test/Assembler/2002-04-29-NameBinding.ll b/test/Assembler/2002-04-29-NameBinding.ll new file mode 100644 index 0000000..7960c20 --- /dev/null +++ b/test/Assembler/2002-04-29-NameBinding.ll @@ -0,0 +1,18 @@ +; There should be NO references to the global v1. The local v1 should +; have all of the references! +; +; Check by running globaldce, which will remove the constant if there are +; no references to it! +; +; RUN: opt < %s -globaldce -S | \ +; RUN: not grep constant +; + +@v1 = internal constant i32 5 + +define i32 @createtask() { + %v1 = alloca i32 ;; Alloca should have one use! + %reg112 = load i32* %v1 ;; This load should not use the global! + ret i32 %reg112 +} + diff --git a/test/Assembler/2002-05-02-InvalidForwardRef.ll b/test/Assembler/2002-05-02-InvalidForwardRef.ll new file mode 100644 index 0000000..234545c --- /dev/null +++ b/test/Assembler/2002-05-02-InvalidForwardRef.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as %s -o /dev/null +; It looks like the assembler is not forward resolving the function declaraion +; correctly. + +define void @test() { + call void @foo( ) + ret void +} + +declare void @foo() diff --git a/test/Assembler/2002-05-02-ParseError.ll b/test/Assembler/2002-05-02-ParseError.ll new file mode 100644 index 0000000..5a9817c --- /dev/null +++ b/test/Assembler/2002-05-02-ParseError.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as %s -o /dev/null + +%T = type i32 * + +define %T @test() { + ret %T null +} diff --git a/test/Assembler/2002-07-08-HugePerformanceProblem.ll b/test/Assembler/2002-07-08-HugePerformanceProblem.ll new file mode 100644 index 0000000..52c90af --- /dev/null +++ b/test/Assembler/2002-07-08-HugePerformanceProblem.ll @@ -0,0 +1,67 @@ +; This file takes about 48 __MINUTES__ to assemble using as. This is WAY too +; long. The type resolution code needs to be sped up a lot. +; RUN: llvm-as %s -o /dev/null + %ALL_INTERSECTIONS_METHOD = type i32 (%OBJECT*, %RAY*, %ISTACK*)* + %BBOX = type { %BBOX_VECT, %BBOX_VECT } + %BBOX_TREE = type { i16, i16, %BBOX, %BBOX_TREE** } + %BBOX_VECT = type [3 x float] + %BLEND_MAP = type { i16, i16, i16, i32, %BLEND_MAP_ENTRY* } + %BLEND_MAP_ENTRY = type { float, i8, { %COLOUR, %PIGMENT*, %TNORMAL*, %TEXTURE*, %UV_VECT } } + %CAMERA = type { %VECTOR, %VECTOR, %VECTOR, %VECTOR, %VECTOR, %VECTOR, double, double, i32, double, double, i32, double, %TNORMAL* } + %COLOUR = type [5 x float] + %COPY_METHOD = type i8* (%OBJECT*)* + %COUNTER = type { i32, i32 } + %DENSITY_FILE = type { i32, %DENSITY_FILE_DATA* } + %DENSITY_FILE_DATA = type { i32, i8*, i32, i32, i32, i8*** } + %DESTROY_METHOD = type void (%OBJECT*)* + %FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 } + %FILE_HANDLE = type { i8*, i32, i32, i32, i32, i8*, %FILE*, i32, i32 (%FILE_HANDLE*, i8*, i32*, i32*, i32, i32)*, void (%FILE_HANDLE*, %COLOUR*, i32)*, i32 (%FILE_HANDLE*, %COLOUR*, i32*)*, void (%IMAGE*, i8*)*, void (%FILE_HANDLE*)* } + %FINISH = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, %BBOX_VECT, %BBOX_VECT } + %FOG = type { i32, double, double, double, %COLOUR, %VECTOR, %TURB*, float, %FOG* } + %FRAME = type { %CAMERA*, i32, i32, i32, %LIGHT_SOURCE*, %OBJECT*, double, double, %COLOUR, %COLOUR, %COLOUR, %IMEDIA*, %FOG*, %RAINBOW*, %SKYSPHERE* } + %FRAMESEQ = type { i32, double, i32, i32, double, i32, i32, double, i32, double, i32, double, i32, i32 } + %IMAGE = type { i32, i32, i32, i32, i32, i16, i16, %VECTOR, float, float, i32, i32, i16, %IMAGE_COLOUR*, { %IMAGE_LINE*, i8** } } + %IMAGE_COLOUR = type { i16, i16, i16, i16, i16 } + %IMAGE_LINE = type { i8*, i8*, i8*, i8* } + %IMEDIA = type { i32, i32, i32, i32, i32, double, double, i32, i32, i32, i32, %COLOUR, %COLOUR, %COLOUR, %COLOUR, double, double, double, double*, %PIGMENT*, %IMEDIA* } + %INSIDE_METHOD = type i32 (double*, %OBJECT*)* + %INTERIOR = type { i32, i32, float, float, float, float, float, %IMEDIA* } + %INTERSECTION = type { double, %VECTOR, %VECTOR, %OBJECT*, i32, i32, double, double, i8* } + %INVERT_METHOD = type void (%OBJECT*)* + %ISTACK = type { %ISTACK*, %INTERSECTION*, i32 } + %LIGHT_SOURCE = type { %METHODS*, i32, %OBJECT*, %TEXTURE*, %INTERIOR*, %OBJECT*, %OBJECT*, %BBOX, i32, %OBJECT*, %COLOUR, %VECTOR, %VECTOR, %VECTOR, %VECTOR, %VECTOR, double, double, double, double, double, %LIGHT_SOURCE*, i8, i8, i8, i8, i32, i32, i32, i32, i32, %COLOUR**, %OBJECT*, [6 x %PROJECT_TREE_NODE*] } + %MATRIX = type [4 x %VECTOR_4D] + %METHODS = type { %ALL_INTERSECTIONS_METHOD, %INSIDE_METHOD, %NORMAL_METHOD, %COPY_METHOD, %ROTATE_METHOD, %ROTATE_METHOD, %ROTATE_METHOD, %TRANSFORM_METHOD, %DESTROY_METHOD, %DESTROY_METHOD } + %NORMAL_METHOD = type void (double*, %OBJECT*, %INTERSECTION*)* + %OBJECT = type { %METHODS*, i32, %OBJECT*, %TEXTURE*, %INTERIOR*, %OBJECT*, %OBJECT*, %BBOX, i32 } + %Opts = type { i32, i32, i8, i8, i8, i32, [150 x i8], [150 x i8], [150 x i8], [150 x i8], [150 x i8], double, double, i32, i32, double, double, i32, [25 x i8*], i32, i32, i32, double, double, i32, i32, double, double, double, i32, i32, i32, i32, i32, %FRAMESEQ, double, i32, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [150 x i8], %SHELLDATA*, [150 x i8], i32, i32 } + %PIGMENT = type { i16, i16, i16, i32, float, float, float, %WARP*, %TPATTERN*, %BLEND_MAP*, { %DENSITY_FILE*, %IMAGE*, %VECTOR, float, i16, i16, i16, { float, %VECTOR }, %complex.float }, %COLOUR } + %PRIORITY_QUEUE = type { i32, i32, %QELEM* } + %PROJECT = type { i32, i32, i32, i32 } + %PROJECT_QUEUE = type { i32, i32, %PROJECT_TREE_NODE** } + %PROJECT_TREE_NODE = type { i16, %BBOX_TREE*, %PROJECT, i16, %PROJECT_TREE_NODE** } + %QELEM = type { double, %BBOX_TREE* } + %RAINBOW = type { double, double, double, double, double, double, double, %VECTOR, %VECTOR, %VECTOR, %PIGMENT*, %RAINBOW* } + %RAY = type { %VECTOR, %VECTOR, i32, [100 x %INTERIOR*] } + %RAYINFO = type { %VECTOR, %VECTOR, %VECTORI, %VECTORI } + %RGB = type [3 x float] + %ROTATE_METHOD = type void (%OBJECT*, double*, %TRANSFORM*)* + %SCALE_METHOD = type void (%OBJECT*, double*, %TRANSFORM*)* + %SHELLDATA = type { i32, i32, [250 x i8] } + %SKYSPHERE = type { i32, %PIGMENT**, %TRANSFORM* } + %SNGL_VECT = type [3 x float] + %TEXTURE = type { i16, i16, i16, i32, float, float, float, %WARP*, %TPATTERN*, %BLEND_MAP*, { %DENSITY_FILE*, %IMAGE*, %VECTOR, float, i16, i16, i16, { float, %VECTOR }, %complex.float }, %TEXTURE*, %PIGMENT*, %TNORMAL*, %FINISH*, %TEXTURE*, i32 } + %TNORMAL = type { i16, i16, i16, i32, float, float, float, %WARP*, %TPATTERN*, %BLEND_MAP*, { %DENSITY_FILE*, %IMAGE*, %VECTOR, float, i16, i16, i16, { float, %VECTOR }, %complex.float }, float } + %TPATTERN = type { i16, i16, i16, i32, float, float, float, %WARP*, %TPATTERN*, %BLEND_MAP*, { %DENSITY_FILE*, %IMAGE*, %VECTOR, float, i16, i16, i16, { float, %VECTOR }, %complex.float } } + %TRANSFORM = type { %MATRIX, %MATRIX } + %TRANSFORM_METHOD = type void (%OBJECT*, %TRANSFORM*)* + %TRANSLATE_METHOD = type void (%OBJECT*, double*, %TRANSFORM*)* + %TURB = type { i16, %WARP*, %VECTOR, i32, float, float } + %UV_VECT = type [2 x double] + %VECTOR = type [3 x double] + %VECTORI = type [3 x i32] + %VECTOR_4D = type [4 x double] + %WARP = type { i16, %WARP* } + %__FILE = type { i32, i8*, i8*, i8, i8, i32, i32, i32 } + %_h_val = type { [2 x i32], double } + %complex.float = type { float, float } diff --git a/test/Assembler/2002-07-14-InternalLossage.ll b/test/Assembler/2002-07-14-InternalLossage.ll new file mode 100644 index 0000000..f93f1c4 --- /dev/null +++ b/test/Assembler/2002-07-14-InternalLossage.ll @@ -0,0 +1,9 @@ +; Test to make sure that the 'internal' tag is not lost! +; +; RUN: llvm-as < %s | llvm-dis | grep internal + +declare void @foo() + +define internal void @foo() { + ret void +} diff --git a/test/Assembler/2002-07-14-OpaqueType.ll b/test/Assembler/2002-07-14-OpaqueType.ll new file mode 100644 index 0000000..662fb0f --- /dev/null +++ b/test/Assembler/2002-07-14-OpaqueType.ll @@ -0,0 +1,10 @@ +; Test that opaque types are preserved correctly +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +; + +%Ty = type opaque + +define %Ty* @func() { + ret %Ty* null +} + diff --git a/test/Assembler/2002-07-25-ParserAssertionFailure.ll b/test/Assembler/2002-07-25-ParserAssertionFailure.ll new file mode 100644 index 0000000..3c5c554 --- /dev/null +++ b/test/Assembler/2002-07-25-ParserAssertionFailure.ll @@ -0,0 +1,13 @@ +; Make sure we don't get an assertion failure, even though this is a parse +; error +; RUN: not llvm-as %s -o /dev/null |& grep {'@foo' defined with} + +%ty = type void (i32) + +declare %ty* @foo() + +define void @test() { + call %ty* @foo( ) ; <%ty*>:0 [#uses=0] + ret void +} + diff --git a/test/Assembler/2002-07-25-QuoteInString.ll b/test/Assembler/2002-07-25-QuoteInString.ll new file mode 100644 index 0000000..facc5bd --- /dev/null +++ b/test/Assembler/2002-07-25-QuoteInString.ll @@ -0,0 +1,5 @@ +; Test double quotes in strings work correctly! +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +; +@str = internal global [6 x i8] c"\22foo\22\00" ; <[6 x i8]*> [#uses=0] + diff --git a/test/Assembler/2002-07-25-ReturnPtrFunction.ll b/test/Assembler/2002-07-25-ReturnPtrFunction.ll new file mode 100644 index 0000000..515d105 --- /dev/null +++ b/test/Assembler/2002-07-25-ReturnPtrFunction.ll @@ -0,0 +1,15 @@ +; Test that returning a pointer to a function causes the disassembler to print +; the right thing. +; +; RUN: llvm-as < %s | llvm-dis | llvm-as + +%ty = type void (i32) + +declare %ty* @foo() + +define void @test() { + call %ty* ()* @foo( ) ; <%ty*>:1 [#uses=0] + ret void +} + + diff --git a/test/Assembler/2002-07-31-SlashInString.ll b/test/Assembler/2002-07-31-SlashInString.ll new file mode 100644 index 0000000..ff48258 --- /dev/null +++ b/test/Assembler/2002-07-31-SlashInString.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as + +; Make sure that \\ works in a string initializer +@Slashtest = internal global [8 x i8] c"\5Cbegin{\00" + diff --git a/test/Assembler/2002-08-15-CastAmbiguity.ll b/test/Assembler/2002-08-15-CastAmbiguity.ll new file mode 100644 index 0000000..c716524 --- /dev/null +++ b/test/Assembler/2002-08-15-CastAmbiguity.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as %s -o /dev/null + +define void @test(i32 %X) { + call void @test( i32 6 ) + ret void +} diff --git a/test/Assembler/2002-08-15-ConstantExprProblem.ll b/test/Assembler/2002-08-15-ConstantExprProblem.ll new file mode 100644 index 0000000..02b9ea9 --- /dev/null +++ b/test/Assembler/2002-08-15-ConstantExprProblem.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as %s -o /dev/null + +@.LC0 = internal global [12 x i8] c"hello world\00" ; <[12 x i8]*> [#uses=1] + +define i8* @test() { +; <label>:0 + br label %BB1 + +BB1: ; preds = %BB2, %0 + %ret = phi i8* [ getelementptr ([12 x i8]* @.LC0, i64 0, i64 0), %0 ], [ null, %BB2 ] ; <i8*> [#uses=1] + ret i8* %ret + +BB2: ; No predecessors! + br label %BB1 +} + diff --git a/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll b/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll new file mode 100644 index 0000000..2ba3f14 --- /dev/null +++ b/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as %s -o /dev/null + +@.LC0 = internal global [12 x i8] c"hello world\00" ; <[12 x i8]*> [#uses=1] + +define i8* @test() { + ret i8* getelementptr ([12 x i8]* @.LC0, i64 0, i64 0) +} + diff --git a/test/Assembler/2002-08-16-ConstExprInlined.ll b/test/Assembler/2002-08-16-ConstExprInlined.ll new file mode 100644 index 0000000..f233bac --- /dev/null +++ b/test/Assembler/2002-08-16-ConstExprInlined.ll @@ -0,0 +1,22 @@ +; In this testcase, the bytecode reader or writer is not correctly handling the +; ConstExpr reference. Disassembling this program assembled yields invalid +; assembly (because there are placeholders still around), which the assembler +; dies on. + +; There are two things that need to be fixed here. Obviously assembling and +; disassembling this would be good, but in addition to that, the bytecode +; reader should NEVER produce a program "successfully" with placeholders still +; around! +; +; RUN: llvm-as < %s | llvm-dis | llvm-as + +@.LC0 = internal global [4 x i8] c"foo\00" ; <[4 x i8]*> [#uses=1] +@X = global i8* null ; <i8**> [#uses=0] + +declare i32 @puts(i8*) + +define void @main() { +bb1: + %reg211 = call i32 @puts( i8* getelementptr ([4 x i8]* @.LC0, i64 0, i64 0) ) ; <i32> [#uses=0] + ret void +} diff --git a/test/Assembler/2002-08-19-BytecodeReader.ll b/test/Assembler/2002-08-19-BytecodeReader.ll new file mode 100644 index 0000000..e211014 --- /dev/null +++ b/test/Assembler/2002-08-19-BytecodeReader.ll @@ -0,0 +1,17 @@ +; Testcase that seems to break the bytecode reader. This comes from the +; "crafty" spec benchmark. +; +; RUN: opt < %s -instcombine | llvm-dis + +%CHESS_POSITION = type { i32, i32 } +@pawn_probes = external global i32 ; <i32*> [#uses=0] +@pawn_hash_mask = external global i32 ; <i32*> [#uses=0] +@search = external global %CHESS_POSITION ; <%CHESS_POSITION*> [#uses=2] + +define void @Evaluate() { + %reg1321 = getelementptr %CHESS_POSITION* @search, i64 0, i32 1 ; <i32*> [#uses=1] + %reg114 = load i32* %reg1321 ; <i32> [#uses=0] + %reg1801 = getelementptr %CHESS_POSITION* @search, i64 0, i32 0 ; <i32*> [#uses=1] + %reg182 = load i32* %reg1801 ; <i32> [#uses=0] + ret void +} diff --git a/test/Assembler/2002-08-22-DominanceProblem.ll b/test/Assembler/2002-08-22-DominanceProblem.ll new file mode 100644 index 0000000..0dc192d --- /dev/null +++ b/test/Assembler/2002-08-22-DominanceProblem.ll @@ -0,0 +1,17 @@ +; RUN: llvm-as %s -o /dev/null + +; Dominance relationships is not calculated correctly for unreachable blocks, +; which causes the verifier to barf on this input. + +define i32 @test(i1 %b) { +BB0: + ret i32 7 ; Loop is unreachable + +Loop: ; preds = %L2, %Loop + %B = phi i32 [ %B, %L2 ], [ %B, %Loop ] ;PHI has same value always. + br i1 %b, label %L2, label %Loop + +L2: ; preds = %Loop + br label %Loop +} + diff --git a/test/Assembler/2002-10-08-LargeArrayPerformance.ll b/test/Assembler/2002-10-08-LargeArrayPerformance.ll new file mode 100644 index 0000000..34a9932 --- /dev/null +++ b/test/Assembler/2002-10-08-LargeArrayPerformance.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as %s -o /dev/null +; This testcase comes from the following really simple c file: +;; int foo[30000] +;;; We should not be soo slow for such a simple case! + +@foo = global [30000 x i32] zeroinitializer ; <[30000 x i32]*> [#uses=0] + +declare void @__main() diff --git a/test/Assembler/2002-10-13-ConstantEncodingProblem.ll b/test/Assembler/2002-10-13-ConstantEncodingProblem.ll new file mode 100644 index 0000000..bf3a521 --- /dev/null +++ b/test/Assembler/2002-10-13-ConstantEncodingProblem.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis + +%Domain = type { %Domain**, %Domain* } +@D = global %Domain zeroinitializer ; <%Domain*> [#uses=0] + diff --git a/test/Assembler/2002-10-15-NameClash.ll b/test/Assembler/2002-10-15-NameClash.ll new file mode 100644 index 0000000..89346cb --- /dev/null +++ b/test/Assembler/2002-10-15-NameClash.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as %s -o /dev/null + +declare i32 @"ArrayRef"([100 x i32] * %Array) + +define i32 @"ArrayRef"([100 x i32] * %Array) { + ret i32 0 +} diff --git a/test/Assembler/2002-12-15-GlobalResolve.ll b/test/Assembler/2002-12-15-GlobalResolve.ll new file mode 100644 index 0000000..f9ad12e --- /dev/null +++ b/test/Assembler/2002-12-15-GlobalResolve.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as %s -o /dev/null + +@X = external global i32* +@X1 = external global %T* +@X2 = external global i32* + +%T = type i32 diff --git a/test/Assembler/2003-01-30-UnsignedString.ll b/test/Assembler/2003-01-30-UnsignedString.ll new file mode 100644 index 0000000..3c14d71 --- /dev/null +++ b/test/Assembler/2003-01-30-UnsignedString.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as %s -o /dev/null + +@spell_order = global [4 x i8] c"\FF\00\F7\00" + diff --git a/test/Assembler/2003-04-15-ConstantInitAssertion.ll b/test/Assembler/2003-04-15-ConstantInitAssertion.ll new file mode 100644 index 0000000..e012168 --- /dev/null +++ b/test/Assembler/2003-04-15-ConstantInitAssertion.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s >/dev/null |& grep {constant expression type mismatch} +; Test the case of a misformed constant initializer +; This should cause an assembler error, not an assertion failure! +constant { i32 } { float 1.0 } diff --git a/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll b/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll new file mode 100644 index 0000000..f1a5ed7 --- /dev/null +++ b/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as %s -o /dev/null +; There should be absolutely no problem with this testcase. + +define i32 @test(i32 %arg1, i32 %arg2) { + ret i32 ptrtoint (i32 (i32, i32)* @test to i32) +} + diff --git a/test/Assembler/2003-05-03-BytecodeReaderProblem.ll b/test/Assembler/2003-05-03-BytecodeReaderProblem.ll new file mode 100644 index 0000000..f4a6911 --- /dev/null +++ b/test/Assembler/2003-05-03-BytecodeReaderProblem.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llvm-dis + +define void @test() { + %tmp.123 = trunc i64 0 to i32 ; <i32> [#uses=0] + ret void +} diff --git a/test/Assembler/2003-05-12-MinIntProblem.ll b/test/Assembler/2003-05-12-MinIntProblem.ll new file mode 100644 index 0000000..ebe1690 --- /dev/null +++ b/test/Assembler/2003-05-12-MinIntProblem.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis | grep -- -2147483648 + +define i32 @foo() { + ret i32 -2147483648 +} diff --git a/test/Assembler/2003-05-15-AssemblerProblem.ll b/test/Assembler/2003-05-15-AssemblerProblem.ll new file mode 100644 index 0000000..146ce65 --- /dev/null +++ b/test/Assembler/2003-05-15-AssemblerProblem.ll @@ -0,0 +1,14 @@ +; This bug was caused by two CPR's existing for the same global variable, +; colliding in the Module level CPR map. +; RUN: llvm-as %s -o /dev/null + +define void @test() { + call void (...)* bitcast (void (i16*, i32)* @AddString to void (...)*)( i16* null, i32 0 ) + ret void +} + +define void @AddString(i16* %tmp.124, i32 %tmp.127) { + call void (...)* bitcast (void (i16*, i32)* @AddString to void (...)*)( i16* %tmp.124, i32 %tmp.127 ) + ret void +} + diff --git a/test/Assembler/2003-05-15-SwitchBug.ll b/test/Assembler/2003-05-15-SwitchBug.ll new file mode 100644 index 0000000..3768d9c --- /dev/null +++ b/test/Assembler/2003-05-15-SwitchBug.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as %s -o /dev/null + +; Check minimal switch statement + +define void @test(i32 %X) { + switch i32 %X, label %dest [ + ] + +dest: ; preds = %0 + ret void +} diff --git a/test/Assembler/2003-05-21-ConstantShiftExpr.ll b/test/Assembler/2003-05-21-ConstantShiftExpr.ll new file mode 100644 index 0000000..40b9651 --- /dev/null +++ b/test/Assembler/2003-05-21-ConstantShiftExpr.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as %s -o /dev/null +; Test that shift instructions can be used in constant expressions. + +global i32 3670016 diff --git a/test/Assembler/2003-05-21-EmptyStructTest.ll b/test/Assembler/2003-05-21-EmptyStructTest.ll new file mode 100644 index 0000000..26e83d9 --- /dev/null +++ b/test/Assembler/2003-05-21-EmptyStructTest.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as %s -o /dev/null + +; The old C front-end never generated empty structures, now the new one +; can. For some reason we never handled them in the parser. Weird. + +@X = global { } zeroinitializer diff --git a/test/Assembler/2003-05-21-MalformedShiftCrash.ll b/test/Assembler/2003-05-21-MalformedShiftCrash.ll new file mode 100644 index 0000000..c661f7c --- /dev/null +++ b/test/Assembler/2003-05-21-MalformedShiftCrash.ll @@ -0,0 +1,4 @@ +; Found by inspection of the code +; RUN: not llvm-as < %s > /dev/null |& grep {constexpr requires integer or integer vector operands} + +global i32 ashr (float 1.0, float 2.0) diff --git a/test/Assembler/2003-05-21-MalformedStructCrash.ll b/test/Assembler/2003-05-21-MalformedStructCrash.ll new file mode 100644 index 0000000..1efb577 --- /dev/null +++ b/test/Assembler/2003-05-21-MalformedStructCrash.ll @@ -0,0 +1,4 @@ +; Found by inspection of the code +; RUN: not llvm-as < %s > /dev/null |& grep {constant expression type mismatch} + +global {} { i32 7, float 1.0, i32 7, i32 8 } diff --git a/test/Assembler/2003-06-17-InvokeDisassemble.ll b/test/Assembler/2003-06-17-InvokeDisassemble.ll new file mode 100644 index 0000000..922a996 --- /dev/null +++ b/test/Assembler/2003-06-17-InvokeDisassemble.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llvm-dis + +define void @test() { + invoke void @test( ) + to label %Next unwind label %Next + +Next: ; preds = %0, %0 + ret void +} diff --git a/test/Assembler/2003-06-30-RecursiveTypeProblem.ll b/test/Assembler/2003-06-30-RecursiveTypeProblem.ll new file mode 100644 index 0000000..5db3114 --- /dev/null +++ b/test/Assembler/2003-06-30-RecursiveTypeProblem.ll @@ -0,0 +1,3 @@ +; RUN: llvm-as %s -o /dev/null + +%MidFnTy = type void (%MidFnTy*) diff --git a/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll b/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll new file mode 100644 index 0000000..50cdeed --- /dev/null +++ b/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll @@ -0,0 +1,16 @@ +; RUN: opt < %s -instcombine -simplifycfg -S | not grep br + +@.str_1 = internal constant [6 x i8] c"_Bool\00" ; <[6 x i8]*> [#uses=2] + +define i32 @test() { + %tmp.54 = load i8* getelementptr ([6 x i8]* @.str_1, i64 0, i64 1) ; <i8> [#uses=1] + %tmp.55 = icmp ne i8 %tmp.54, 66 ; <i1> [#uses=1] + br i1 %tmp.55, label %then.7, label %endif.7 + +then.7: ; preds = %then.7, %0 + br label %then.7 + +endif.7: ; preds = %0 + ret i32 0 +} + diff --git a/test/Assembler/2003-08-21-ConstantExprCast-Fold.ll b/test/Assembler/2003-08-21-ConstantExprCast-Fold.ll new file mode 100644 index 0000000..b76f774 --- /dev/null +++ b/test/Assembler/2003-08-21-ConstantExprCast-Fold.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as < %s | llvm-dis | not grep getelementptr + +@A = external global { float } ; <{ float }*> [#uses=2] +global i32* bitcast ({ float }* @A to i32*) ; <i32**>:0 [#uses=0] diff --git a/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll b/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll new file mode 100644 index 0000000..5fec05d --- /dev/null +++ b/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as %s -o /dev/null + +%T = type i32 +@X = global i32* null ; <i32**> [#uses=0] +@Y = global i32* null ; <i32**> [#uses=0] + diff --git a/test/Assembler/2003-11-05-ConstantExprShift.ll b/test/Assembler/2003-11-05-ConstantExprShift.ll new file mode 100644 index 0000000..86b093e --- /dev/null +++ b/test/Assembler/2003-11-05-ConstantExprShift.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis + +define i32 @test() { + ret i32 ashr (i32 ptrtoint (i32 ()* @test to i32), i32 2) +} diff --git a/test/Assembler/2003-11-11-ImplicitRename.ll b/test/Assembler/2003-11-11-ImplicitRename.ll new file mode 100644 index 0000000..7bfd3c1 --- /dev/null +++ b/test/Assembler/2003-11-11-ImplicitRename.ll @@ -0,0 +1,8 @@ +; RUN: not llvm-as < %s >& /dev/null + +void %test() { + %X = add int 0, 1 + %X = add int 1, 2 + ret void +} + diff --git a/test/Assembler/2003-11-12-ConstantExprCast.ll b/test/Assembler/2003-11-12-ConstantExprCast.ll new file mode 100644 index 0000000..149fef2 --- /dev/null +++ b/test/Assembler/2003-11-12-ConstantExprCast.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llvm-dis | not grep { bitcast (} + +@.Base64_1 = external constant [4 x i8] ; <[4 x i8]*> [#uses=1] + +define i8 @test(i8 %Y) { + %X = bitcast i8 %Y to i8 ; <i8> [#uses=1] + %tmp.13 = add i8 %X, sub (i8 0, i8 ptrtoint ([4 x i8]* @.Base64_1 to i8)) ; <i8> [#uses=1] + ret i8 %tmp.13 +} + diff --git a/test/Assembler/2003-11-24-SymbolTableCrash.ll b/test/Assembler/2003-11-24-SymbolTableCrash.ll new file mode 100644 index 0000000..041b0d9 --- /dev/null +++ b/test/Assembler/2003-11-24-SymbolTableCrash.ll @@ -0,0 +1,10 @@ +; RUN: not llvm-as < %s |& grep {multiple definition} + +define void @test() { + %tmp.1 = add i32 0, 1 + br label %return +return: + %tmp.1 = add i32 0, 1 + ret void +} + diff --git a/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll b/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll new file mode 100644 index 0000000..93f9a70 --- /dev/null +++ b/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll @@ -0,0 +1,55 @@ +; RUN: not llvm-as %s -o /dev/null |& grep {use of undefined type named 'struct.D_Scope'} +; END. + +@d_reduction_0_dparser_gram = global { + i32 (i8*, i8**, i32, i32, { + %struct.Grammar*, void (\4, %struct.d_loc_t*, i8**)*, %struct.D_Scope*, + void (\4)*, { i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }* (\4, i32, { i32, %struct.d_loc_t, i8*, i8*, + %struct.D_Scope*, void (\9, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }**)*, + void ({ i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, + %struct.Grammar*, %struct.ParseNode_User }*)*, + %struct.d_loc_t, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, + i32 }*)*, + i32 (i8*, i8**, i32, i32, { %struct.Grammar*, + void (\4, %struct.d_loc_t*, i8**)*, %struct.D_Scope*, void (\4)*, { + i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }* (\4, i32, { i32, %struct.d_loc_t, i8*, i8*, + %struct.D_Scope*, void (\9, %struct.d_loc_t*, i8**)*, + %struct.Grammar*, %struct.ParseNode_User }**)*, + void ({ i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }*)*, %struct.d_loc_t, i32, i32, i32, i32, + i32, i32, i32, i32, i32, i32, i32, i32 }*)** } + + { i32 (i8*, i8**, i32, i32, { + %struct.Grammar*, void (\4, %struct.d_loc_t*, i8**)*, + %struct.D_Scope*, void (\4)*, { + i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User + }* (\4, i32, { i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\9, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }**)*, + void ({ i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }*)*, + %struct.d_loc_t, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, + i32, i32 }*)* null, + i32 (i8*, i8**, i32, i32, { + %struct.Grammar*, void (\4, %struct.d_loc_t*, i8**)*, + %struct.D_Scope*, void (\4)*, { i32, %struct.d_loc_t, i8*, i8*, + %struct.D_Scope*, void (\8, %struct.d_loc_t*, i8**)*, + %struct.Grammar*, %struct.ParseNode_User }* (\4, i32, { i32, + %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\9, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }**)*, + void ({ i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, + void (\8, %struct.d_loc_t*, i8**)*, %struct.Grammar*, + %struct.ParseNode_User }*)*, %struct.d_loc_t, i32, i32, i32, + i32, i32, i32, i32, i32, i32, i32, i32, i32 }*)** null + } diff --git a/test/Assembler/2004-01-11-getelementptrfolding.ll b/test/Assembler/2004-01-11-getelementptrfolding.ll new file mode 100644 index 0000000..c22aede --- /dev/null +++ b/test/Assembler/2004-01-11-getelementptrfolding.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llvm-dis | \ +; RUN: not grep {getelementptr.*getelementptr} + +%struct.TTriangleItem = type { i8*, i8*, [3 x %struct.TUVVertex] } +%struct.TUVVertex = type { i16, i16, i16, i16 } +@data_triangleItems = internal constant [2908 x %struct.TTriangleItem] zeroinitializer; <[2908 x %struct.TTriangleItem]*> [#uses=2] + +define void @foo() { + store i16 0, i16* getelementptr ([2908 x %struct.TTriangleItem]* @data_triangleItems, i64 0, i64 0, i32 2, i64 0, i32 0) + ret void +} + diff --git a/test/Assembler/2004-01-20-MaxLongLong.ll b/test/Assembler/2004-01-20-MaxLongLong.ll new file mode 100644 index 0000000..8af5332 --- /dev/null +++ b/test/Assembler/2004-01-20-MaxLongLong.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as < %s | llvm-dis | grep 9223372036854775808 + +global i64 -9223372036854775808 + diff --git a/test/Assembler/2004-02-01-NegativeZero.ll b/test/Assembler/2004-02-01-NegativeZero.ll new file mode 100644 index 0000000..b28930f --- /dev/null +++ b/test/Assembler/2004-02-01-NegativeZero.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis | grep -- -0.0 + +global double 0x8000000000000000 +global float -0.0 + diff --git a/test/Assembler/2004-02-27-SelfUseAssertError.ll b/test/Assembler/2004-02-27-SelfUseAssertError.ll new file mode 100644 index 0000000..7052eac --- /dev/null +++ b/test/Assembler/2004-02-27-SelfUseAssertError.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as %s -o /dev/null + +; %inc2 uses it's own value, but that's ok, as it's unreachable! + +define void @test() { +entry: + ret void + +no_exit.2: ; preds = %endif.6 + %tmp.103 = fcmp olt double 0.000000e+00, 0.000000e+00 ; <i1> [#uses=1] + br i1 %tmp.103, label %endif.6, label %else.0 + +else.0: ; preds = %no_exit.2 + store i16 0, i16* null + br label %endif.6 + +endif.6: ; preds = %else.0, %no_exit.2 + %inc.2 = add i32 %inc.2, 1 ; <i32> [#uses=2] + %tmp.96 = icmp slt i32 %inc.2, 0 ; <i1> [#uses=1] + br i1 %tmp.96, label %no_exit.2, label %UnifiedReturnBlock1 + +UnifiedReturnBlock1: ; preds = %endif.6 + ret void +} + diff --git a/test/Assembler/2004-03-07-FunctionAddressAlignment.ll b/test/Assembler/2004-03-07-FunctionAddressAlignment.ll new file mode 100644 index 0000000..e3bf0bb --- /dev/null +++ b/test/Assembler/2004-03-07-FunctionAddressAlignment.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llvm-dis | not grep ptrtoint +; All of these should be eliminable + + +define i32 @foo() { + ret i32 and (i32 ptrtoint (i32()* @foo to i32), i32 1) +} + +define i32 @foo2() { + ret i32 and (i32 1, i32 ptrtoint (i32()* @foo2 to i32)) +} + +define i1 @foo3() { + ret i1 icmp ne (i1()* @foo3, i1()* null) +} diff --git a/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll b/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll new file mode 100644 index 0000000..775b755 --- /dev/null +++ b/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll @@ -0,0 +1,3 @@ +; RUN: not llvm-as %s |& grep {found end of file when expecting more instructions} + +define void @foo() { diff --git a/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll b/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll new file mode 100644 index 0000000..ab46f88 --- /dev/null +++ b/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as %s -o /dev/null + +define i32* @t1({ float, i32 }* %X) { + %W = getelementptr { float, i32 }* %X, i32 20, i32 1 ; <i32*> [#uses=0] + %X.upgrd.1 = getelementptr { float, i32 }* %X, i64 20, i32 1 ; <i32*> [#uses=0] + %Y = getelementptr { float, i32 }* %X, i64 20, i32 1 ; <i32*> [#uses=1] + %Z = getelementptr { float, i32 }* %X, i64 20, i32 1 ; <i32*> [#uses=0] + ret i32* %Y +} + diff --git a/test/Assembler/2004-06-07-VerifierBug.ll b/test/Assembler/2004-06-07-VerifierBug.ll new file mode 100644 index 0000000..07d2383 --- /dev/null +++ b/test/Assembler/2004-06-07-VerifierBug.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s > /dev/null + +define void @t() { +entry: + ret void + +loop: ; preds = %loop + %tmp.4.i9 = getelementptr i32* null, i32 %tmp.5.i10 ; <i32*> [#uses=1] + %tmp.5.i10 = load i32* %tmp.4.i9 ; <i32> [#uses=1] + br label %loop +} diff --git a/test/Assembler/2004-10-22-BCWriterUndefBug.ll b/test/Assembler/2004-10-22-BCWriterUndefBug.ll new file mode 100644 index 0000000..694b80b --- /dev/null +++ b/test/Assembler/2004-10-22-BCWriterUndefBug.ll @@ -0,0 +1,5 @@ +;; The bytecode writer was trying to treat undef values as ConstantArray's when +;; they looked like strings. +;; RUN: llvm-as %s -o /dev/null +@G = internal global [8 x i8] undef + diff --git a/test/Assembler/2004-11-28-InvalidTypeCrash.ll b/test/Assembler/2004-11-28-InvalidTypeCrash.ll new file mode 100644 index 0000000..f9b453b --- /dev/null +++ b/test/Assembler/2004-11-28-InvalidTypeCrash.ll @@ -0,0 +1,4 @@ +; Test for PR463. This program is erroneous, but should not crash llvm-as. +; RUN: not llvm-as %s -o /dev/null |& grep {invalid type for null constant} + +@.FOO = internal global %struct.none zeroinitializer diff --git a/test/Assembler/2005-01-03-FPConstantDisassembly.ll b/test/Assembler/2005-01-03-FPConstantDisassembly.ll new file mode 100644 index 0000000..aaa776f --- /dev/null +++ b/test/Assembler/2005-01-03-FPConstantDisassembly.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llvm-dis | grep 1.0 + +define double @test() { + ret double 1.0 ;; This should not require hex notation +} + diff --git a/test/Assembler/2005-01-31-CallingAggregateFunction.ll b/test/Assembler/2005-01-31-CallingAggregateFunction.ll new file mode 100644 index 0000000..ce769a2 --- /dev/null +++ b/test/Assembler/2005-01-31-CallingAggregateFunction.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as %s -o /dev/null + +define void @test() { + call {i32} @foo() + ret void +} + +declare {i32 } @foo() diff --git a/test/Assembler/2005-02-09-AsmWriterStoreBug.ll b/test/Assembler/2005-02-09-AsmWriterStoreBug.ll new file mode 100644 index 0000000..4ec1796 --- /dev/null +++ b/test/Assembler/2005-02-09-AsmWriterStoreBug.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as + +; Ensure that the asm writer emits types before both operands of the +; store, even though they can be the same. + +%RecTy = type %RecTy* + +define void @foo() { + %A = malloc %RecTy ; <%RecTy> [#uses=1] + %B = malloc %RecTy ; <%RecTy> [#uses=1] + store %RecTy %B, %RecTy %A + ret void +} + diff --git a/test/Assembler/2005-05-05-OpaqueUndefValues.ll b/test/Assembler/2005-05-05-OpaqueUndefValues.ll new file mode 100644 index 0000000..8cd1419 --- /dev/null +++ b/test/Assembler/2005-05-05-OpaqueUndefValues.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as > /dev/null + +%t = type opaque +@x = global %t undef diff --git a/test/Assembler/2005-12-21-ZeroInitVector.ll b/test/Assembler/2005-12-21-ZeroInitVector.ll new file mode 100644 index 0000000..d3a692c --- /dev/null +++ b/test/Assembler/2005-12-21-ZeroInitVector.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s > /dev/null + +define <4 x i32> @foo() { + ret <4 x i32> zeroinitializer +} + diff --git a/test/Assembler/2006-05-26-VarargsCallEncode.ll b/test/Assembler/2006-05-26-VarargsCallEncode.ll new file mode 100644 index 0000000..6dc60c3 --- /dev/null +++ b/test/Assembler/2006-05-26-VarargsCallEncode.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llvm-dis | grep {tail call void.*sret null} + +declare void @foo({ }* sret , ...) + +define void @bar() { + tail call void ({ }* sret , ...)* @foo( { }* null sret , i32 0 ) + ret void +} diff --git a/test/Assembler/2006-09-28-CrashOnInvalid.ll b/test/Assembler/2006-09-28-CrashOnInvalid.ll new file mode 100644 index 0000000..a203c6a --- /dev/null +++ b/test/Assembler/2006-09-28-CrashOnInvalid.ll @@ -0,0 +1,8 @@ +; Test for PR902. This program is erroneous, but should not crash llvm-as. +; This tests that a simple error is caught and processed correctly. +; RUN: not llvm-as < %s >/dev/null |& grep {floating point constant invalid for type} + +define void @test() { + add i32 1, 2.0 + ret void +} diff --git a/test/Assembler/2006-12-09-Cast-To-Bool.ll b/test/Assembler/2006-12-09-Cast-To-Bool.ll new file mode 100644 index 0000000..a70262c --- /dev/null +++ b/test/Assembler/2006-12-09-Cast-To-Bool.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llvm-dis | grep bitcast + +define i1 @main(i32 %X) { + %res = bitcast i1 true to i1 + ret i1 %res +} diff --git a/test/Assembler/2007-01-02-Undefined-Arg-Type.ll b/test/Assembler/2007-01-02-Undefined-Arg-Type.ll new file mode 100644 index 0000000..a39de1c --- /dev/null +++ b/test/Assembler/2007-01-02-Undefined-Arg-Type.ll @@ -0,0 +1,9 @@ +; The assembler should catch an undefined argument type . +; RUN: not llvm-as %s -o /dev/null |& grep {use of undefined type named 'typedef.bc_struct'} + +; %typedef.bc_struct = type opaque + + +define i1 @someFunc(i32* %tmp.71.reload, %typedef.bc_struct* %n1) { + ret i1 true +} diff --git a/test/Assembler/2007-01-05-Cmp-ConstExpr.ll b/test/Assembler/2007-01-05-Cmp-ConstExpr.ll new file mode 100644 index 0000000..e3f67ba --- /dev/null +++ b/test/Assembler/2007-01-05-Cmp-ConstExpr.ll @@ -0,0 +1,18 @@ +; Test Case for PR1080 +; RUN: llvm-as %s -o /dev/null + +@str = internal constant [4 x i8] c"-ga\00" ; <[4 x i8]*> [#uses=2] + +define i32 @main(i32 %argc, i8** %argv) { +entry: + %tmp65 = getelementptr i8** %argv, i32 1 ; <i8**> [#uses=1] + %tmp66 = load i8** %tmp65 ; <i8*> [#uses=0] + br i1 icmp ne (i32 sub (i32 ptrtoint (i8* getelementptr ([4 x i8]* @str, i32 0, i64 1) to i32), i32 ptrtoint ([4 x i8]* @str to i32)), i32 1), label %exit_1, label %exit_2 + +exit_1: ; preds = %entry + ret i32 0 + +exit_2: ; preds = %entry + ret i32 1 +} + diff --git a/test/Assembler/2007-01-16-CrashOnBadCast.ll b/test/Assembler/2007-01-16-CrashOnBadCast.ll new file mode 100644 index 0000000..81f5458 --- /dev/null +++ b/test/Assembler/2007-01-16-CrashOnBadCast.ll @@ -0,0 +1,7 @@ +; PR1117 +; RUN: not llvm-as %s -o /dev/null |& grep {invalid cast opcode for cast from} + +define i8* @nada(i64 %X) { + %result = trunc i64 %X to i8* + ret i8* %result +} diff --git a/test/Assembler/2007-01-16-CrashOnBadCast2.ll b/test/Assembler/2007-01-16-CrashOnBadCast2.ll new file mode 100644 index 0000000..c05c609 --- /dev/null +++ b/test/Assembler/2007-01-16-CrashOnBadCast2.ll @@ -0,0 +1,4 @@ +; PR1117 +; RUN: not llvm-as %s -o /dev/null |& grep {invalid cast opcode for cast from} + +@X = constant i8* trunc (i64 0 to i8*) diff --git a/test/Assembler/2007-03-18-InvalidNumberedVar.ll b/test/Assembler/2007-03-18-InvalidNumberedVar.ll new file mode 100644 index 0000000..b2193b1 --- /dev/null +++ b/test/Assembler/2007-03-18-InvalidNumberedVar.ll @@ -0,0 +1,9 @@ +; PR 1258 +; RUN: not llvm-as < %s >/dev/null |& grep {'%0' defined with type 'i1'} + +define i32 @test1(i32 %a, i32 %b) { +entry: + icmp eq i32 %b, %a ; <i1>:0 [#uses=1] + zext i1 %0 to i32 ; <i32>:0 [#uses=1] + ret i32 %0 ; Invalid Type for %0 +} diff --git a/test/Assembler/2007-03-19-NegValue.ll b/test/Assembler/2007-03-19-NegValue.ll new file mode 100644 index 0000000..e90cf35 --- /dev/null +++ b/test/Assembler/2007-03-19-NegValue.ll @@ -0,0 +1,7 @@ +; Test whether negative values > 64 bits retain their negativeness. +; RUN: llvm-as < %s | llvm-dis | grep {add i65.*, -1} + +define i65 @testConsts(i65 %N) { + %a = add i65 %N, -1 + ret i65 %a +} diff --git a/test/Assembler/2007-04-20-AlignedLoad.ll b/test/Assembler/2007-04-20-AlignedLoad.ll new file mode 100644 index 0000000..f0217ae --- /dev/null +++ b/test/Assembler/2007-04-20-AlignedLoad.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llvm-dis | grep {align 1024} + +define i32 @test(i32* %arg) { +entry: + %tmp2 = load i32* %arg, align 1024 ; <i32> [#uses=1] + ret i32 %tmp2 +} diff --git a/test/Assembler/2007-04-20-AlignedStore.ll b/test/Assembler/2007-04-20-AlignedStore.ll new file mode 100644 index 0000000..1b08c48 --- /dev/null +++ b/test/Assembler/2007-04-20-AlignedStore.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llvm-dis | grep {align 1024} + +define void @test(i32* %arg) { +entry: + store i32 0, i32* %arg, align 1024 + ret void +} diff --git a/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll b/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll new file mode 100644 index 0000000..c26d9eb --- /dev/null +++ b/test/Assembler/2007-04-25-AssemblerFoldExternWeak.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llvm-dis | grep {icmp.*test_weak.*null} +; PR1358 +@G = global i1 icmp ne (i32 (...)* @test_weak, i32 (...)* null) + +declare extern_weak i32 @test_weak(...) + diff --git a/test/Assembler/2007-05-21-Escape.ll b/test/Assembler/2007-05-21-Escape.ll new file mode 100644 index 0000000..0868133 --- /dev/null +++ b/test/Assembler/2007-05-21-Escape.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" +target triple = "x86_64-apple-darwin8" + %struct.bar = type { i32 } + %struct.foo = type { i32 } + +define i32 @"Func64"(%struct.bar* %F) { +entry: + ret i32 1 +} + +define i32 @Func64(%struct.bar* %B) { +entry: + ret i32 0 +} + +define i32 @test() { +entry: + %tmp = tail call i32 @"Func64"( %struct.bar* null ) ; <i32> [#uses=0] + %tmp1 = tail call i32 @Func64( %struct.bar* null ) ; <i32> [#uses=0] + ret i32 undef +} diff --git a/test/Assembler/2007-07-19-ParamAttrAmbiguity.ll b/test/Assembler/2007-07-19-ParamAttrAmbiguity.ll new file mode 100644 index 0000000..9c7daa8 --- /dev/null +++ b/test/Assembler/2007-07-19-ParamAttrAmbiguity.ll @@ -0,0 +1,9 @@ +; PR1553 +; RUN: llvm-as < %s > /dev/null +define void @bar() { + %t = call i8 @foo( i8 10 ) + zext i8 %t to i32 + ret void +} + +declare i8 @foo(i8) diff --git a/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll b/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll new file mode 100644 index 0000000..ea2db44 --- /dev/null +++ b/test/Assembler/2007-07-30-AutoUpgradeZextSext.ll @@ -0,0 +1,12 @@ +; Test that upgrading zext/sext attributes to zeroext and signext +; works correctly. +; PR1553 +; RUN: llvm-as < %s > /dev/null + +define i32 @bar() { + %t = call i8 @foo( i8 10 sext ) zext + %x = zext i8 %t to i32 + ret i32 %x +} + +declare i8 @foo(i8 signext ) zeroext diff --git a/test/Assembler/2007-08-06-AliasInvalid.ll b/test/Assembler/2007-08-06-AliasInvalid.ll new file mode 100644 index 0000000..940959824 --- /dev/null +++ b/test/Assembler/2007-08-06-AliasInvalid.ll @@ -0,0 +1,9 @@ +; RUN: not llvm-as < %s > /dev/null |& grep {expected top-level entity} +; PR1577 + +@anInt = global i32 1 +alias i32 @anAlias + +define i32 @main() { + ret i32 0 +} diff --git a/test/Assembler/2007-09-10-AliasFwdRef.ll b/test/Assembler/2007-09-10-AliasFwdRef.ll new file mode 100644 index 0000000..b21491b --- /dev/null +++ b/test/Assembler/2007-09-10-AliasFwdRef.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llvm-dis +; PR1645 + +@__gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) +@__gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel + + + +declare extern_weak i32 @pthread_cancel(i32) diff --git a/test/Assembler/2007-09-29-GC.ll b/test/Assembler/2007-09-29-GC.ll new file mode 100644 index 0000000..789a0fe --- /dev/null +++ b/test/Assembler/2007-09-29-GC.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llvm-dis | grep {@f.*gc.*shadowstack} +; RUN: llvm-as < %s | llvm-dis | grep {@g.*gc.*java} + +define void @f() gc "shadowstack" { +entry: + ret void +} + +define void @g() gc "java" { +entry: + ret void +} diff --git a/test/Assembler/2007-11-26-AttributeOverload.ll b/test/Assembler/2007-11-26-AttributeOverload.ll new file mode 100644 index 0000000..aebc2e8 --- /dev/null +++ b/test/Assembler/2007-11-26-AttributeOverload.ll @@ -0,0 +1,4 @@ +; RUN: not llvm-as < %s >& /dev/null + +declare i32 @atoi(i8*) nounwind readonly +declare i32 @atoi(i8*) diff --git a/test/Assembler/2007-11-27-AutoUpgradeAttributes.ll b/test/Assembler/2007-11-27-AutoUpgradeAttributes.ll new file mode 100644 index 0000000..ee260ea --- /dev/null +++ b/test/Assembler/2007-11-27-AutoUpgradeAttributes.ll @@ -0,0 +1,3 @@ +; RUN: llvm-as < %s + +@FP = weak global i8 (...) signext * null diff --git a/test/Assembler/2007-12-11-AddressSpaces.ll b/test/Assembler/2007-12-11-AddressSpaces.ll new file mode 100644 index 0000000..0eb4a79 --- /dev/null +++ b/test/Assembler/2007-12-11-AddressSpaces.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(33)} | count 7 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(42)} | count 2 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(66)} | count 2 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(11)} | count 6 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(22)} | count 5 + + %struct.mystruct = type { i32, i32 addrspace(33)*, i32, i32 addrspace(33)* } +@input = weak addrspace(42) global %struct.mystruct zeroinitializer ; <%struct.mystruct addrspace(42)*> [#uses=1] +@output = addrspace(66) global %struct.mystruct zeroinitializer ; <%struct.mystruct addrspace(66)*> [#uses=1] +@y = external addrspace(33) global i32 addrspace(11)* addrspace(22)* ; <i32 addrspace(11)* addrspace(22)* addrspace(33)*> [#uses=1] + +define void @foo() { +entry: + %tmp1 = load i32 addrspace(33)* addrspace(42)* getelementptr (%struct.mystruct addrspace(42)* @input, i32 0, i32 3), align 4 ; <i32 addrspace(33)*> [#uses=1] + store i32 addrspace(33)* %tmp1, i32 addrspace(33)* addrspace(66)* getelementptr (%struct.mystruct addrspace(66)* @output, i32 0, i32 1), align 4 + ret void +} + +define i32 addrspace(11)* @bar(i32 addrspace(11)* addrspace(22)* addrspace(33)* %x) { +entry: + %tmp1 = load i32 addrspace(11)* addrspace(22)* addrspace(33)* @y, align 4 ; <i32 addrspace(11)* addrspace(22)*> [#uses=2] + store i32 addrspace(11)* addrspace(22)* %tmp1, i32 addrspace(11)* addrspace(22)* addrspace(33)* %x, align 4 + %tmp5 = load i32 addrspace(11)* addrspace(22)* %tmp1, align 4 ; <i32 addrspace(11)*> [#uses=1] + ret i32 addrspace(11)* %tmp5 +} diff --git a/test/Assembler/2008-01-11-VarargAttrs.ll b/test/Assembler/2008-01-11-VarargAttrs.ll new file mode 100644 index 0000000..c0aedc8 --- /dev/null +++ b/test/Assembler/2008-01-11-VarargAttrs.ll @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | llvm-dis | grep byval + + %struct = type { } + +declare void @foo(...) + +define void @bar() { + call void (...)* @foo(%struct* byval null ) + ret void +} diff --git a/test/Assembler/2008-02-18-IntPointerCrash.ll b/test/Assembler/2008-02-18-IntPointerCrash.ll new file mode 100644 index 0000000..5a661ad --- /dev/null +++ b/test/Assembler/2008-02-18-IntPointerCrash.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as %s |& grep {integer constant must have integer type} +; PR2060 + +define i8* @foo() { + ret i8* 0 +} diff --git a/test/Assembler/2008-02-20-MultipleReturnValue.ll b/test/Assembler/2008-02-20-MultipleReturnValue.ll new file mode 100644 index 0000000..32c893a --- /dev/null +++ b/test/Assembler/2008-02-20-MultipleReturnValue.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -verify -S | llvm-as -disable-output + +define {i32, i8} @foo(i32 %p) { + ret i32 1, i8 2 +} + +define i8 @f2(i32 %p) { + %c = call {i32, i8} @foo(i32 %p) + %d = getresult {i32, i8} %c, 1 + %e = add i8 %d, 1 + ret i8 %e +} + +define i32 @f3(i32 %p) { + %c = invoke {i32, i8} @foo(i32 %p) + to label %L unwind label %L2 + L: + %d = getresult {i32, i8} %c, 0 + ret i32 %d + L2: + ret i32 0 +} diff --git a/test/Assembler/2008-07-10-APInt.ll b/test/Assembler/2008-07-10-APInt.ll new file mode 100644 index 0000000..99347e9 --- /dev/null +++ b/test/Assembler/2008-07-10-APInt.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llvm-dis +; PR2538 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i686-pc-linux-gnu" + +define i128 @a() { + ret i128 18446744073709551616 +} + diff --git a/test/Assembler/2008-09-02-FunctionNotes.ll b/test/Assembler/2008-09-02-FunctionNotes.ll new file mode 100644 index 0000000..761c91e --- /dev/null +++ b/test/Assembler/2008-09-02-FunctionNotes.ll @@ -0,0 +1,14 @@ +; Test function attributes +; RUN: llvm-as < %s | llvm-dis | grep inline | count 2 + +define void @fn1() alwaysinline { + ret void +} + +define void @fn2() noinline { + ret void +} + +define void @fn3() { + ret void +} diff --git a/test/Assembler/2008-09-02-FunctionNotes2.ll b/test/Assembler/2008-09-02-FunctionNotes2.ll new file mode 100644 index 0000000..8a49e89 --- /dev/null +++ b/test/Assembler/2008-09-02-FunctionNotes2.ll @@ -0,0 +1,6 @@ +; Test function notes +; RUN: not llvm-as %s -o /dev/null |& grep "Attributes noinline alwaysinline are incompatible" +define void @fn1() alwaysinline noinline { + ret void +} + diff --git a/test/Assembler/2008-09-29-RetAttr.ll b/test/Assembler/2008-09-29-RetAttr.ll new file mode 100644 index 0000000..f7db96d --- /dev/null +++ b/test/Assembler/2008-09-29-RetAttr.ll @@ -0,0 +1,13 @@ +; Test return attributes +; RUN: llvm-as < %s | llvm-dis | grep "define inreg i32" +; RUN: llvm-as < %s | llvm-dis | grep "call inreg i32" + +define inreg i32 @fn1() { + ret i32 0 +} + +define void @fn2() { + %t = call inreg i32 @fn1() + ret void +} + diff --git a/test/Assembler/2008-10-14-NamedTypeOnInteger.ll b/test/Assembler/2008-10-14-NamedTypeOnInteger.ll new file mode 100644 index 0000000..009489d --- /dev/null +++ b/test/Assembler/2008-10-14-NamedTypeOnInteger.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +; PR2733 + +%t1 = type i32 +%t2 = type { %t1 } +@i1 = constant %t2 { %t1 15 } diff --git a/test/Assembler/2008-10-14-QuoteInName.ll b/test/Assembler/2008-10-14-QuoteInName.ll new file mode 100644 index 0000000..ccd7779 --- /dev/null +++ b/test/Assembler/2008-10-14-QuoteInName.ll @@ -0,0 +1,3 @@ +; RUN: llvm-as < %s | llvm-dis | grep "quote" + +@"a\22quote" = global i32 0 diff --git a/test/Assembler/2009-02-01-UnnamedForwardRef.ll b/test/Assembler/2009-02-01-UnnamedForwardRef.ll new file mode 100644 index 0000000..9c6e20d --- /dev/null +++ b/test/Assembler/2009-02-01-UnnamedForwardRef.ll @@ -0,0 +1,6 @@ +; RUN: llvm-as < %s | llvm-dis +; PR3372 + +@X = global i32* @0 +global i32 4 + diff --git a/test/Assembler/2009-02-28-CastOpc.ll b/test/Assembler/2009-02-28-CastOpc.ll new file mode 100644 index 0000000..ee98d41 --- /dev/null +++ b/test/Assembler/2009-02-28-CastOpc.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llvm-dis + +type i32 + +define void @foo() { + bitcast %0* null to i32* + ret void +} diff --git a/test/Assembler/2009-02-28-StripOpaqueName.ll b/test/Assembler/2009-02-28-StripOpaqueName.ll new file mode 100644 index 0000000..f61a44c --- /dev/null +++ b/test/Assembler/2009-02-28-StripOpaqueName.ll @@ -0,0 +1,6 @@ +; RUN: opt < %s -strip -S | llvm-as | llvm-dis + +; Stripping the name from A should not break references to it. +%A = type opaque +@g1 = external global %A +@g2 = global %A* @g1 diff --git a/test/Assembler/2009-03-24-ZextConstantExpr.ll b/test/Assembler/2009-03-24-ZextConstantExpr.ll new file mode 100644 index 0000000..daedb95 --- /dev/null +++ b/test/Assembler/2009-03-24-ZextConstantExpr.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llvm-dis +; PR3876 +@gdtr = external global [0 x i8] + +define void @test() { + call zeroext i1 @paging_map(i64 zext (i32 and (i32 ptrtoint ([0 x i8]* @gdtr to i32), i32 -4096) to i64)) + ret void +} + +declare zeroext i1 @paging_map(i64) + diff --git a/test/Assembler/2009-04-25-AliasGEP.ll b/test/Assembler/2009-04-25-AliasGEP.ll new file mode 100644 index 0000000..6d07208 --- /dev/null +++ b/test/Assembler/2009-04-25-AliasGEP.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +; PR4066 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9" + %struct.i2c_device_id = type { } +@w83l785ts_id = internal constant [0 x %struct.i2c_device_id] zeroinitializer, align 1 ; <[0 x %struct.i2c_device_id]*> [#uses=1] + +@__mod_i2c_device_table = alias getelementptr ([0 x %struct.i2c_device_id]* @w83l785ts_id, i32 0, i32 0) ; <%struct.i2c_device_id*> [#uses=0] diff --git a/test/Assembler/2009-07-24-ZeroArgGEP.ll b/test/Assembler/2009-07-24-ZeroArgGEP.ll new file mode 100644 index 0000000..2a3d114 --- /dev/null +++ b/test/Assembler/2009-07-24-ZeroArgGEP.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as %s -o /dev/null + +@foo = global i32 0 +@bar = constant i32* getelementptr(i32* @foo) + diff --git a/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll b/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll new file mode 100644 index 0000000..b2256b1 --- /dev/null +++ b/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll @@ -0,0 +1,25 @@ +; RUN: opt -std-compile-opts < %s | llvm-dis | not grep badref + +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.2" + +%struct.anon = type { i32, i32 } +%struct.test = type { i64, %struct.anon, %struct.test* } + +@TestArrayPtr = global %struct.test* getelementptr inbounds ([10 x %struct.test]* @TestArray, i64 0, i64 3) ; <%struct.test**> [#uses=1] +@TestArray = common global [10 x %struct.test] zeroinitializer, align 32 ; <[10 x %struct.test]*> [#uses=2] + +define i32 @main() nounwind readonly { + %diff1 = alloca i64 ; <i64*> [#uses=2] + call void @llvm.dbg.declare(metadata !{i64* %diff1}, metadata !0) + store i64 72, i64* %diff1, align 8 + %v1 = load %struct.test** @TestArrayPtr, align 8 ; <%struct.test*> [#uses=1] + %v2 = ptrtoint %struct.test* %v1 to i64 ; <i64> [#uses=1] + %v3 = sub i64 %v2, ptrtoint ([10 x %struct.test]* @TestArray to i64) ; <i64> [#uses=1] + store i64 %v3, i64* %diff1, align 8 + ret i32 4 +} + +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone + +!0 = metadata !{i32 459008, metadata !0, metadata !0, metadata !0, i32 38, metadata !0} ; [ DW_TAG_auto_variable ] diff --git a/test/Assembler/AutoUpgradeIntrinsics.ll b/test/Assembler/AutoUpgradeIntrinsics.ll new file mode 100644 index 0000000..af4ec92 --- /dev/null +++ b/test/Assembler/AutoUpgradeIntrinsics.ll @@ -0,0 +1,81 @@ +; Tests to make sure intrinsics are automatically upgraded. +; RUN: llvm-as < %s | llvm-dis | not grep {i32 @llvm\\.ct} +; RUN: llvm-as < %s | llvm-dis | \ +; RUN: not grep {llvm\\.part\\.set\\.i\[0-9\]*\\.i\[0-9\]*\\.i\[0-9\]*} +; RUN: llvm-as < %s | llvm-dis | \ +; RUN: not grep {llvm\\.part\\.select\\.i\[0-9\]*\\.i\[0-9\]*} +; RUN: llvm-as < %s | llvm-dis | \ +; RUN: not grep {llvm\\.bswap\\.i\[0-9\]*\\.i\[0-9\]*} +; RUN: llvm-as < %s | llvm-dis | \ +; RUN: grep {llvm\\.x86\\.mmx\\.ps} | grep {\\\<2 x i32\\\>} | count 6 + +declare i32 @llvm.ctpop.i28(i28 %val) +declare i32 @llvm.cttz.i29(i29 %val) +declare i32 @llvm.ctlz.i30(i30 %val) + +define i32 @test_ct(i32 %A) { + %c1 = call i32 @llvm.ctpop.i28(i28 1234) + %c2 = call i32 @llvm.cttz.i29(i29 2345) + %c3 = call i32 @llvm.ctlz.i30(i30 3456) + %r1 = add i32 %c1, %c2 + %r2 = add i32 %r1, %c3 + ret i32 %r2 +} + +declare i32 @llvm.part.set.i32.i32.i32(i32 %x, i32 %rep, i32 %hi, i32 %lo) +declare i16 @llvm.part.set.i16.i16.i16(i16 %x, i16 %rep, i32 %hi, i32 %lo) +define i32 @test_part_set(i32 %A, i16 %B) { + %a = call i32 @llvm.part.set.i32.i32.i32(i32 %A, i32 27, i32 8, i32 0) + %b = call i16 @llvm.part.set.i16.i16.i16(i16 %B, i16 27, i32 8, i32 0) + %c = zext i16 %b to i32 + %d = add i32 %a, %c + ret i32 %d +} + +declare i32 @llvm.part.select.i32.i32(i32 %x, i32 %hi, i32 %lo) +declare i16 @llvm.part.select.i16.i16(i16 %x, i32 %hi, i32 %lo) +define i32 @test_part_select(i32 %A, i16 %B) { + %a = call i32 @llvm.part.select.i32.i32(i32 %A, i32 8, i32 0) + %b = call i16 @llvm.part.select.i16.i16(i16 %B, i32 8, i32 0) + %c = zext i16 %b to i32 + %d = add i32 %a, %c + ret i32 %d +} + +declare i32 @llvm.bswap.i32.i32(i32 %x) +declare i16 @llvm.bswap.i16.i16(i16 %x) +define i32 @test_bswap(i32 %A, i16 %B) { + %a = call i32 @llvm.bswap.i32.i32(i32 %A) + %b = call i16 @llvm.bswap.i16.i16(i16 %B) + %c = zext i16 %b to i32 + %d = add i32 %a, %c + ret i32 %d +} + +declare <4 x i16> @llvm.x86.mmx.psra.w(<4 x i16>, <2 x i32>) nounwind readnone +declare <4 x i16> @llvm.x86.mmx.psll.w(<4 x i16>, <2 x i32>) nounwind readnone +declare <4 x i16> @llvm.x86.mmx.psrl.w(<4 x i16>, <2 x i32>) nounwind readnone +define void @sh16(<4 x i16> %A, <2 x i32> %B) { + %r1 = call <4 x i16> @llvm.x86.mmx.psra.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0] + %r2 = call <4 x i16> @llvm.x86.mmx.psll.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0] + %r3 = call <4 x i16> @llvm.x86.mmx.psrl.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0] + ret void +} + +declare <2 x i32> @llvm.x86.mmx.psra.d(<2 x i32>, <2 x i32>) nounwind readnone +declare <2 x i32> @llvm.x86.mmx.psll.d(<2 x i32>, <2 x i32>) nounwind readnone +declare <2 x i32> @llvm.x86.mmx.psrl.d(<2 x i32>, <2 x i32>) nounwind readnone +define void @sh32(<2 x i32> %A, <2 x i32> %B) { + %r1 = call <2 x i32> @llvm.x86.mmx.psra.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0] + %r2 = call <2 x i32> @llvm.x86.mmx.psll.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0] + %r3 = call <2 x i32> @llvm.x86.mmx.psrl.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0] + ret void +} + +declare <1 x i64> @llvm.x86.mmx.psll.q(<1 x i64>, <2 x i32>) nounwind readnone +declare <1 x i64> @llvm.x86.mmx.psrl.q(<1 x i64>, <2 x i32>) nounwind readnone +define void @sh64(<1 x i64> %A, <2 x i32> %B) { + %r1 = call <1 x i64> @llvm.x86.mmx.psll.q( <1 x i64> %A, <2 x i32> %B ) ; <<1 x i64>> [#uses=0] + %r2 = call <1 x i64> @llvm.x86.mmx.psrl.q( <1 x i64> %A, <2 x i32> %B ) ; <<1 x i64>> [#uses=0] + ret void +} diff --git a/test/Assembler/ConstantExprFold.ll b/test/Assembler/ConstantExprFold.ll new file mode 100644 index 0000000..d3d374a --- /dev/null +++ b/test/Assembler/ConstantExprFold.ll @@ -0,0 +1,31 @@ +; This test checks to make sure that constant exprs fold in some simple +; situations + +; RUN: llvm-as < %s | llvm-dis | not grep {(} + +@A = global i64 0 + +global i64* inttoptr (i64 add (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X + 0 == X +global i64* inttoptr (i64 sub (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X - 0 == X +global i64* inttoptr (i64 mul (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X * 0 == 0 +global i64* inttoptr (i64 sdiv (i64 ptrtoint (i64* @A to i64), i64 1) to i64*) ; X / 1 == X +global i64* inttoptr (i64 srem (i64 ptrtoint (i64* @A to i64), i64 1) to i64*) ; X % 1 == 0 +global i64* inttoptr (i64 and (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X & 0 == 0 +global i64* inttoptr (i64 and (i64 ptrtoint (i64* @A to i64), i64 -1) to i64*) ; X & -1 == X +global i64 or (i64 ptrtoint (i64* @A to i64), i64 -1) ; X | -1 == -1 +global i64* inttoptr (i64 xor (i64 ptrtoint (i64* @A to i64), i64 0) to i64*) ; X ^ 0 == X + +%Ty = type { i32, i32 } +@B = external global %Ty + +global i1 icmp slt (i64* @A, i64* getelementptr (i64* @A, i64 1)) ; true +global i1 icmp ult (i64* @A, i64* getelementptr (i64* @A, i64 1)) ; true +global i1 icmp slt (i64* @A, i64* getelementptr (i64* @A, i64 0)) ; false +global i1 icmp slt (i32* getelementptr (%Ty* @B, i64 0, i32 0), + i32* getelementptr (%Ty* @B, i64 0, i32 1)) ; true +;global i1 icmp ne (i64* @A, i64* bitcast (%Ty* @B to i64*)) ; true + +; PR2206 +@cons = weak global i32 0, align 8 ; <i32*> [#uses=1] +global i64 and (i64 ptrtoint (i32* @cons to i64), i64 7) + diff --git a/test/Assembler/ConstantExprFoldCast.ll b/test/Assembler/ConstantExprFoldCast.ll new file mode 100644 index 0000000..0ce6e84 --- /dev/null +++ b/test/Assembler/ConstantExprFoldCast.ll @@ -0,0 +1,14 @@ +; This test checks to make sure that constant exprs fold in some simple situations + +; RUN: llvm-as < %s | llvm-dis | not grep cast + +@A = global i32* bitcast (i8* null to i32*) ; Cast null -> fold +@B = global i32** bitcast (i32** @A to i32**) ; Cast to same type -> fold +@C = global i32 trunc (i64 42 to i32) ; Integral casts +@D = global i32* bitcast(float* bitcast (i32* @C to float*) to i32*) ; cast of cast ptr->ptr +@E = global i32 ptrtoint(float* inttoptr (i8 5 to float*) to i32) ; i32 -> ptr -> i32 + +; Test folding of binary instrs +@F = global i32* inttoptr (i32 add (i32 5, i32 -5) to i32*) +@G = global i32* inttoptr (i32 sub (i32 5, i32 5) to i32*) + diff --git a/test/Assembler/MultipleReturnValueType.ll b/test/Assembler/MultipleReturnValueType.ll new file mode 100644 index 0000000..6177143 --- /dev/null +++ b/test/Assembler/MultipleReturnValueType.ll @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s + + %struct.S_102 = type { float, float } + +declare %struct.S_102 @f_102() nounwind + +@callthis = external global void ()* ; <void ()**> [#uses=50] + + +define void @foo() { + store void ()* bitcast (%struct.S_102 ()* @f_102 to void ()*), void ()** @callthis, align 8 + ret void +} diff --git a/test/Assembler/aggregate-constant-values.ll b/test/Assembler/aggregate-constant-values.ll new file mode 100644 index 0000000..a37d03e --- /dev/null +++ b/test/Assembler/aggregate-constant-values.ll @@ -0,0 +1,27 @@ +; RUN: llvm-as < %s | llvm-dis | grep 7 | count 3 + +define void @foo({i32, i32}* %x) nounwind { + store {i32, i32}{i32 7, i32 9}, {i32, i32}* %x + ret void +} +define void @foo_empty({}* %x) nounwind { + store {}{}, {}* %x + ret void +} +define void @bar([2 x i32]* %x) nounwind { + store [2 x i32][i32 7, i32 9], [2 x i32]* %x + ret void +} +define void @bar_empty([0 x i32]* %x) nounwind { + store [0 x i32][], [0 x i32]* %x + ret void +} +define void @qux(<{i32, i32}>* %x) nounwind { + store <{i32, i32}><{i32 7, i32 9}>, <{i32, i32}>* %x + ret void +} +define void @qux_empty(<{}>* %x) nounwind { + store <{}><{}>, <{}>* %x + ret void +} + diff --git a/test/Assembler/aggregate-return-single-value.ll b/test/Assembler/aggregate-return-single-value.ll new file mode 100644 index 0000000..02fb59f --- /dev/null +++ b/test/Assembler/aggregate-return-single-value.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | llvm-dis + +define { i32 } @fooa() nounwind { + ret i32 0 +} +define { i32 } @foob() nounwind { + ret {i32}{ i32 0 } +} +define [1 x i32] @fooc() nounwind { + ret i32 0 +} +define [1 x i32] @food() nounwind { + ret [1 x i32][ i32 0 ] +} diff --git a/test/Assembler/alignstack.ll b/test/Assembler/alignstack.ll new file mode 100644 index 0000000..9f2059f --- /dev/null +++ b/test/Assembler/alignstack.ll @@ -0,0 +1,36 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define void @test1() nounwind { +; CHECK: test1 +; CHECK: sideeffect +; CHECK-NOT: alignstack + tail call void asm sideeffect "mov", "~{dirflag},~{fpsr},~{flags}"() nounwind + ret void +; CHECK: ret +} +define void @test2() nounwind { +; CHECK: test2 +; CHECK: sideeffect +; CHECK: alignstack + tail call void asm sideeffect alignstack "mov", "~{dirflag},~{fpsr},~{flags}"() nounwind + ret void +; CHECK: ret +} +define void @test3() nounwind { +; CHECK: test3 +; CHECK-NOT: sideeffect +; CHECK: alignstack + tail call void asm alignstack "mov", "~{dirflag},~{fpsr},~{flags}"() nounwind + ret void +; CHECK: ret +} +define void @test4() nounwind { +; CHECK: test4 +; CHECK-NOT: sideeffect +; CHECK-NOT: alignstack + tail call void asm "mov", "~{dirflag},~{fpsr},~{flags}"() nounwind + ret void +; CHECK: ret +} diff --git a/test/Assembler/anon-functions.ll b/test/Assembler/anon-functions.ll new file mode 100644 index 0000000..ac06e8c --- /dev/null +++ b/test/Assembler/anon-functions.ll @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +; PR3611 + +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" + +@f = alias void ()* @0 ; <void ()*> [#uses=0] +@g = alias void ()* @1 ; <void ()*> [#uses=0] +@h = external global void ()* ; <void ()*> [#uses=0] + +define internal void @0() nounwind { +entry: + store void()* @0, void()** @h + br label %return + +return: ; preds = %entry + ret void +} + +define internal void @1() nounwind { +entry: + br label %return + +return: ; preds = %entry + ret void +} diff --git a/test/Assembler/bcwrap.ll b/test/Assembler/bcwrap.ll new file mode 100644 index 0000000..859dc4b --- /dev/null +++ b/test/Assembler/bcwrap.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s > %t +; RUN: llvm-nm %t | grep foo +; test for isBitcodeFile, llvm-nm must read from a file for this test +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9.2.2" + +define i32 @foo() { + ret i32 0 +} diff --git a/test/Assembler/dg.exp b/test/Assembler/dg.exp new file mode 100644 index 0000000..f200589 --- /dev/null +++ b/test/Assembler/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] diff --git a/test/Assembler/flags.ll b/test/Assembler/flags.ll new file mode 100644 index 0000000..3241909 --- /dev/null +++ b/test/Assembler/flags.ll @@ -0,0 +1,212 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +@addr = external global i64 + +define i64 @add_unsigned(i64 %x, i64 %y) { +; CHECK: %z = add nuw i64 %x, %y + %z = add nuw i64 %x, %y + ret i64 %z +} + +define i64 @sub_unsigned(i64 %x, i64 %y) { +; CHECK: %z = sub nuw i64 %x, %y + %z = sub nuw i64 %x, %y + ret i64 %z +} + +define i64 @mul_unsigned(i64 %x, i64 %y) { +; CHECK: %z = mul nuw i64 %x, %y + %z = mul nuw i64 %x, %y + ret i64 %z +} + +define i64 @add_signed(i64 %x, i64 %y) { +; CHECK: %z = add nsw i64 %x, %y + %z = add nsw i64 %x, %y + ret i64 %z +} + +define i64 @sub_signed(i64 %x, i64 %y) { +; CHECK: %z = sub nsw i64 %x, %y + %z = sub nsw i64 %x, %y + ret i64 %z +} + +define i64 @mul_signed(i64 %x, i64 %y) { +; CHECK: %z = mul nsw i64 %x, %y + %z = mul nsw i64 %x, %y + ret i64 %z +} + +define i64 @add_plain(i64 %x, i64 %y) { +; CHECK: %z = add i64 %x, %y + %z = add i64 %x, %y + ret i64 %z +} + +define i64 @sub_plain(i64 %x, i64 %y) { +; CHECK: %z = sub i64 %x, %y + %z = sub i64 %x, %y + ret i64 %z +} + +define i64 @mul_plain(i64 %x, i64 %y) { +; CHECK: %z = mul i64 %x, %y + %z = mul i64 %x, %y + ret i64 %z +} + +define i64 @add_both(i64 %x, i64 %y) { +; CHECK: %z = add nuw nsw i64 %x, %y + %z = add nuw nsw i64 %x, %y + ret i64 %z +} + +define i64 @sub_both(i64 %x, i64 %y) { +; CHECK: %z = sub nuw nsw i64 %x, %y + %z = sub nuw nsw i64 %x, %y + ret i64 %z +} + +define i64 @mul_both(i64 %x, i64 %y) { +; CHECK: %z = mul nuw nsw i64 %x, %y + %z = mul nuw nsw i64 %x, %y + ret i64 %z +} + +define i64 @add_both_reversed(i64 %x, i64 %y) { +; CHECK: %z = add nuw nsw i64 %x, %y + %z = add nsw nuw i64 %x, %y + ret i64 %z +} + +define i64 @sub_both_reversed(i64 %x, i64 %y) { +; CHECK: %z = sub nuw nsw i64 %x, %y + %z = sub nsw nuw i64 %x, %y + ret i64 %z +} + +define i64 @mul_both_reversed(i64 %x, i64 %y) { +; CHECK: %z = mul nuw nsw i64 %x, %y + %z = mul nsw nuw i64 %x, %y + ret i64 %z +} + +define i64 @sdiv_exact(i64 %x, i64 %y) { +; CHECK: %z = sdiv exact i64 %x, %y + %z = sdiv exact i64 %x, %y + ret i64 %z +} + +define i64 @sdiv_plain(i64 %x, i64 %y) { +; CHECK: %z = sdiv i64 %x, %y + %z = sdiv i64 %x, %y + ret i64 %z +} + +define i64* @gep_nw(i64* %p, i64 %x) { +; CHECK: %z = getelementptr inbounds i64* %p, i64 %x + %z = getelementptr inbounds i64* %p, i64 %x + ret i64* %z +} + +define i64* @gep_plain(i64* %p, i64 %x) { +; CHECK: %z = getelementptr i64* %p, i64 %x + %z = getelementptr i64* %p, i64 %x + ret i64* %z +} + +define i64 @add_both_ce() { +; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sub_both_ce() { +; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @mul_both_ce() { +; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sdiv_exact_ce() { +; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64* @gep_nw_ce() { +; CHECK: ret i64* getelementptr inbounds (i64* @addr, i64 171) + ret i64* getelementptr inbounds (i64* @addr, i64 171) +} + +define i64 @add_plain_ce() { +; CHECK: ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sub_plain_ce() { +; CHECK: ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @mul_plain_ce() { +; CHECK: ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sdiv_plain_ce() { +; CHECK: ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64* @gep_plain_ce() { +; CHECK: ret i64* getelementptr (i64* @addr, i64 171) + ret i64* getelementptr (i64* @addr, i64 171) +} + +define i64 @add_both_reversed_ce() { +; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sub_both_reversed_ce() { +; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @mul_both_reversed_ce() { +; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @add_signed_ce() { +; CHECK: ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sub_signed_ce() { +; CHECK: ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @mul_signed_ce() { +; CHECK: ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @add_unsigned_ce() { +; CHECK: ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @sub_unsigned_ce() { +; CHECK: ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} + +define i64 @mul_unsigned_ce() { +; CHECK: ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91) + ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91) +} diff --git a/test/Assembler/functionlocal-metadata.ll b/test/Assembler/functionlocal-metadata.ll new file mode 100644 index 0000000..216587d --- /dev/null +++ b/test/Assembler/functionlocal-metadata.ll @@ -0,0 +1,44 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +define void @Foo(i32 %a, i32 %b) { +entry: + call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !"bar") +; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata !"bar") + %0 = add i32 %a, 1 ; <i32> [#uses=1] + %two = add i32 %b, %0 ; <i32> [#uses=0] + %1 = alloca i32 ; <i32*> [#uses=1] + + call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32* %1}) +; CHECK: metadata !{i32* %1}, metadata !{i32* %1} + call void @llvm.dbg.declare(metadata !{i32 %two}, metadata !{i32 %0}) +; CHECK: metadata !{i32 %two}, metadata !{i32 %0} + call void @llvm.dbg.declare(metadata !{i32 %0}, metadata !{i32* %1, i32 %0}) +; CHECK: metadata !{i32 %0}, metadata !{i32* %1, i32 %0} + call void @llvm.dbg.declare(metadata !{i32* %1}, metadata !{i32 %b, i32 %0}) +; CHECK: metadata !{i32* %1}, metadata !{i32 %b, i32 %0} + call void @llvm.dbg.declare(metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"}) +; CHECK: metadata !{i32 %a}, metadata !{i32 %a, metadata !"foo"} + call void @llvm.dbg.declare(metadata !{i32 %b}, metadata !{metadata !0, i32 %two}) +; CHECK: metadata !{i32 %b}, metadata !{metadata !0, i32 %two} + + call void @llvm.dbg.value(metadata !{ i32 %a }, i64 0, metadata !1) +; CHECK: metadata !{i32 %a}, i64 0, metadata !1 + call void @llvm.dbg.value(metadata !{ i32 %0 }, i64 25, metadata !0) +; CHECK: metadata !{i32 %0}, i64 25, metadata !0 + call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !"foo") +; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata !"foo") + call void @llvm.dbg.value(metadata !"foo", i64 12, metadata !"bar") +; CHECK: metadata !"foo", i64 12, metadata !"bar" + + ret void, !foo !0, !bar !1 +; CHECK: ret void, !foo !0, !bar !1 +} + +!0 = metadata !{i32 662302, i32 26, metadata !1, null} +!1 = metadata !{i32 4, metadata !"foo"} + +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone +declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone + +!foo = !{ !0 } +!bar = !{ !1 } diff --git a/test/Assembler/getelementptr.ll b/test/Assembler/getelementptr.ll new file mode 100644 index 0000000..803d6d3 --- /dev/null +++ b/test/Assembler/getelementptr.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s + +; Verify that over-indexed getelementptrs are folded. +@A = external global [2 x [3 x [5 x [7 x i32]]]] +@B = global i32* getelementptr ([2 x [3 x [5 x [7 x i32]]]]* @A, i64 0, i64 0, i64 2, i64 1, i64 7523) +; CHECK: @B = global i32* getelementptr ([2 x [3 x [5 x [7 x i32]]]]* @A, i64 36, i64 0, i64 1, i64 0, i64 5) ; <i32**> [#uses=0] +@C = global i32* getelementptr ([2 x [3 x [5 x [7 x i32]]]]* @A, i64 3, i64 2, i64 0, i64 0, i64 7523) +; CHECK: @C = global i32* getelementptr ([2 x [3 x [5 x [7 x i32]]]]* @A, i64 39, i64 1, i64 1, i64 4, i64 5) ; <i32**> [#uses=0] + +;; Verify that i16 indices work. +@x = external global {i32, i32} +@y = global i32* getelementptr ({i32, i32}* @x, i16 42, i32 0) +; CHECK: @y = global i32* getelementptr (%0* @x, i16 42, i32 0) + +; see if i92 indices work too. +define i32 *@test({i32, i32}* %t, i92 %n) { +; CHECK: @test +; CHECK: %B = getelementptr %0* %t, i92 %n, i32 0 + %B = getelementptr {i32, i32}* %t, i92 %n, i32 0 + ret i32* %B +} + diff --git a/test/Assembler/getelementptr_struct.ll b/test/Assembler/getelementptr_struct.ll new file mode 100644 index 0000000..c8779a6 --- /dev/null +++ b/test/Assembler/getelementptr_struct.ll @@ -0,0 +1,12 @@ +; RUN: not llvm-as < %s >/dev/null |& grep {invalid getelementptr indices} +; Test the case of a incorrect indices type into struct + +%RT = type { i8 , [10 x [20 x i32]], i8 } +%ST = type { i32, double, %RT } + +define i32* @foo(%ST* %s) { +entry: + %reg = getelementptr %ST* %s, i32 1, i64 2, i32 1, i32 5, i32 13 + ret i32* %reg +} + diff --git a/test/Assembler/huge-array.ll b/test/Assembler/huge-array.ll new file mode 100644 index 0000000..e080947 --- /dev/null +++ b/test/Assembler/huge-array.ll @@ -0,0 +1,5 @@ +; RUN: llvm-as < %s | llvm-dis | grep 18446744073709551615 | count 2 + +define [18446744073709551615 x i8]* @foo() { + ret [18446744073709551615 x i8]* null +} diff --git a/test/Assembler/insertextractvalue.ll b/test/Assembler/insertextractvalue.ll new file mode 100644 index 0000000..2f5521f --- /dev/null +++ b/test/Assembler/insertextractvalue.ll @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | llvm-dis > %t +; RUN: grep insertvalue %t | count 1 +; RUN: grep extractvalue %t | count 1 + +define float @foo({{i32},{float, double}}* %p) nounwind { + %t = load {{i32},{float, double}}* %p + %s = extractvalue {{i32},{float, double}} %t, 1, 0 + %r = insertvalue {{i32},{float, double}} %t, double 2.0, 1, 1 + store {{i32},{float, double}} %r, {{i32},{float, double}}* %p + ret float %s +} +define float @bar({{i32},{float, double}}* %p) nounwind { + store {{i32},{float, double}} insertvalue ({{i32},{float, double}}{{i32}{i32 4},{float, double}{float 4.0, double 5.0}}, double 20.0, 1, 1), {{i32},{float, double}}* %p + ret float extractvalue ({{i32},{float, double}}{{i32}{i32 3},{float, double}{float 7.0, double 9.0}}, 1, 0) +} +define float @car({{i32},{float, double}}* %p) nounwind { + store {{i32},{float, double}} insertvalue ({{i32},{float, double}} undef, double 20.0, 1, 1), {{i32},{float, double}}* %p + ret float extractvalue ({{i32},{float, double}} undef, 1, 0) +} +define float @dar({{i32},{float, double}}* %p) nounwind { + store {{i32},{float, double}} insertvalue ({{i32},{float, double}} zeroinitializer, double 20.0, 1, 1), {{i32},{float, double}}* %p + ret float extractvalue ({{i32},{float, double}} zeroinitializer, 1, 0) +} + + +; PR4963 +define <{ i32, i32 }> @test57() { + ret <{ i32, i32 }> insertvalue (<{ i32, i32 }> zeroinitializer, i32 4, 1) +} diff --git a/test/Assembler/metadata.ll b/test/Assembler/metadata.ll new file mode 100644 index 0000000..a52de87 --- /dev/null +++ b/test/Assembler/metadata.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep {ret void, !bar !1, !foo !0} +define void @test() { + add i32 2, 1, !bar !0 + add i32 1, 2, !foo !1 + + call void @llvm.dbg.func.start(metadata !"foo") + + extractvalue {{i32, i32}, i32} undef, 0, 1, !foo !0 + + ret void, !foo !0, !bar !1 +} + +!0 = metadata !{i32 662302, i32 26, metadata !1, null} +!1 = metadata !{i32 4, metadata !"foo"} + +declare void @llvm.dbg.func.start(metadata) nounwind readnone + + +!foo = !{ !0 } +!bar = !{ !1 } + +; !foo = !{ !0, !"foo" }
\ No newline at end of file diff --git a/test/Assembler/numbered-values.ll b/test/Assembler/numbered-values.ll new file mode 100644 index 0000000..2439c83 --- /dev/null +++ b/test/Assembler/numbered-values.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis +; PR2480 + +define i32 @test(i32 %X) nounwind { +entry: + %X_addr = alloca i32 ; <i32*> [#uses=2] + %retval = alloca i32 ; <i32*> [#uses=2] + %0 = alloca i32 ; <i32*>:0 [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + store i32 %X, i32* %X_addr + %1 = load i32* %X_addr, align 4 ; <i32>:1 [#uses=1] + mul i32 %1, 4 ; <i32>:2 [#uses=1] + %3 = add i32 %2, 123 ; <i32>:3 [#uses=1] + store i32 %3, i32* %0, align 4 + ret i32 %3 +} diff --git a/test/Assembler/private.ll b/test/Assembler/private.ll new file mode 100644 index 0000000..3714572 --- /dev/null +++ b/test/Assembler/private.ll @@ -0,0 +1,9 @@ +; Test to make sure that the 'private' tag is not lost! +; +; RUN: llvm-as < %s | llvm-dis | grep private + +declare void @foo() + +define private void @foo() { + ret void +} diff --git a/test/Assembler/select.ll b/test/Assembler/select.ll new file mode 100644 index 0000000..2d3f412 --- /dev/null +++ b/test/Assembler/select.ll @@ -0,0 +1,9 @@ +; RUN: llvm-as %s -o /dev/null + + +define i32 @test(i1 %C, i32 %V1, i32 %V2) { + %X = select i1 true, i1 false, i1 true ; <i1> [#uses=1] + %V = select i1 %X, i32 %V1, i32 %V2 ; <i32> [#uses=1] + ret i32 %V +} + diff --git a/test/Assembler/unnamed.ll b/test/Assembler/unnamed.ll new file mode 100644 index 0000000..fb4fa62 --- /dev/null +++ b/test/Assembler/unnamed.ll @@ -0,0 +1,51 @@ +; RUN: llvm-as < %s | llvm-dis + +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" + +module asm "this is an inline asm block" +module asm "this is another inline asm block" + +%0 = type { %1, %2 } +%1 = type { i32 } +%2 = type { float, double } + +@0 = global i32 0 +@1 = global float 3.0 +@2 = global i8* null +@3 = global x86_fp80 0xK4001E000000000000000 + +define float @foo(%0* %p) nounwind { + %t = load %0* %p ; <%0> [#uses=2] + %s = extractvalue %0 %t, 1, 0 ; <float> [#uses=1] + %r = insertvalue %0 %t, double 2.000000e+00, 1, 1; <%0> [#uses=1] + store %0 %r, %0* %p + ret float %s +} + +define float @bar(%0* %p) nounwind { + store %0 { %1 { i32 4 }, %2 { float 4.000000e+00, double 2.000000e+01 } }, %0* %p + ret float 7.000000e+00 +} + +define float @car(%0* %p) nounwind { + store %0 { %1 undef, %2 { float undef, double 2.000000e+01 } }, %0* %p + ret float undef +} + +define float @dar(%0* %p) nounwind { + store %0 { %1 zeroinitializer, %2 { float 0.000000e+00, double 2.000000e+01 } }, %0* %p + ret float 0.000000e+00 +} + +define i32* @qqq() { + ret i32* @0 +} +define float* @rrr() { + ret float* @1 +} +define i8** @sss() { + ret i8** @2 +} +define x86_fp80* @nnn() { + ret x86_fp80* @3 +} diff --git a/test/Assembler/vbool-cmp.ll b/test/Assembler/vbool-cmp.ll new file mode 100644 index 0000000..ac8fb29 --- /dev/null +++ b/test/Assembler/vbool-cmp.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep {icmp slt} +; rudimentary test of fcmp/icmp on vectors returning vector of bool + +define <4 x i1> @ffoo(<4 x float> %a, <4 x float> %b) nounwind { +entry: + %cmp = fcmp olt <4 x float> %a, %b ; <4 x i1> [#uses=1] + ret <4 x i1> %cmp +} + +define <4 x i1> @ifoo(<4 x i32> %a, <4 x i32> %b) nounwind { +entry: + %cmp = icmp slt <4 x i32> %a, %b ; <4 x i1> [#uses=1] + ret <4 x i1> %cmp +} + diff --git a/test/Assembler/vector-cmp.ll b/test/Assembler/vector-cmp.ll new file mode 100644 index 0000000..688369b --- /dev/null +++ b/test/Assembler/vector-cmp.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep {global.*icmp slt} +; PR2317 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9.2.2" + +define <4 x i1> @foo(<4 x float> %a, <4 x float> %b) nounwind { +entry: + %cmp = fcmp olt <4 x float> %a, %b ; <4 x i32> [#uses=1] + ret <4 x i1> %cmp +} + +global <4 x i1> icmp slt ( <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 1, i32 2, i32 1, i32 2> ) + +@B = external global i32 + +global <4 x i1> icmp slt ( <4 x i32> <i32 ptrtoint (i32 * @B to i32), i32 1, i32 1, i32 1>, <4 x i32> <i32 1, i32 2, i32 1, i32 2> ) diff --git a/test/Assembler/vector-select.ll b/test/Assembler/vector-select.ll new file mode 100644 index 0000000..87af602 --- /dev/null +++ b/test/Assembler/vector-select.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep select +; rudimentary test of select on vectors returning vector of bool + +define <4 x i32> @foo(<4 x i32> %a, <4 x i32> %b, + <4 x i1> %cond) nounwind { +entry: + %cmp = select <4 x i1> %cond, <4 x i32> %a, <4 x i32> %b + ; <4 x i32> [#uses=1] + ret <4 x i32> %cmp +} + diff --git a/test/Assembler/vector-shift.ll b/test/Assembler/vector-shift.ll new file mode 100644 index 0000000..1850e66 --- /dev/null +++ b/test/Assembler/vector-shift.ll @@ -0,0 +1,32 @@ +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep shl | count 1 +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep ashr | count 1 +; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep lshr | count 1 + +define <4 x i32> @foo(<4 x i32> %a, <4 x i32> %b) nounwind { +entry: + %cmp = shl <4 x i32> %a, %b ; <4 x i32> [#uses=1] + ret <4 x i32> %cmp +} + +define <4 x i32> @bar(<4 x i32> %a, <4 x i32> %b) nounwind { +entry: + %cmp = lshr <4 x i32> %a, %b ; <4 x i32> [#uses=1] + ret <4 x i32> %cmp +} + +define <4 x i32> @baz(<4 x i32> %a, <4 x i32> %b) nounwind { +entry: + %cmp = ashr <4 x i32> %a, %b ; <4 x i32> [#uses=1] + ret <4 x i32> %cmp +} + +; Constant expressions: these should be folded. +define <2 x i64> @foo_ce() nounwind { + ret <2 x i64> shl (<2 x i64> <i64 5, i64 6>, <2 x i64> <i64 3, i64 5>) +} +define <2 x i64> @bar_ce() nounwind { + ret <2 x i64> lshr (<2 x i64> <i64 340, i64 380>, <2 x i64> <i64 3, i64 5>) +} +define <2 x i64> @baz_ce() nounwind { + ret <2 x i64> ashr (<2 x i64> <i64 573, i64 411>, <2 x i64> <i64 3, i64 5>) +} |