Daniel Dunbar
e422266926
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.
...
llvm-svn: 107232
2010-06-30 00:22:35 +00:00
Daniel Dunbar
c85ea8e175
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
...
would trigger an extra method call).
- While in the area, I also changed Clang to not emit an unnecessary load from
'x' in cases like 'y = (x = 1)'.
llvm-svn: 107210
2010-06-29 22:00:45 +00:00
Daniel Dunbar
99e13101b2
tests: Fix test to not depend on instruction names.
...
llvm-svn: 107186
2010-06-29 18:34:40 +00:00
Chris Lattner
ab1e65e2ea
fix PR7519: after thrashing around and remembering how all this stuff
...
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.
llvm-svn: 107173
2010-06-29 17:56:33 +00:00
Chris Lattner
22a931e3bb
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
...
avoid passing ASTContext down through all the methods it has.
When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type. If so, use that pointer type instead of i64. This
allows us to compile A function taking a stringref into something
like this:
define i8* @foo(i64 %D.coerce0, i8* %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%0 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %D.coerce0, i64* %0
%1 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
store i8* %D.coerce1, i8** %1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
instead of this:
define i8* @foo(i64 %D.coerce0, i64 %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%0 = insertvalue %0 undef, i64 %D.coerce0, 0 ; <%0> [#uses=1]
%1 = insertvalue %0 %0, i64 %D.coerce1, 1 ; <%0> [#uses=1]
%2 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %1, %0* %2, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
This implements rdar://7375902 - [codegen quality] clang x86-64 ABI lowering code punishing StringRef
llvm-svn: 107123
2010-06-29 06:01:59 +00:00
Chris Lattner
9e748e9d6e
add IR names to coerced arguments.
...
llvm-svn: 107105
2010-06-29 00:14:52 +00:00
Chris Lattner
3dd716c3c3
Change CGCall to handle the "coerce" case where the coerce-to type
...
is a FCA to pass each of the elements as individual scalars. This
produces code fast isel is less likely to reject and is easier on
the optimizers.
For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
return D.NumDecls+D.Y;
}
to:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(%struct.DeclGroup) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
store %struct.DeclGroup %0, %struct.DeclGroup* %D, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
Now we get:
%0 = type { i64, i64 }
%struct.DeclGroup = type { i64, i8* }
define i8* @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %0 undef, i64 %0, 0 ; <%0> [#uses=1]
%3 = insertvalue %0 %2, i64 %1, 1 ; <%0> [#uses=1]
%4 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %3, %0* %4, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
Elimination of the FCA inside the function is still-to-come.
llvm-svn: 107099
2010-06-28 23:44:11 +00:00
Chris Lattner
a7d81ab7f3
X86-64:
...
pass/return structs of float/int as float/i32 instead of double/i64
to make the code generated for ABI cleaner. Passing in the low part
of a double is the same as passing in a float.
For example, we now compile:
struct DeclGroup { float NumDecls; };
float foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = load float* %coerce.dive, align 1 ; <float> [#uses=1]
%call = call float @_Z3foo9DeclGroup(float %0) ; <float> [#uses=0]
ret void
}
instead of:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca double ; <double*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = bitcast double* %tmp3 to float* ; <float*> [#uses=1]
%1 = load float* %coerce.dive ; <float> [#uses=1]
store float %1, float* %0, align 1
%2 = load double* %tmp3 ; <double> [#uses=1]
%call = call float @_Z3foo9DeclGroup(double %2) ; <float> [#uses=0]
ret void
}
which is this machine code (at -O0):
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
vs this:
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
movss %xmm0, (%rsp)
movsd (%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
At -O3, it is the difference between this now:
__Z3barP9DeclGroup:
movss (%rdi), %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
vs this before:
__Z3barP9DeclGroup:
movl (%rdi), %eax
movd %rax, %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
llvm-svn: 107048
2010-06-28 19:56:59 +00:00
Fariborz Jahanian
36ad0e99d5
Have __func__ and siblings point to block's implementation function
...
name. Fixes radar 7860965.
llvm-svn: 107044
2010-06-28 18:58:34 +00:00
Chris Lattner
d250b8e9a8
tweak test to pass on windows
...
llvm-svn: 107040
2010-06-28 18:29:14 +00:00
Chris Lattner
c1028f689e
Fix UnitTests/2004-02-02-NegativeZero.c, which regressed when
...
I broke negate of FP values.
llvm-svn: 107019
2010-06-28 17:12:37 +00:00
Chris Lattner
055097f024
If coercing something from int or pointer type to int or pointer type
...
(potentially after unwrapping it from a struct) do it without going through
memory. We now compile:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
into:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%coerce.val.ii = trunc i64 %0 to i32 ; <i32> [#uses=1]
store i32 %coerce.val.ii, i32* %coerce.dive
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp1 = load i32* %tmp ; <i32> [#uses=1]
ret i32 %tmp1
}
instead of:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
... which is quite a bit less terrifying.
llvm-svn: 106975
2010-06-27 06:26:04 +00:00
Chris Lattner
895c52ba8b
Same patch as the previous on the store side. Before we compiled this:
...
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
to:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%2 = load %struct.DeclGroup* %1, align 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %2, %struct.DeclGroup* %D
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
which caused fast isel bailouts due to the FCA load/store of %2. Now
we generate this just blissful code:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
This avoids fastisel bailing out and is groundwork for future patch.
This reduces bailouts on CGStmt.ll to 911 from 935.
llvm-svn: 106974
2010-06-27 06:04:18 +00:00
Chris Lattner
e01d966ce2
merge two tests.
...
llvm-svn: 106971
2010-06-27 01:08:03 +00:00
Chris Lattner
3fcc790cd8
Change IR generation for return (in the simple case) to avoid doing silly
...
load/store nonsense in the epilog. For example, for:
int foo(int X) {
int A[100];
return A[X];
}
we used to generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
store i32 %tmp1, i32* %retval
%0 = load i32* %retval ; <i32> [#uses=1]
ret i32 %0
}
which codegen'd to this code:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 400(%rsp)
movl 400(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %edi
movl %edi, 404(%rsp)
movl 404(%rsp), %eax
addq $408, %rsp ## imm = 0x198
ret
Now we generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
ret i32 %tmp1
}
and:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 404(%rsp)
movl 404(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %eax
addq $408, %rsp ## imm = 0x198
ret
This actually does matter, cutting out 2000 lines of IR from CGStmt.ll
for example.
Another interesting effect is that altivec.h functions which are dead
now get dce'd by the inliner. Hence all the changes to
builtins-ppc-altivec.c to ensure the calls aren't dead.
llvm-svn: 106970
2010-06-27 01:06:27 +00:00
Chris Lattner
6c5abe88bf
Implement rdar://7530813 - collapse multiple GEP instructions in IRgen
...
This avoids generating two gep's for common array operations. Before
we would generate something like:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1]
%arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Now we generate:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Less IR is better at -O0.
llvm-svn: 106966
2010-06-26 23:03:20 +00:00
Chris Lattner
431bef4409
fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.
...
llvm-svn: 106962
2010-06-26 22:18:28 +00:00
Chris Lattner
0bf27620f0
Fix unary minus to trap on overflow with -ftrapv, refactoring binop
...
code so we can use it from VisitUnaryMinus.
llvm-svn: 106957
2010-06-26 21:48:21 +00:00
Chris Lattner
51924e517b
Implement support for -fwrapv, rdar://7221421
...
As part of this, pull together trapv handling into the same enum.
This also add support for NSW multiplies.
This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get
defined etc).
llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Chris Lattner
217e056e40
implement rdar://7432000 - signed negate should codegen as NSW.
...
While I'm in there, adjust pointer to member adjustments as well.
llvm-svn: 106955
2010-06-26 20:27:24 +00:00
Benjamin Kramer
9aa0d39443
A bug I've introduced in STDIN handling surfaced a few broken tests, fix them.
...
Lexer/hexfloat.cpp is now XFAIL'd, I'd appreciate if someone could look into it.
llvm-svn: 106840
2010-06-25 12:48:07 +00:00
Chris Lattner
3c77a355e0
implement support for -finstrument-functions, patch by Nelson
...
Elhage!
llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Anton Korobeynikov
cc50b7d7d5
More AltiVec support.
...
Patch by Anton Yartsev!
llvm-svn: 106387
2010-06-19 09:47:18 +00:00
Douglas Gregor
77e274fbc6
Merge the "regparm" attribute from a previous declaration of a
...
function to redeclarations of that function. Fixes PR7025.
llvm-svn: 106317
2010-06-18 21:30:25 +00:00
Rafael Espindola
23a8a06554
Change the test for which ABI/CC to use on ARM to be base on the environment
...
(the last argument of the triple).
llvm-svn: 106131
2010-06-16 19:01:17 +00:00
Rafael Espindola
ad64acde72
A a new test for my previous patch.
...
llvm-svn: 106120
2010-06-16 18:02:31 +00:00
Rafael Espindola
b35e7b8659
Fix tests that I missed from my previous commit.
...
llvm-svn: 106118
2010-06-16 17:49:52 +00:00
Benjamin Kramer
c0b8f3bc53
Enable basic testing of __builtin_fpclassify.
...
llvm-svn: 105937
2010-06-14 10:41:45 +00:00
John McCall
875679eea0
Fix the constant evaluator for AltiVec-style vector literals so that the
...
vector is filled with the given constant; we were just initializing the
first element.
llvm-svn: 105824
2010-06-11 17:54:15 +00:00
Rafael Espindola
2569885963
Add a test to the previous commit.
...
llvm-svn: 105596
2010-06-08 03:59:28 +00:00
Rafael Espindola
e971b9a260
Correctly align large arrays in x86-64. This fixes PR5599.
...
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
John McCall
8e346702b6
Preserve more information from a block's original function declarator, if one
...
was given. Remove some unnecessary accounting from BlockScopeInfo. Handle
typedef'ed function types until such time as we decide not.
llvm-svn: 105478
2010-06-04 19:02:56 +00:00
Fariborz Jahanian
6e81492151
Empty enum in c is now error to match gcc's behavior.
...
(radar 8040068).
llvm-svn: 105011
2010-05-28 22:23:22 +00:00
Fariborz Jahanian
93bef10131
Fix a miscompile of wchar pascal strings.
...
(radar 8020384)
llvm-svn: 104996
2010-05-28 19:40:48 +00:00
John McCall
02269a66b3
Enable the implementation of __builtin_setjmp and __builtin_longjmp. Not all
...
LLVM backends support these yet.
llvm-svn: 104867
2010-05-27 18:47:06 +00:00
Douglas Gregor
aab11ede6e
Fix testsuite for blocks mangling change
...
llvm-svn: 104618
2010-05-25 17:46:21 +00:00
Benjamin Kramer
fdb61d78e9
Implement codegen for __builtin_isnormal.
...
llvm-svn: 104118
2010-05-19 11:24:26 +00:00
Douglas Gregor
162b419a02
Add missing test case, provided by Steven Watanabe.
...
llvm-svn: 104037
2010-05-18 17:43:51 +00:00
Douglas Gregor
a941dcae16
Add support for Microsoft's __thiscall, from Steven Watanabe!
...
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Eli Friedman
b41ad0fbea
PR7117: Make sure we don't lose the calling convention for K&R-style
...
definitions.
llvm-svn: 103932
2010-05-17 02:50:18 +00:00
John McCall
b1fb0d3610
The FP constant evaluator was missing a few cases of unary operators that return floats
...
but whose operand isn't a float: specifically, __real__ and __imag__. Instead
of filtering these out, just implement them.
Fixes <rdar://problem/7958272>.
llvm-svn: 103307
2010-05-07 22:08:54 +00:00
Chris Lattner
dbff4bf5f4
implement codegen support for __builtin_isfinite, part of PR6083
...
llvm-svn: 103168
2010-05-06 06:04:13 +00:00
Chris Lattner
68784efaf6
optimize builtin_isnan/isinf to not do an extraneous extension from
...
float -> double (which happens because they are modelled as int(...)
functions), and add a testcase for isinf.
llvm-svn: 103167
2010-05-06 05:50:07 +00:00
John McCall
4a39ab8078
Emit the globals, metadata, etc. associated with static variables even when
...
they're unreachable. This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't. Fixes PR7044.
llvm-svn: 103052
2010-05-04 20:45:42 +00:00
Devang Patel
dfcd0661a1
Use clang::VarDecl name instead of llvm::GlobalVariable name.
...
llvm::GLobalVariable name may not match user visibile name for function static variables.
llvm-svn: 102644
2010-04-29 17:48:37 +00:00
Mon P Wang
75c645c6d7
A not equal for an unordered relation should return true as specified in IEEE-754, e.g.,
...
NAN != NAN ? 1 : 0 should return 1. Also fix the case for complex.
llvm-svn: 102598
2010-04-29 05:53:29 +00:00
John McCall
d06fb865eb
Properly pass the address of a lazily-generated function declaration with
...
incomplete type. Fixes PR6911.
llvm-svn: 102473
2010-04-28 00:00:30 +00:00
Chris Lattner
db6d5cb892
Implement PR6845. We allow matching constraints to have different
...
input and output types when the smaller value isn't mentioned in the
asm string. Extend this support from integers to also allowing
fp values to be mismatched (if not mentioned in the asm string).
llvm-svn: 102188
2010-04-23 17:27:29 +00:00
Chris Lattner
6bcf2d81e8
rename test
...
llvm-svn: 102182
2010-04-23 16:30:17 +00:00
Chris Lattner
1a8f394a1f
david conrad points out that {|} in inline assembly on arm are not asm
...
variants. This fixes neon inline asm which my patch for PR6780 broke.
llvm-svn: 102181
2010-04-23 16:29:58 +00:00
Daniel Dunbar
f812506912
ARM/APCS: Don't respect bit-field types when laying out structures.
...
- This fixes the last known ABI issues with ARM/APCS.
- I've run the first 1k ABITests with '--no-unsigned --no-vector --no-complex'
on {armv6, armv7} x {-mno-thumb, -mthumb}, and the first 10k tests for armv7
-mthumb, for both function return types and single argument calls. These all
pass now (they failed horribly before without --no-bitfield).
llvm-svn: 102070
2010-04-22 16:14:54 +00:00
Daniel Dunbar
5981377698
IRgen: Fix another case where we generated an invalid access component when we
...
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.
llvm-svn: 102068
2010-04-22 15:22:33 +00:00
Daniel Dunbar
5d6c07e0e9
IRgen: Fix case where we might generate an access component with width == 0, if
...
we have to narrow the access side immediately (can happen with packed,
-fno-bitfield-type-align).
llvm-svn: 102067
2010-04-22 14:56:10 +00:00
Daniel Dunbar
fc66e0ed87
IRgen: Set alignment correctly on bit-field accesses.
...
llvm-svn: 102046
2010-04-22 03:17:04 +00:00
Daniel Dunbar
488f55c271
IRgen: Rewrite bit-field access policy to not access data beyond the bounds of the structure, which we also now verify as part of the post-layout consistency checks.
...
- This fixes some pedantic bugs with packed structures, as well as major problems with -fno-bitfield-type-align.
- Fixes PR5591, PR5567, and all known -fno-bitfield-type-align issues.
- Review appreciated.
llvm-svn: 102045
2010-04-22 02:35:46 +00:00
Daniel Dunbar
53fac692fa
ABI/x86-32 & x86-64: Alignment on 'byval' must be set when when the alignment
...
exceeds the minimum ABI alignment.
llvm-svn: 102019
2010-04-21 19:49:55 +00:00
Daniel Dunbar
f5dbc072a6
Convert test to FileCheck.
...
llvm-svn: 102018
2010-04-21 19:34:17 +00:00
Daniel Dunbar
14ec60024c
Convert test to FileCheck.
...
llvm-svn: 102016
2010-04-21 19:10:54 +00:00
Daniel Dunbar
20b551a443
IRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
...
matches how we currently handle structs, and this correctly handles
-fno-bitfield-type-align.
llvm-svn: 101918
2010-04-20 17:52:30 +00:00
Chris Lattner
9cffdf1331
don't slap noalias attribute on stret result arguments.
...
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525. There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.
llvm-svn: 101877
2010-04-20 05:44:43 +00:00
Nuno Lopes
247a138ec6
recommit r101568 to fix PR6766
...
as a side-effect, remove two FIXMEs now fixed
llvm-svn: 101726
2010-04-18 19:06:43 +00:00
Anders Carlsson
8345a70c67
Fix an assert when assigning a boolean value to a bitfield of type _Bool.
...
llvm-svn: 101678
2010-04-17 21:52:22 +00:00
Chris Lattner
b714a4b4a0
revert r101568, which miscompiles this testcase, distilled from ldecod:
...
void exit_picture()
{
char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};
foo(yuv_types);
}
llvm-svn: 101623
2010-04-17 06:53:44 +00:00
Nuno Lopes
74b595256a
fix PR6766: codegen of var initialized with wide char
...
llvm-svn: 101568
2010-04-16 23:19:41 +00:00
Nuno Lopes
1c5c30fdd3
add another test for the undef patch just for to have peace of mind :)
...
this follows from C99 6.7.8p10: if it is a union, the first named member is initialized
llvm-svn: 101539
2010-04-16 21:19:39 +00:00
Chris Lattner
3cff64ab58
fix a bogus assertion exposed by a recent change: packing the
...
struct may cause it to shrink more than one byte. Before
my recent changes we compiled the new test into:
%0 = type { [6 x i8] }
@x = global %0 { [6 x i8] undef }, align 2 ; <%0*> [#uses=0]
which is obviously bogus. Now we compile it into:
%0 = type <{ i32, i8, i8 }>
@x = global %0 zeroinitializer, align 2 ; <%0*> [#uses=0]
Where the last byte only is tail padding.
llvm-svn: 101536
2010-04-16 21:02:32 +00:00
Nuno Lopes
5863c999e7
emit padding as undef values, take 2
...
merge also a few tests I had here for this feature, and FileCheck'ize one file
llvm-svn: 101535
2010-04-16 20:56:35 +00:00
Daniel Dunbar
67aba79b74
IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.
- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.
The new fixes from r101222 are:
1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.
2. Swap the order of arguments to OR, to get a tad more constant folding.
llvm-svn: 101339
2010-04-15 03:47:33 +00:00
Eric Christopher
1bbc7086ff
Rewrite handling of 64-bit palignr intrinsics to be vector shuffles.
...
Stop multiplying constant by 8 accordingly in the header and change
intrinsic definition for what types we expect.
Add to existing palignr test to check that we're emitting the correct things.
llvm-svn: 101332
2010-04-15 01:43:08 +00:00
Chris Lattner
dd6697b4fa
improve altivec c++ support by adding casts, patch by
...
Anton Yartsev!
llvm-svn: 101281
2010-04-14 20:35:39 +00:00
Daniel Dunbar
91ea6ac3e9
Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.
...
llvm-svn: 101235
2010-04-14 05:48:35 +00:00
Daniel Dunbar
230e1541b3
IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.
- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.
llvm-svn: 101222
2010-04-14 04:08:03 +00:00
Chris Lattner
dad4062b4d
implement altivec.h and a bunch of support code, patch by Anton Yartsev!
...
llvm-svn: 101215
2010-04-14 03:54:58 +00:00
Chris Lattner
ff0e2a36e2
Rework the ConstStructBuilder code to emit missing initializer
...
elements with explicit zero values instead of with tail padding.
On an example like this:
struct foo { int a; int b; };
struct foo fooarray[] = {
{1, 2},
{4},
};
We now lay this out as:
@fooarray = global [2 x %struct.foo] [%struct.foo { i32 1, i32 2 }, %struct.foo { i32 4, i32 0 }]
instead of as:
@fooarray = global %0 <{ %struct.foo { i32 1, i32 2 }, %1 { i32 4, [4 x i8] zeroinitializer } }>
Preserving both the struct type of the second element, but also the array type of the entire thing.
llvm-svn: 101155
2010-04-13 18:16:19 +00:00
Chris Lattner
933f67887f
fix PR6660/6168: emit padding as zeros instead of undef. Because
...
trailing fields may not be represented in initializer lists, they
are being handled as padding and those fields *must* be zero
initialized.
llvm-svn: 101067
2010-04-12 21:10:05 +00:00
Benjamin Kramer
249f50ca04
Fix run line so this test actually tests something.
...
llvm-svn: 100962
2010-04-11 09:39:39 +00:00
Chris Lattner
bc3be65d2e
fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
...
llvm-svn: 100938
2010-04-10 18:34:14 +00:00
John McCall
8586bfd85d
@llvm.sqrt isn't really close enough to C's sqrt to justify emitting calls
...
to the intrinsic, even when math-errno is off.
Fixes rdar://problem/7828230 by falling back on the library function.
llvm-svn: 100613
2010-04-07 08:20:20 +00:00
Chris Lattner
e6485c5873
add a testcase that the integrated assembler rejects, this verifies
...
that the integrated assembler is working.
llvm-svn: 100545
2010-04-06 18:46:25 +00:00
Chris Lattner
da081a8e1f
fix PR6780, properly handling the IR {|} escapes in inline asm strings.
...
llvm-svn: 100449
2010-04-05 18:44:00 +00:00
Mon P Wang
cc2ab0cdc9
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
...
llvm-svn: 100305
2010-04-04 03:10:52 +00:00
Daniel Dunbar
8f0be43669
Avoid unneeded calls to opt/llvm-dis.
...
llvm-svn: 100236
2010-04-02 22:29:38 +00:00
Daniel Dunbar
87c1991bb4
Merge several tests into switch.c.
...
llvm-svn: 100235
2010-04-02 22:29:35 +00:00
Mon P Wang
f7f3bff646
Revert r100193 since it causes failures in objc in clang
...
llvm-svn: 100200
2010-04-02 18:43:42 +00:00
Mon P Wang
4b82a88764
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
...
llvm-svn: 100193
2010-04-02 18:04:30 +00:00
Jakob Stoklund Olesen
4d2972d793
Slightly relax test case. An upcoming LLVM commit will change the xor instruction.
...
llvm-svn: 99962
2010-03-30 23:57:49 +00:00
Daniel Dunbar
c4d551b6ff
Fix test in -Asserts build.
...
llvm-svn: 99960
2010-03-30 23:50:00 +00:00
Bob Wilson
adb58e32cc
Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
...
llvm-svn: 99949
2010-03-30 22:28:46 +00:00
Rafael Espindola
49b85ab6e6
Remember the regparm attribute in FunctionType::ExtInfo.
...
Fixes PR3782.
llvm-svn: 99940
2010-03-30 22:15:11 +00:00
Rafael Espindola
5c61cbeb58
Fix this test on windows. When running on windows we print
...
double 0.000000e+000
instead of
double 0.000000e+00
llvm-svn: 99932
2010-03-30 21:19:02 +00:00
Mon P Wang
231e99743a
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
...
llvm-svn: 99930
2010-03-30 21:02:45 +00:00
Rafael Espindola
c50c27cca8
the big refactoring bits of PR3782.
...
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.
llvm-svn: 99920
2010-03-30 20:24:48 +00:00
John McCall
39ec71f2e9
When mapping restrict to noalias, look for 'restrict' on the parameter variable
...
instead of the canonical parameter type (which has correctly dropped all such
direct qualifiers). Fixes PR6695.
llvm-svn: 99688
2010-03-27 00:47:27 +00:00
Nick Lewycky
3cfe6af8b5
Implement new mangling for vectors.
...
llvm-svn: 99616
2010-03-26 07:18:04 +00:00
Daniel Dunbar
3f540c0d7d
Remove support for nand atomic builtins. They are inconsistently implemented in
...
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.
llvm-svn: 99522
2010-03-25 17:13:09 +00:00
Daniel Dunbar
4ff562d557
IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
...
- This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.
llvm-svn: 99050
2010-03-20 07:04:11 +00:00
Daniel Dunbar
4c43e31d21
Evaluate: Fix a subtle bug in the pointer evaluator in which we would do an
...
expression computation in the wrong bit-width, and end up generating a totally
bogus array reference (_g0+8589934546).
- This showed up on Prolangs/cdecl.
llvm-svn: 99042
2010-03-20 05:53:45 +00:00
Chris Lattner
9723d6c699
fix PR6433, crash on va_arg of typedef.
...
llvm-svn: 98264
2010-03-11 18:19:55 +00:00
Devang Patel
93f274c161
Fix file reference for derived and composite types. Now, dwarf writer uses strict verifier that ignores debug info for such types if their file info is unknown.
...
llvm-svn: 98096
2010-03-09 22:49:11 +00:00
Chris Lattner
e18aaf2c4b
add a codegen hack to work around an AST bug, allowing us to compile the
...
code in PR6537. This should be reverted when the ast bug is fixed.
llvm-svn: 97981
2010-03-08 21:08:07 +00:00
Eli Friedman
99d20f83ba
PR6515: Implement __builtin_signbit and friends.
...
I'm reasonably sure my implementation is correct, but it would be nice if
someone could double-check.
llvm-svn: 97864
2010-03-06 02:17:52 +00:00
Fariborz Jahanian
2574577828
Remove header file dependencies in block patch
...
test case.
llvm-svn: 97777
2010-03-05 01:49:18 +00:00
Blaine Garst
f27ab71d9f
add support for a 1<<29 bit in the block flags field to mark blocks using alternate struct return ABI
...
llvm-svn: 97775
2010-03-05 01:29:59 +00:00
Rafael Espindola
bef98689ad
really fix 6473 by handling weakref in constant expressions.
...
llvm-svn: 97750
2010-03-04 21:26:03 +00:00
Rafael Espindola
2e42fec3a0
Fix PR6473.
...
Clang's support for weakref is now better than llvm-gcc's :-)
We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.
llvm-svn: 97733
2010-03-04 18:17:24 +00:00
John McCall
731be6620c
Revert changes r97693, r97700, and r97718.
...
Our testing framework can't deal with disabled targets yet.
llvm-svn: 97719
2010-03-04 04:29:44 +00:00
John McCall
61076e1d87
XFAIL these tests on win32, since the win32 buildbot apparently disables all
...
targets except X86.
llvm-svn: 97718
2010-03-04 04:14:44 +00:00
Eric Christopher
45fa7e60fb
Fix __builtin_ia32_roundss and __builtin_ia32_roundsd definitions.
...
Re-enable test.
llvm-svn: 97707
2010-03-04 01:34:19 +00:00
John McCall
81d4d12504
Implement __builtin_dwarf_sp_column().
...
llvm-svn: 97700
2010-03-04 00:44:01 +00:00
Chris Lattner
eaa2778f27
fix a buildbot failure, this was passing for me because the
...
'%t' file was left around on my disk. doh.
llvm-svn: 97699
2010-03-04 00:38:16 +00:00
Chris Lattner
aabec2fb84
merge asm-2.c into asm.c, remove asm-inout.c because it is
...
XFAIL and already tracked in bugzilla.
llvm-svn: 97671
2010-03-03 21:56:57 +00:00
Chris Lattner
576def7fbe
fix PR6475, we were doing side-effecting stuff in an assert.
...
llvm-svn: 97669
2010-03-03 21:52:23 +00:00
Chris Lattner
5cc15e058b
add framework for ARM builtins, Patch by Edmund Grimley Evans!
...
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
John McCall
1629149103
Support constant-evaluation of __builtin_nans* as well as the correct constant
...
evaluation of __builtin_nan*. Most of the work to make this work is in LLVM.
Fixes <rdar://problem/7696712> and part of PR 5255.
llvm-svn: 97383
2010-02-28 13:00:19 +00:00
John McCall
8bf8ac0775
Make this test portable to ABIs that use sret.
...
llvm-svn: 97035
2010-02-24 08:14:27 +00:00
John McCall
1826980fc8
Fix test case and convert fully to FileCheck.
...
llvm-svn: 97032
2010-02-24 07:33:39 +00:00
John McCall
8ee376f08a
Canonicalize parameter and return types before computing ABI info. Eliminates
...
a common source of oddities and, in theory, removes some redundant ABI
computations. Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization; this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.
llvm-svn: 97030
2010-02-24 07:14:12 +00:00
Devang Patel
b407338fe2
Emit debug info for VectorType.
...
llvm-svn: 96999
2010-02-23 22:59:39 +00:00
Blaine Garst
dffb51bac8
fix buildbot failure on windows by slightly trimming test output to ignore temporary name
...
llvm-svn: 96998
2010-02-23 22:59:01 +00:00
Rafael Espindola
c18086ae17
Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.
...
llvm-svn: 96992
2010-02-23 22:00:30 +00:00
Blaine Garst
fc83aa04db
Unconditionally support block introspection data in a new field at the end
...
of the block descriptor field. This field is the ObjC style @encode
signature of the implementation function, and was to this point
conditionally provided in the block literal data structure. That
provisional support is removed.
Additionally, eliminate unused enumerations for the block literal flags field.
The first shipping ABI unconditionally set (1<<29) but this bit is unused
by the runtime, so the second ABI will unconditionally have (1<<30) set so
that the runtime can in fact distinguish whether the additional data is
present or not.
llvm-svn: 96989
2010-02-23 21:51:17 +00:00
Eli Friedman
d2c0de6b44
PR6386: Fix a recent regression in IRGen of cast-to-union constructs.
...
llvm-svn: 96958
2010-02-23 17:58:35 +00:00
Charles Davis
fea4845609
Allow redefinitions of extern inline functions in GNU89 mode, just as GCC
...
does. Fixes PR5253.
llvm-svn: 96553
2010-02-18 02:00:42 +00:00
Devang Patel
7585580ccc
Distinguish two lexical blocks at the same level.
...
llvm-svn: 96397
2010-02-16 21:41:20 +00:00
Charles Davis
163855f46d
dllimport and dllexport are declspec attributes, too. They're also
...
Win32-specific.
Also, fix a test to use FileCheck instead of grepping LLVM IR.
llvm-svn: 96364
2010-02-16 18:27:26 +00:00
Devang Patel
e8814ce0a6
Use getLocStart(), instead of getLocEnd(), to record starting location of objc method. :)
...
llvm-svn: 96245
2010-02-15 18:08:38 +00:00
Charles Davis
4ea31ab369
Emit the 'alignstack' LLVM function attribute when we encounter a function
...
marked 'force_align_arg_pointer'. Almost there; now all I need to do is finish
up the backend.
llvm-svn: 96100
2010-02-13 15:54:06 +00:00
Devang Patel
1b5330afe9
Use current location as the location of compiler generated arguments, e.g. self, _cmd etc.
...
llvm-svn: 95743
2010-02-10 01:09:50 +00:00
Daniel Dunbar
a7566f163a
IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
...
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!
PR6240.
llvm-svn: 95648
2010-02-09 02:48:28 +00:00
John McCall
ab26cfa58d
Standardize the parsing of function type attributes in a way that
...
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().
llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Charles Davis
2b2864c436
Convert this test to FileCheck instead of grepping LLVM IR.
...
llvm-svn: 95428
2010-02-05 20:45:48 +00:00
Charles Davis
5a5473f0f8
Now that we store calling conventions in the types, use them instead of
...
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.
llvm-svn: 95399
2010-02-05 18:13:10 +00:00
Douglas Gregor
a71cc15361
Implement promotion for enumeration types.
...
WHAT!?!
It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despite having properly computed the promotion type when the
enum was defined. Various operations on values of enum type just
"worked" because we could still compute the integer rank of an enum
type; the oddity, however, is that operations such as "add an enum and
an unsigned" would often have an enum result type (!). The bug
actually showed up as a spurious -Wformat diagnostic
(<rdar://problem/7595366>), but in theory it could cause miscompiles.
In this commit:
- Enum types with a promotion type of "int" or "unsigned int" are
promotable.
- Tweaked the computation of promotable types for enums
- For all of the ABIs, treat enum types the same way as their
underlying types (*not* their promotion types) for argument passing
and return values
- Extend the ABI tester with support for enumeration types
llvm-svn: 95117
2010-02-02 20:10:50 +00:00
Daniel Dunbar
96ebba5770
ARM/APCS: Fix classification of small complex integer types as "integer like".
...
llvm-svn: 95030
2010-02-01 23:31:26 +00:00
Daniel Dunbar
eedf151cb1
ARM/APCS: Pass Complex types following llvm-gcc.
...
llvm-svn: 95029
2010-02-01 23:31:19 +00:00
Chris Lattner
5b5d2db3f6
Don't explicitly force utf strings into the __TEXT,__ustring
...
by setting the section of the generated global. This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly
handle). This is rdar://7589850
llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Devang Patel
156b11368a
New test case.
...
llvm-svn: 94821
2010-01-29 18:32:33 +00:00
Daniel Dunbar
45c7ff1d79
ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
...
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.
llvm-svn: 94796
2010-01-29 03:22:29 +00:00
Anders Carlsson
b1ef991097
Fix an incorrect union layout assert. Fixes PR6164.
...
llvm-svn: 94754
2010-01-28 18:22:03 +00:00
Benjamin Kramer
b2abc13f28
Adjust testcase for recent DWARF printer changes.
...
llvm-svn: 94306
2010-01-23 10:14:58 +00:00
Mike Stump
92d487712e
Fix for Release-Asserts.
...
llvm-svn: 93340
2010-01-13 19:40:37 +00:00
Dan Gohman
d1e76b957b
Use -fno-math-errno by default, and remove the IsMathErrnoDefault
...
targethook, which is no longer being used. This fixes PR5971.
llvm-svn: 92987
2010-01-08 02:20:44 +00:00
Benjamin Kramer
0128f668a9
__builtin_object_size(ptr, type) returns -1 for type = {0,1} if there are any side-effects.
...
llvm-svn: 92453
2010-01-03 18:18:37 +00:00
Eli Friedman
906be1b580
Add test for annotate attribute for coverage.
...
llvm-svn: 92435
2010-01-03 00:51:58 +00:00
Eli Friedman
090adddf15
Fix minor oversight for increment/decrement of complex int. Add tests for
...
coverage.
llvm-svn: 92433
2010-01-03 00:20:48 +00:00
Eli Friedman
bb333722c1
Add a couple more tests for coverage.
...
llvm-svn: 92430
2010-01-02 23:21:40 +00:00
Eli Friedman
e14b1997db
Don't look through casts when looking for the underlying decl for a function
...
call; the standard doesn't expect us to, and the program could be doing
something crazy. Fixes PR5882.
llvm-svn: 92166
2009-12-26 03:35:45 +00:00
Chris Lattner
9ac2b586c7
fix typo
...
llvm-svn: 92065
2009-12-23 22:06:12 +00:00
Chris Lattner
4e1a323b85
fix opencl extvector element extraction on rvalues. We previously
...
error_unsupported on test10 and crashed on test11.
llvm-svn: 92056
2009-12-23 21:31:11 +00:00
Eric Christopher
c87915629b
Update for the intrinsic changes in llvm: the object size intrinsic
...
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.
llvm-svn: 91983
2009-12-23 03:49:37 +00:00
Daniel Dunbar
a7d0231b66
clang -cc1: Rename -mcpu to -target-cpu to match other target options and not alias driver/backend option.
...
llvm-svn: 91671
2009-12-18 06:30:12 +00:00
Daniel Dunbar
5618e98f33
Update tests to use %clang instead of 'clang', and forcibly disable use of '
...
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).
llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Daniel Dunbar
8fbe78f6fc
Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
...
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).
llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Fariborz Jahanian
a01b67d7b0
Make tests use the new clang -cc1 flag.
...
llvm-svn: 91303
2009-12-14 18:00:56 +00:00
Nate Begeman
67dfd4236a
Revert mmx palignr to use an intrinsic, since mmx shuffle patterns are missing.
...
llvm-svn: 91269
2009-12-14 05:15:02 +00:00
Nate Begeman
72ec6bc6f4
Support x86's PALIGNR instruction without the use of a palignr intrinsic.
...
llvm-svn: 91264
2009-12-14 04:57:03 +00:00
Eli Friedman
4f678f3de1
Fix for PR5709: use the computed type of the declaration instead of the
...
type of the builtin when generating the function declaration for a builtin
library call.
llvm-svn: 90936
2009-12-09 03:05:59 +00:00
Daniel Dunbar
f51087656d
Remove include of system header.
...
llvm-svn: 90883
2009-12-08 21:52:24 +00:00
Daniel Dunbar
888a89ccf2
Use clang-cc in this test.
...
llvm-svn: 90872
2009-12-08 19:49:40 +00:00
Mike Stump
b2a568d9e5
Switch over to checking .ll files instead of .s files.
...
llvm-svn: 90786
2009-12-07 19:22:29 +00:00
Chris Lattner
0f3a228e73
add 'F' to a bunch of libm builtins so that codegen doesn't die on them,
...
pointed out by Charles Davis.
llvm-svn: 90736
2009-12-07 02:09:14 +00:00
Chris Lattner
2da786f794
fix comment.
...
llvm-svn: 90660
2009-12-05 08:33:21 +00:00
Chris Lattner
ded98d4172
consolidate some tests.
...
llvm-svn: 90659
2009-12-05 08:30:04 +00:00
Chris Lattner
e99c110d06
implement rdar://7346691 by codegen'ing struct/array initializers
...
to a memset or a memcpy from a global when possible.
llvm-svn: 90658
2009-12-05 08:22:11 +00:00
Chris Lattner
ffcd06ea7c
simplify a condition and add a testcase.
...
llvm-svn: 90652
2009-12-05 06:49:57 +00:00
Daniel Dunbar
e97582406b
Use '-FOO' 'BAR' instead of '-FOO=BAR' for FOO in -stack-protector, -fvisibility, and -fconstant-string-class.
...
llvm-svn: 90072
2009-11-29 09:33:20 +00:00
Daniel Dunbar
4e7596cc3a
Normalize options to use '-FOO' instead of '--FOO'.
...
llvm-svn: 90071
2009-11-29 09:33:10 +00:00
Anders Carlsson
1299f36af1
Update a test to FileCheck.
...
llvm-svn: 89610
2009-11-22 18:56:40 +00:00
Ken Dyck
65da2db736
Use intptr_t from stdint.h (in freestanding mode) instead of redefining it here
...
with __INTPTR_TYPE__.
llvm-svn: 89609
2009-11-22 18:29:06 +00:00
Daniel Dunbar
c2588c3bd9
Convert test to FileCheck.
...
llvm-svn: 89514
2009-11-20 23:46:56 +00:00
Daniel Dunbar
32164f4bdb
Driver: Use '-target-abi' 'FOO' instead of '-target-abi=FOO'.
...
llvm-svn: 89501
2009-11-20 22:32:30 +00:00
Daniel Dunbar
4274685b63
Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
...
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Daniel Dunbar
9c7efbb996
Fix some codegen tests to include positive checks.
...
llvm-svn: 89465
2009-11-20 17:23:39 +00:00
Daniel Dunbar
484afa2d3b
Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm: 🆑 :init(true) arguments.
...
llvm-svn: 89315
2009-11-19 04:55:23 +00:00
Daniel Dunbar
ba0c9e8685
Remove unnecessary &&s.
...
llvm-svn: 89153
2009-11-17 22:25:07 +00:00
David Chisnall
950a9518b1
Added block type introspection support.
...
As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple.
llvm-svn: 89134
2009-11-17 19:33:30 +00:00
Daniel Dunbar
feedba68b5
Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.
...
llvm-svn: 89070
2009-11-17 08:57:36 +00:00
Daniel Dunbar
f85fabec35
Remove some redundant tests.
...
llvm-svn: 89069
2009-11-17 08:57:06 +00:00
Daniel Dunbar
4930e3357b
Add -fblocks, -stack-protector, and -fobjc-nonfragile-abi defaulting to driver,
...
instead of using getDefaultLangOptions.
- Remove unused -fobjc-tight-layout while at it.
llvm-svn: 89065
2009-11-17 08:07:36 +00:00
Jakob Stoklund Olesen
4359796e52
Fix tests after enabling -split-phi-edges.
...
object-size.c aws simply too fragile.
constructor-default-arg.cpp triggers an issue when LiveVariables is run before RALocal.
llvm-svn: 89025
2009-11-17 01:47:01 +00:00
Eli Friedman
b0bc559b19
PR5526: Make sure to set the right cast kinds for the inserted implicit casts.
...
llvm-svn: 89023
2009-11-17 01:22:05 +00:00
Eli Friedman
b210fc598f
Make __func__ and friends work correctly within the initializer for a static
...
local variable.
llvm-svn: 88766
2009-11-14 08:37:13 +00:00
Eli Friedman
6f04b1e605
Obvious fix for PR5474.
...
llvm-svn: 88696
2009-11-13 21:23:46 +00:00
Daniel Dunbar
775f18520c
And now a test fix in +Asserts mode, which I broke.
...
llvm-svn: 86801
2009-11-11 03:48:34 +00:00
Daniel Dunbar
568e302a7f
Fix some tests in -Asserts mode.
...
- FileCheck is a *huuuuge* improvement here.
- Still feels like we could use a better tool for this though, either teach
llvm-dis to spit out the FileCheck syntax, or provide another tool to turn a
.ll into a "matchable" input.
- Also on my Christmas list is better FileCheck diagnostics with missing
variables or mismatches.
llvm-svn: 86800
2009-11-11 03:48:26 +00:00
Mike Stump
68ec7ee0e8
Enable the use of the new llvm objectsize intrinsic.
...
llvm-svn: 86607
2009-11-09 22:40:09 +00:00
Daniel Dunbar
34546ce43d
Remove RUN: true lines.
...
llvm-svn: 86432
2009-11-08 01:47:25 +00:00
Daniel Dunbar
8b57697954
Eliminate &&s in tests.
...
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.
llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Chris Lattner
3f5124815d
commit test update
...
llvm-svn: 86396
2009-11-07 18:59:51 +00:00
Devang Patel
22053c0f46
MIPS linkage name confuses gdb here. Generate and test DW_AT_name here.
...
llvm-svn: 86318
2009-11-07 00:41:37 +00:00
Mike Stump
6de15a8881
Test case for recent checkin.
...
llvm-svn: 85972
2009-11-03 23:32:42 +00:00
Daniel Dunbar
a530841b4f
Switch XFAIL format to match LLVM.
...
llvm-svn: 85880
2009-11-03 07:25:45 +00:00
Benjamin Kramer
170a56f135
Add missing colons for FileCheck.
...
llvm-svn: 85683
2009-10-31 20:42:26 +00:00
Mike Stump
f3eb5ec2c0
Fix one more bug with __builtin_object_size.
...
llvm-svn: 85538
2009-10-29 23:34:20 +00:00
Mike Stump
dc28a8b997
Add yet more testcases.
...
llvm-svn: 85535
2009-10-29 23:29:54 +00:00
Mike Stump
eb5c92b399
Add some more testcases.
...
llvm-svn: 85534
2009-10-29 23:22:14 +00:00
Nuno Lopes
09bd8656c3
make clang emit undefs for padding of structs and unions instead of zeros. this enables constant compaction optimizations.
...
llvm-svn: 85504
2009-10-29 11:27:06 +00:00
Chris Lattner
08bb9ef7f7
make this interpretable.
...
llvm-svn: 85487
2009-10-29 05:25:27 +00:00
Chris Lattner
29fb551a36
make this more interesting, test the static const array.
...
llvm-svn: 85464
2009-10-29 01:20:34 +00:00
Douglas Gregor
05925031f7
Mangle based on the declaration we're given, not the canonical
...
declaration, since attributes that affect mangling may have been added
to subsequent declarations. However, to determine the linkage of the
declaration, we need to look at the canonical declaration. Fixes PR4412.
llvm-svn: 85400
2009-10-28 16:31:34 +00:00
Daniel Dunbar
c369d73405
Set OptimizeForSize LLVM function attribute with -Os.
...
llvm-svn: 85278
2009-10-27 19:48:08 +00:00
Daniel Dunbar
59ca7f1a1e
Convert test to FileCheck.
...
llvm-svn: 85277
2009-10-27 19:48:00 +00:00
Benjamin Kramer
59b7cf6a6d
Make test independent of darwin system headers.
...
llvm-svn: 85232
2009-10-27 12:19:13 +00:00
Mike Stump
5183a14bfb
__builtin_object_size refinements. Also handle stack based objects. WIP.
...
llvm-svn: 85174
2009-10-26 23:05:19 +00:00
Mike Stump
10bd7e1c5b
__builtin_object_size refinements. When we run out of object, be sure
...
to clamp at 0 bytes left. WIP.
llvm-svn: 85157
2009-10-26 21:38:39 +00:00
Edward O'Callaghan
72af806797
Convert a few tests to FileCheck for PR5307.
...
llvm-svn: 85154
2009-10-26 20:49:20 +00:00
Mike Stump
722cedfb0d
__builtin_object_size refinements. WIP.
...
llvm-svn: 85136
2009-10-26 18:35:08 +00:00
Mike Stump
9bb0059449
Add radar number.
...
llvm-svn: 84923
2009-10-23 02:13:20 +00:00
Mike Stump
ae2559a221
Fixup the return type of functions.
...
llvm-svn: 84922
2009-10-23 01:52:13 +00:00
Benjamin Kramer
53b4041151
Force triple; this test was failing on non-darwin platforms due to different
...
asm comment styles (## vs #).
llvm-svn: 84777
2009-10-21 19:59:43 +00:00
Devang Patel
e4f2b2a8ac
Encode global variable name in debug info.
...
llvm-svn: 84653
2009-10-20 18:26:30 +00:00
Nate Begeman
72eabcb5b1
Add test for OpenCL vector initializer codegen
...
llvm-svn: 84445
2009-10-18 21:04:35 +00:00
Chris Lattner
9b24e8aba6
daniel really wants this in the testsuite.
...
llvm-svn: 84354
2009-10-17 20:37:18 +00:00
John Thompson
146b025c39
Sorry! Accidentally checked in experimental change.
...
llvm-svn: 84183
2009-10-15 14:34:41 +00:00
Mike Stump
bf186694b0
Make this at least compile.
...
llvm-svn: 84167
2009-10-15 02:10:57 +00:00
John Thompson
3254182bfa
Removed math.h include, as Windows math.h has a compile error.
...
llvm-svn: 84160
2009-10-15 00:39:58 +00:00
Chris Lattner
4f8a2e22c0
fix some cfstring related issues:
...
1) -fwritable-string does affect the non-utf16 version of cfstrings
just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.
This fixes rdar://7115750
llvm-svn: 84077
2009-10-14 05:55:45 +00:00
Chris Lattner
3eb172a02b
Teach sema and codegen about the difference between address of labels,
...
which is a common idiom to improve PIC'ness of code using the addr of
label extension. This implementation is a gross hack, but the only other
alternative would be to teach evalutate about this horrid combination.
While GCC allows things like "&&foo - &&bar + 1", people don't use this
in practice. This implements PR5131.
llvm-svn: 83957
2009-10-13 07:14:16 +00:00
Chris Lattner
9842a4dcb1
merge an indirect goto test into statements, add another
...
hairier (but nonsensical) example.
llvm-svn: 83951
2009-10-13 06:52:43 +00:00
Chris Lattner
f315471e24
fix PR4938 by recognizing % as a modifier on outputs,
...
previously we only recognized it on inputs.
llvm-svn: 83939
2009-10-13 04:32:07 +00:00
Devang Patel
232f278fc1
Disable tests that check debug info intrinsic. This does not work if debug info intrinsics are not used to encode debug info.
...
llvm-svn: 83929
2009-10-12 23:46:58 +00:00
Mike Stump
f8c1f0d1f0
Speed up testing by avoiding stdio.h, also helps testing on windows.
...
Patch by John Thompson.
llvm-svn: 83593
2009-10-08 23:05:06 +00:00
Mike Stump
03686660b1
In VC++, the *printf functions put an extra "0" in the exponent part
...
of a floating point number. This add regular expressions to account
for this. Patch by John Thompson.
llvm-svn: 83581
2009-10-08 21:57:41 +00:00
Mike Stump
c2eeac617d
Convert some tests to FileCheck to be more portable. Patch by John Thompson.
...
llvm-svn: 83578
2009-10-08 21:52:07 +00:00
Mike Stump
da6822f584
Add codegen for __builtin_abort. Convert to FileCheck.
...
llvm-svn: 83427
2009-10-06 22:58:45 +00:00
Chris Lattner
78a2e6356b
remove this test, grepping for define isn't really testing anything.
...
llvm-svn: 83325
2009-10-05 21:16:22 +00:00
Benjamin Kramer
80401b96c2
FileCheckize test case.
...
llvm-svn: 83244
2009-10-02 10:32:51 +00:00
Anders Carlsson
8a744ad8a6
Don't update the struct alignment when adding fields to a packed struct. Fixes PR5118.
...
llvm-svn: 83235
2009-10-02 04:52:12 +00:00
Anders Carlsson
39e3eb12ae
When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.
...
llvm-svn: 83230
2009-10-02 02:15:20 +00:00
Douglas Gregor
3dc959f88b
Tweak CHECK lines to eliminate a failure on i686-apple-darwin10
...
llvm-svn: 83173
2009-09-30 21:39:51 +00:00
Chris Lattner
24440102aa
Convert from nonportable grep to filecheck, patch by John Thompson
...
llvm-svn: 83158
2009-09-30 19:55:07 +00:00
Anders Carlsson
e33eed5c1e
Set alignment on static function level decls and VLAs. Fixes PR5060.
...
llvm-svn: 82868
2009-09-26 18:16:06 +00:00
Daniel Dunbar
b3b1e53d33
Darwin/x86-32: Enumerated types and block pointer types in structures were not
...
handled correctly.
- <rdar://problem/7247671> Function arguments incorrect when function returns a
struct on i386 w/ llvm-g++ and clang
llvm-svn: 82681
2009-09-24 05:12:36 +00:00
Daniel Dunbar
1da76c4e58
Add ARM register names and aliases.
...
- Patch by Shantonu Sen!
<rdar://problem/6922650> clang doesn't know about ARM registers for inline asm clobber lists
llvm-svn: 82132
2009-09-17 07:03:19 +00:00
Daniel Dunbar
09d3362bf5
ARM/[A]APCS: Ignore empty records passed as arguments.
...
llvm-svn: 81798
2009-09-14 21:54:03 +00:00
Daniel Dunbar
ff0553ec61
Fix subtle bug in generating LLVM function declarations for builtin functions.
...
The decl wasn't being passed down, which meant that function attributes were not
being set correctly. This is particularly important for ARM, since it wants to
override the calling convention. Instead we would emit the builtin with the
wrong calling convention, and instcombine would come along and merrily shred all
the calls to it. :)
llvm-svn: 81756
2009-09-14 04:33:21 +00:00
Daniel Dunbar
d53bac7fa4
ARM/APCS: Don't treat structs w/ floating point types as "integer like".
...
llvm-svn: 81748
2009-09-14 02:20:34 +00:00
Daniel Dunbar
1ce7251a0a
Some minor clang/ARM/AAPCS tweaks.
...
llvm-svn: 81737
2009-09-14 00:56:55 +00:00
Daniel Dunbar
b4091a9c6a
Add TargetInfo::getABI(), and base ARM APCS vs AAPCS choice on that.
...
llvm-svn: 81735
2009-09-14 00:35:03 +00:00
Anders Carlsson
ccbabc9645
Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.
...
llvm-svn: 81681
2009-09-13 17:55:13 +00:00
Daniel Dunbar
626f1d8c3a
ARM/APCS: Only "integer like" aggregates should be returned in r0 (following
...
gcc's interpretation of APCS' somewhat loose specification).
llvm-svn: 81671
2009-09-13 08:03:58 +00:00
Douglas Gregor
299d76e901
Rework the way we determine whether an externally visible symbol is
...
generated for an inline function definition, taking into account C99
and GNU inline/extern inline semantics. This solution is simpler,
cleaner, and fixes PR4536.
llvm-svn: 81670
2009-09-13 07:46:26 +00:00
Daniel Dunbar
0482cfd790
Don't use the PredefinedExpr string as the global variable name, these don't
...
make very nice symbols, just use the function name.
llvm-svn: 81653
2009-09-12 23:06:21 +00:00
Anders Carlsson
f8e94f2008
Add support for __block variables with alignment greater than __alignof(void *).
...
llvm-svn: 81602
2009-09-12 02:44:18 +00:00
Daniel Dunbar
020daa9476
Stub out room for ARM APCS ABI implementation (and AAPCS_VFP, although you can't
...
hit this via command line options yet).
llvm-svn: 81595
2009-09-12 01:00:39 +00:00
Dan Gohman
0533ffa2a6
Update this test to expect the "inbounds" keyword, which LLVM's constant
...
folder is now automatically adding.
llvm-svn: 81491
2009-09-11 00:27:06 +00:00
Anders Carlsson
10f2c10b83
Make the forwarding member of block byref structs be a pointer to the block byref struct itself.
...
llvm-svn: 81423
2009-09-10 01:32:12 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Chris Lattner
6426345b8f
convert this to filecheck, hopefully it will fix PR4888. If nothing
...
else it will make tests run faster and make 4888 easier to diagnose.
llvm-svn: 81238
2009-09-08 18:43:45 +00:00
Anders Carlsson
2fb0824197
Vastly improve PredefinedExpr output, both in Sema and CodeGen. Patch by Sam Weinig!
...
llvm-svn: 81237
2009-09-08 18:24:21 +00:00