Fariborz Jahanian
1db5c941ad
vla expressions used in __typeof__ must be evaluated.
...
Fixes rdar://8476159.
llvm-svn: 114982
2010-09-28 20:42:35 +00:00
Fariborz Jahanian
8fb87aec78
Patch implements passing arrays to functions expecting
...
vla. Implements pr7827.
llvm-svn: 114737
2010-09-24 17:30:16 +00:00
Argyrios Kyrtzidis
719a46bbf1
Don't crash on _Imaginary.
...
llvm-svn: 114637
2010-09-23 09:40:31 +00:00
Daniel Dunbar
1fae17a8e5
Tweak test to pass -ffreestanding, to avoid platform dependent header issues.
...
llvm-svn: 114627
2010-09-23 04:40:10 +00:00
Daniel Dunbar
19964dbe3b
IRgen/ABI/ARM: Return large vectors in memory.
...
llvm-svn: 114619
2010-09-23 01:54:32 +00:00
Daniel Dunbar
b34b08098c
IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given ABI.
...
- Therefore, we can lower out the NEON wrapper structs and pass the vectors
directly. This makes a huge difference in the cleanliness of the IR after
optimization.
- I will trust, but verify, via future ABITest testing (for APCS-GNU, at
least).
llvm-svn: 114618
2010-09-23 01:54:28 +00:00
Devang Patel
f063cb49d8
Testcase for r114585.
...
llvm-svn: 114586
2010-09-22 21:13:48 +00:00
Chris Lattner
b2f659b7a0
fix the rest of rdar://8461279 - clang miscompiles address-space qualified atomics
...
llvm-svn: 114503
2010-09-21 23:40:48 +00:00
Chris Lattner
c9066d3072
same bug as before, this time with __sync_val_compare_and_swap.
...
llvm-svn: 114502
2010-09-21 23:35:30 +00:00
Chris Lattner
7cf46bfda0
fix __sync_bool_compare_and_swap to work with address-space qualified types.
...
llvm-svn: 114498
2010-09-21 23:24:52 +00:00
Chris Lattner
65dce5eeee
filecheckize.
...
llvm-svn: 114497
2010-09-21 23:22:41 +00:00
Fariborz Jahanian
521c72c756
Fixes an IRgen ICE due to cast of null pointer to
...
a vla type (fixes pr7827).
llvm-svn: 114495
2010-09-21 22:53:33 +00:00
Fariborz Jahanian
8162d4ad31
Implements in IRgen gnu extensions missing LHS for
...
complex conditionals. Radar 8453812.
llvm-svn: 114376
2010-09-20 23:50:22 +00:00
Fariborz Jahanian
2b1d88abfb
Problem with gnu conditional extension with missing
...
LHS and when conditional expression is an array. Since
it will be decayed, saved expression must be saved with
decayed expression. This is necessary to preserve semantics
of this extension (and prevent an IRGen crash which expects
an array to always be decayed). I am sure there will be other
cases in c++ (aggregate conditionals for example) when saving of the
expression must happen after some transformation on conditional
expression has happened.
Doug, please review. Fixes // rdar://8446940
llvm-svn: 114296
2010-09-18 19:38:38 +00:00
John Thompson
1224061281
Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
...
llvm-svn: 114253
2010-09-18 01:15:13 +00:00
Bill Wendling
cbacefd36f
Testcase for r114239.
...
llvm-svn: 114247
2010-09-18 00:26:29 +00:00
Daniel Dunbar
60785eb0f2
Sema/transparent_union: Make sure to add implicit cast when constructing
...
implicit union values for the transparent_union extension.
llvm-svn: 114236
2010-09-17 23:21:43 +00:00
David Chisnall
dd84ef1e62
Add a -ftrapv-handler= option which allows a handler to invoke instead of simply aborting when a signed operation overflows. This mirrors the (GCC-incompatible) behaviour from clang 1.0 and 1.1 when -ftrapv was specified, but allows the handler to be defined for each compilation unit.
...
llvm-svn: 114192
2010-09-17 18:29:54 +00:00
Argyrios Kyrtzidis
d059997000
Use a temporary file for output which gets renamed after all the writing is finished.
...
This mainly prevents failures and/or crashes when multiple processes try to read/write the same PCH file. (rdar://8392711&8294781); suggestion & review by Daniel!
llvm-svn: 114187
2010-09-17 17:38:48 +00:00
Daniel Dunbar
dd38fbc7fb
IRgen/ABI/x86-32: Realign indirect arguments when the ABI requires us to pass
...
them with a smaller alignment than the rest of codegen expects.
llvm-svn: 114115
2010-09-16 20:42:06 +00:00
Daniel Dunbar
ed23de3348
IRgen/ABI/x86_32/Darwin: On Darwin, only structures with SSE vector types get passed
...
with a non-default-stack-ABI-alignment (of 16).
- This fixes the ABI convenient, but breaks codegen since we now have
underaligned arguments. Marginal improvement overall though, and will be
fixed in next commit.
llvm-svn: 114113
2010-09-16 20:42:00 +00:00
Daniel Dunbar
8a6c91ff76
IRgen/x86_32/Linux: Linux seems to align all stack objects to 4 bytes, unlike
...
Darwin. Checked vs the handiest Linux llvm-gcc I had around, someone on Linux is
welcome to investigate more.
llvm-svn: 114112
2010-09-16 20:41:56 +00:00
Devang Patel
28b5286bda
While handling change of file, check if _current_ file is already seen or not. If current file is seen then it indicates that end of previous file's lexical scope.
...
This fixes radar 8396182.
llvm-svn: 114018
2010-09-15 20:50:40 +00:00
Jakob Stoklund Olesen
f7c67d9f46
Revert "Clean up in buildbot directories."
...
This reverts commit 113814.
This patch was never intended to stay in the repository. If you are reading this
from the future, we apologize for the noise.
llvm-svn: 113990
2010-09-15 18:08:14 +00:00
Benjamin Kramer
6cbfca121b
Tweak regex not to accidentally match a trailing \r.
...
llvm-svn: 113966
2010-09-15 12:31:46 +00:00
Cameron Esfahani
70004ec456
Fix pointer-signext.c test case: it was relying on value names, which don't appear in the non-assert build. Switch to using check-next as well.
...
llvm-svn: 113964
2010-09-15 10:52:02 +00:00
Cameron Esfahani
eb85650e67
Fix Windows64 target info so pointer arithmetic is done correctly, and no sign extension code is emitted: PtrDiffType needs to be a signed long long. Add a corresponding test case.
...
llvm-svn: 113910
2010-09-15 00:28:12 +00:00
Argyrios Kyrtzidis
9efa1ce145
Fix VLA miscompilation.
...
llvm.stacksave/llvm.stackrestore wasn't emitted for VLAs in inner scopes.
Fixes r8403108.
llvm-svn: 113822
2010-09-14 00:42:34 +00:00
Jakob Stoklund Olesen
54481e5948
Clean up in buildbot directories.
...
This test created a statements.ll file until about a month ago. Some buildbots
still have this file in their source dir. This is the easiest way to remove the
file on all bots. Then I'll revert.
llvm-svn: 113814
2010-09-13 23:26:28 +00:00
Eric Christopher
26c045d9ff
Try to get this to stop leaving a temporary file on linux.
...
llvm-svn: 113793
2010-09-13 21:51:42 +00:00
Abramo Bagnara
3aabb4b452
Congruent diagnostic for void* arithmetic.
...
llvm-svn: 113740
2010-09-13 06:50:07 +00:00
Fariborz Jahanian
56603ef7b2
Have Sema check for validity of CGString literal
...
instead of asserting in IRGen. Fixes radar 8390459.
llvm-svn: 113253
2010-09-07 19:38:13 +00:00
Dale Johannesen
2002e1f1bf
Adjust a test that's expecting optimizations to be done
...
on MMX palignr; we don't do this for the intrinsics.
llvm-svn: 113234
2010-09-07 18:11:53 +00:00
Chris Lattner
03483613c2
Due to asmparser improvements, this error message is now better
...
llvm-svn: 113177
2010-09-06 22:09:27 +00:00
Chris Lattner
52bcf96384
move the hackaround for PR6537 to catch unions as well,
...
fixing the ICE in PR7151
llvm-svn: 113130
2010-09-06 00:13:11 +00:00
Eli Friedman
0b1fbd1394
PR7242: Make sure to use a different context for evaluating constant
...
initializers, so the result of the evaluation doesn't leak through
inconsistently. Also, don't evaluate references to variables with
initializers with side-effects.
llvm-svn: 113128
2010-09-06 00:10:32 +00:00
John McCall
56f57589af
A constant initializer never matches the type of the variable it's
...
initializing; it at best matches the element type of the variable
it's initializing. Fixes PR8073.
llvm-svn: 112992
2010-09-03 18:58:50 +00:00
Daniel Dunbar
2f8df98c92
IRgen: Fix silly thinko in r112021, which was generating code for the same expr
...
twice. This showed up as an assert on the odd test case because we generated the
decl map entry twice.
llvm-svn: 112943
2010-09-03 02:07:00 +00:00
Chris Lattner
369721a16e
stop looking for #uses comments.
...
llvm-svn: 112898
2010-09-02 22:48:26 +00:00
Chris Lattner
60c160ff4d
remove some tests that aren't adding any value: the check lines don't
...
make it clear what they're testing so there is no way to know it's right
or to update it.
llvm-svn: 112897
2010-09-02 22:43:55 +00:00
Bill Wendling
e6fd79bc1c
Newline at end of file.
...
llvm-svn: 112871
2010-09-02 22:07:07 +00:00
Duncan Sands
7f1982731e
Correct this test for the fact that the number of uses is now printed
...
in a comment.
llvm-svn: 112813
2010-09-02 08:52:56 +00:00
Chris Lattner
a48fbe8c53
Fix PR8029, a x86-32 ABI regression in introduced in r112211
...
llvm-svn: 112537
2010-08-30 22:03:23 +00:00
Chris Lattner
07b71c4eb1
add radar #
...
llvm-svn: 112212
2010-08-26 20:05:48 +00:00
Chris Lattner
d774ae9ed1
fix 2xi16 to pass as i32 instead of <2 x i16>. The former passes in
...
memory (as required) the later now passes in an xmm register. This
fixes gcc.dg/compat/vector_1 on x86-32.
llvm-svn: 112211
2010-08-26 20:05:13 +00:00
Chris Lattner
69e683fb35
vector of long and ulong are also classified as INTEGER in x86-64 abi,
...
this fixes rdar://8358475 a failure of the gcc.dg/compat/vector_1 abi
test.
llvm-svn: 112205
2010-08-26 18:13:50 +00:00
Chris Lattner
46830f2fd6
1 x ulonglong needs to be classified as INTEGER, just like 1 x longlong,
...
this fixes a miscompilation on the included testcase, rdar://8359248
llvm-svn: 112201
2010-08-26 18:03:20 +00:00
Chris Lattner
51e1cc2fe2
tame an assertion, fixing rdar://8357396
...
llvm-svn: 112174
2010-08-26 06:28:35 +00:00
Argyrios Kyrtzidis
1f5cfb6446
Revert r112043, static volatiles are removed by the optimizer. Thanks Chris!
...
llvm-svn: 112112
2010-08-25 23:42:51 +00:00
Chris Lattner
9f8b451876
Finally pass "two floats in a 64-bit unit" as a <2 x float> instead of
...
as a double in the x86-64 ABI. This allows us to generate much better
code for certain things, e.g.:
_Complex float f32(_Complex float A, _Complex float B) {
return A+B;
}
Used to compile into (look at the integer silliness!):
_f32: ## @f32
## BB#0: ## %entry
movd %xmm1, %rax
movd %eax, %xmm1
movd %xmm0, %rcx
movd %ecx, %xmm0
addss %xmm1, %xmm0
movd %xmm0, %edx
shrq $32, %rax
movd %eax, %xmm0
shrq $32, %rcx
movd %ecx, %xmm1
addss %xmm0, %xmm1
movd %xmm1, %eax
shlq $32, %rax
addq %rdx, %rax
movd %rax, %xmm0
ret
Now we get:
_f32: ## @f32
movdqa %xmm0, %xmm2
addss %xmm1, %xmm2
pshufd $16, %xmm2, %xmm2
pshufd $1, %xmm1, %xmm1
pshufd $1, %xmm0, %xmm0
addss %xmm1, %xmm0
pshufd $16, %xmm0, %xmm1
movdqa %xmm2, %xmm0
unpcklps %xmm1, %xmm0
ret
and compile stuff like:
extern float _Complex ccoshf( float _Complex ) ;
float _Complex ccosf ( float _Complex z ) {
float _Complex iz;
(__real__ iz) = -(__imag__ z);
(__imag__ iz) = (__real__ z);
return ccoshf(iz);
}
into:
_ccosf: ## @ccosf
## BB#0: ## %entry
pshufd $1, %xmm0, %xmm1
xorps LCPI4_0(%rip), %xmm1
unpcklps %xmm0, %xmm1
movaps %xmm1, %xmm0
jmp _ccoshf ## TAILCALL
instead of:
_ccosf: ## @ccosf
## BB#0: ## %entry
movd %xmm0, %rax
movq %rax, %rcx
shlq $32, %rcx
shrq $32, %rax
xorl $-2147483648, %eax ## imm = 0xFFFFFFFF80000000
addq %rcx, %rax
movd %rax, %xmm0
jmp _ccoshf ## TAILCALL
There is still "stuff to be done" here for the struct case,
but this resolves rdar://6379669 - [x86-64 ABI] Pass and return
_Complex float / double efficiently
llvm-svn: 112111
2010-08-25 23:39:14 +00:00
Argyrios Kyrtzidis
b50a088122
Make sure volatile variables are emitted even if static. Fixes rdar://8315219
...
llvm-svn: 112043
2010-08-25 10:15:24 +00:00
Daniel Dunbar
ead6824c3c
IRgen: Fix a horrible bug in pointer to bool conversion, which we were treating
...
as a truncation not a comparison to null.
llvm-svn: 112021
2010-08-25 03:32:38 +00:00
Devang Patel
356e3e0c6a
Fix 'for' loop variables' scope.
...
llvm-svn: 112002
2010-08-25 00:28:56 +00:00
Dale Johannesen
46742a4771
Add some missing X86-specific asm constraint letters, and fix
...
some bugs in setting allowsRegister on the ones there.
8348447.
llvm-svn: 111980
2010-08-24 22:33:12 +00:00
Devang Patel
41c2097058
Emit debug info for enum constants.
...
llvm-svn: 111852
2010-08-23 22:07:25 +00:00
John McCall
614dbdcd55
Go back to asking CodeGenTypes whether a type is zero-initializable.
...
Make CGT defer to the ABI on all member pointer types.
This requires giving CGT a handle to the ABI.
It's way easier to make that work if we avoid lazily creating the ABI.
Make it so.
llvm-svn: 111786
2010-08-22 21:01:12 +00:00
Benjamin Kramer
1e0cb91249
Avoid including mm_malloc.h in a cc1 test, it pulls in system headers.
...
llvm-svn: 111738
2010-08-21 13:39:38 +00:00
John McCall
fed68df76c
This test needs a triple: it's checking the alignment of a pointer in bytes.
...
llvm-svn: 111727
2010-08-21 04:58:16 +00:00
Daniel Dunbar
5c816378f8
IRgen: Set the alignment correctly when creating LValue for a decls.
...
- Fixes PR5598.
- Review appreciated.
llvm-svn: 111726
2010-08-21 04:20:22 +00:00
Daniel Dunbar
30eb5fa3ba
Improve test coverage.
...
llvm-svn: 111712
2010-08-21 02:46:28 +00:00
Chris Lattner
9052c35479
fix some vector extractions to return properly zero extended values
...
(instead of sign extending) to match ICC. GCC is changing this in
a series of their own PRs (e.g. 41323).
llvm-svn: 111637
2010-08-20 16:08:33 +00:00
Anton Yartsev
583a1cf7b5
support for predicates with bool/pixel arguments
...
llvm-svn: 111515
2010-08-19 11:57:49 +00:00
Anton Yartsev
fc83c60755
support for the rest of AltiVec functions with bool/pixel arguments and return values (except predicates)
...
llvm-svn: 111511
2010-08-19 03:21:36 +00:00
Anton Yartsev
9e96898032
support for vec_perm and all dependent functions (vec_mergeh, vec_mergel, vec_pack, vec_sld, vec_splat) with bool/pixel arguments and return values
...
llvm-svn: 111509
2010-08-19 03:00:09 +00:00
Anton Yartsev
2cc136d4e3
support for vec_add, vec_adds, vec_and, vec_andc with bool arguments
...
llvm-svn: 111141
2010-08-16 16:22:12 +00:00
Fariborz Jahanian
f7f020bb2a
Make use of __func__ in a block actually refer to
...
block's helper function. Fixes radar 7860965.
llvm-svn: 110988
2010-08-13 00:19:55 +00:00
Devang Patel
a3025fcd45
update test to reflect r110876 change.
...
llvm-svn: 110884
2010-08-12 00:00:41 +00:00
John McCall
5996699834
Revise r110163: don't mark weak functions nounwind, because the optimizer
...
treats that as a contract to be fulfilled by any replacements.
llvm-svn: 110864
2010-08-11 22:38:33 +00:00
Bruno Cardoso Lopes
762e401911
Remove rsqrtps_nr256 and sqrtps_nr256 builtins, at least until we need them
...
llvm-svn: 110844
2010-08-11 19:18:36 +00:00
Daniel Dunbar
9034aa36c7
ARM: Recognize single precision float register names.
...
- We don't recognize double or NEON register names yet -- we don't have the
infrastructure to generate the right clobbers for them.
llvm-svn: 110775
2010-08-11 02:17:20 +00:00
Daniel Dunbar
256e1f3ad0
ARM: Swap which registers we consider real / aliases to match LLVM and llvm-gcc.
...
llvm-svn: 110774
2010-08-11 02:17:11 +00:00
Bruno Cardoso Lopes
65954ffc69
Remove 256-bit cast built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
...
llvm-svn: 110771
2010-08-11 02:14:38 +00:00
Bruno Cardoso Lopes
a4f1930b75
Remove 256-bit unpack built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
...
llvm-svn: 110768
2010-08-11 01:43:24 +00:00
Bruno Cardoso Lopes
e712a135b7
Remove 256-bit shuffle built-ins and make the AVX intrinsic call llvm __builtin_shufflevector with the appropriate arguments
...
llvm-svn: 110766
2010-08-11 01:17:34 +00:00
John Thompson
307c2729fd
Something's wrong with this test on other platforms. I'll probably need to simplify it later. For now revert.
...
llvm-svn: 110738
2010-08-10 22:04:00 +00:00
John Thompson
a5c7d706b8
Slightly revised handling of mult-alt constraints, to avoid an assert, until we have the full fix.
...
llvm-svn: 110706
2010-08-10 19:20:14 +00:00
Devang Patel
76e3b53541
Do not use DIGlobalVariable to emit debugging information for enums.
...
llvm-svn: 110697
2010-08-10 18:27:15 +00:00
Devang Patel
e03edfd3e7
Even if a constant's evaluated value is used, emit debug info for the constant variable.
...
llvm-svn: 110660
2010-08-10 07:24:25 +00:00
Bruno Cardoso Lopes
3d3fc1d075
Make replicate intrinsics use shufflevector instead of dup builtins, also remove the dup builtins
...
llvm-svn: 110646
2010-08-10 02:23:54 +00:00
Devang Patel
2210aa2eca
There is no need to pubish file static variable's name. Do not rely on this code gen bug to check whether debug info is generated for such variables or not.
...
llvm-svn: 110640
2010-08-10 01:36:24 +00:00
Eric Christopher
6ff7161d51
Thread local variables aren't considered common linkage.
...
llvm-svn: 110530
2010-08-08 01:37:14 +00:00
Chris Lattner
8139c98cf9
Correct -ftrapv to trap on errors, instead of calling the
...
__overflow_handler entrypoint that David Chisnall made up.
Calling __overflow_handler is not part of the contract of
-ftrapv provided by GCC, and should never have been checked
in in the first place.
According to:
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/8699
David is using this for some of arbitrary precision integer stuff
or something, which is not an appropriate thing to implement on
this.
llvm-svn: 110490
2010-08-07 00:20:46 +00:00
Chandler Carruth
66ce9651f1
Prevent these tests from dirtying the tree with output files that aren't even
...
used for the test.
llvm-svn: 110431
2010-08-06 05:29:57 +00:00
Bruno Cardoso Lopes
e2538c4ecf
We don't want to support built-ins which aren't needed by the intrinsics. Remove them
...
llvm-svn: 110399
2010-08-05 23:47:43 +00:00
John McCall
a9731a4179
Fix a major bug with -ftrapv and ++/--. Patch by David Keaton!
...
llvm-svn: 110347
2010-08-05 17:39:44 +00:00
Eli Friedman
d986fc8b48
Tests for #pragma GCC visibility.
...
llvm-svn: 110316
2010-08-05 07:00:53 +00:00
Bruno Cardoso Lopes
6586724f71
Add more AVX 256-bit intrinsics and test cases for them
...
llvm-svn: 110178
2010-08-04 01:11:26 +00:00
John McCall
f8280e723d
Fix a warning on a test.
...
llvm-svn: 110165
2010-08-03 22:49:45 +00:00
John McCall
8601a75118
Do a very simple pass over every function we emit to infer whether we can
...
mark it nounwind based on whether it contains any non-nounwind calls.
<rdar://problem/8087431>
llvm-svn: 110163
2010-08-03 22:46:07 +00:00
Bruno Cardoso Lopes
1f927ccaa2
Support x86 AVX 256-bit instructions built-ins. Right now support all of them, but
...
as soon as we properly codegen the simple vector operations, remove the
unnecessary built-ins/intrinsics from clang and llvm. Also add tests for the new
built-ins
llvm-svn: 110096
2010-08-03 01:57:18 +00:00
John McCall
a95172baa0
Only run the jump-checker if there's a branch-protected scope *and* there's
...
a switch or goto somewhere in the function. Indirect gotos trigger the
jump-checker regardless, because the conditions there are slightly more
elaborate and it's too marginal a case to be worth optimizing.
Turns off the jump-checker in a lot of cases in C++. rdar://problem/7702918
llvm-svn: 109962
2010-08-01 00:26:45 +00:00
Daniel Dunbar
b8cba97cde
There is no reason for this test to invoke 'llc'.
...
llvm-svn: 109847
2010-07-30 03:30:55 +00:00
Chris Lattner
7f4b81af7a
fix rdar://8251384, another case where we could access beyond the
...
end of a struct. This improves the case when the struct being passed
contains 3 floats, either due to a struct or array of 3 things. Before
we'd generate this IR for the testcase:
define float @bar(double %X.coerce0, double %X.coerce1) nounwind {
entry:
%X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2]
%0 = bitcast %struct.foof* %X to %1* ; <%1*> [#uses=2]
%1 = getelementptr %1* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %X.coerce0, double* %1
%2 = getelementptr %1* %0, i32 0, i32 1 ; <double*> [#uses=1]
store double %X.coerce1, double* %2
%tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
%tmp1 = load float* %tmp ; <float> [#uses=1]
ret float %tmp1
}
which compiled (with optimization) to:
_bar: ## @bar
## BB#0: ## %entry
movd %xmm1, %rax
movd %eax, %xmm0
ret
Now we produce:
define float @bar(double %X.coerce0, float %X.coerce1) nounwind {
entry:
%X = alloca %struct.foof, align 8 ; <%struct.foof*> [#uses=2]
%0 = bitcast %struct.foof* %X to %0* ; <%0*> [#uses=2]
%1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %X.coerce0, double* %1
%2 = getelementptr %0* %0, i32 0, i32 1 ; <float*> [#uses=1]
store float %X.coerce1, float* %2
%tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
%tmp1 = load float* %tmp ; <float> [#uses=1]
ret float %tmp1
}
and:
_bar: ## @bar
## BB#0: ## %entry
movaps %xmm1, %xmm0
ret
llvm-svn: 109776
2010-07-29 18:13:09 +00:00
Chris Lattner
3f76342cfc
handle a case where we could access off the end of a function
...
that Eli pointed out, rdar://8249586
llvm-svn: 109762
2010-07-29 17:34:39 +00:00
Chris Lattner
44f9c3b3f1
in release mode, irbuilder doesn't add names to instructions,
...
this will hopefully fix the osuosl clang-i686-darwin10 builder.
llvm-svn: 109760
2010-07-29 17:14:05 +00:00
Chris Lattner
98076a25ce
This is a little bit far, but optimize cases like:
...
struct a {
struct c {
double x;
int y;
} x[1];
};
void foo(struct a A) {
}
into:
define void @foo(double %A.coerce0, i32 %A.coerce1) nounwind {
entry:
%A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1]
%0 = bitcast %struct.a* %A to %struct.c* ; <%struct.c*> [#uses=2]
%1 = getelementptr %struct.c* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %A.coerce0, double* %1
%2 = getelementptr %struct.c* %0, i32 0, i32 1 ; <i32*> [#uses=1]
store i32 %A.coerce1, i32* %2
instead of:
define void @foo(double %A.coerce0, i64 %A.coerce1) nounwind {
entry:
%A = alloca %struct.a, align 8 ; <%struct.a*> [#uses=1]
%0 = bitcast %struct.a* %A to %0* ; <%0*> [#uses=2]
%1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %A.coerce0, double* %1
%2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %A.coerce1, i64* %2
I only do this now because I never want to look at this code again :)
llvm-svn: 109738
2010-07-29 07:43:55 +00:00
Chris Lattner
c8b7b53a1e
implement a todo: pass a eight-byte that consists of a
...
small integer + padding as that small integer. On code
like:
struct c { double x; int y; };
void bar(struct c C) { }
This means that we compile to:
define void @bar(double %C.coerce0, i32 %C.coerce1) nounwind {
entry:
%C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=2]
%0 = getelementptr %struct.c* %C, i32 0, i32 0 ; <double*> [#uses=1]
store double %C.coerce0, double* %0
%1 = getelementptr %struct.c* %C, i32 0, i32 1 ; <i32*> [#uses=1]
store i32 %C.coerce1, i32* %1
instead of:
define void @bar(double %C.coerce0, i64 %C.coerce1) nounwind {
entry:
%C = alloca %struct.c, align 8 ; <%struct.c*> [#uses=3]
%0 = bitcast %struct.c* %C to %0* ; <%0*> [#uses=2]
%1 = getelementptr %0* %0, i32 0, i32 0 ; <double*> [#uses=1]
store double %C.coerce0, double* %1
%2 = getelementptr %0* %0, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %C.coerce1, i64* %2
which gives SRoA heartburn.
This implements rdar://5711709, a nice low number :)
llvm-svn: 109737
2010-07-29 07:30:00 +00:00
Chris Lattner
fe34c1d53e
Kill off the 'coerce' ABI passing form. Now 'direct' and 'extend' always
...
have a "coerce to" type which often matches the default lowering of Clang
type to LLVM IR type, but the coerce case can be handled by making them
not be the same.
This simplifies things and fixes issues where X86-64 abi lowering would
return coerce after making preferred types exactly match up. This caused
us to compile:
typedef float v4f32 __attribute__((__vector_size__(16)));
v4f32 foo(v4f32 X) {
return X+X;
}
into this code at -O0:
define <4 x float> @foo(<4 x float> %X.coerce) nounwind {
entry:
%retval = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2]
%coerce = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=2]
%X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3]
store <4 x float> %X.coerce, <4 x float>* %coerce
%X = load <4 x float>* %coerce ; <<4 x float>> [#uses=1]
store <4 x float> %X, <4 x float>* %X.addr
%tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1]
store <4 x float> %add, <4 x float>* %retval
%0 = load <4 x float>* %retval ; <<4 x float>> [#uses=1]
ret <4 x float> %0
}
Now we get:
define <4 x float> @foo(<4 x float> %X) nounwind {
entry:
%X.addr = alloca <4 x float>, align 16 ; <<4 x float>*> [#uses=3]
store <4 x float> %X, <4 x float>* %X.addr
%tmp = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%tmp1 = load <4 x float>* %X.addr ; <<4 x float>> [#uses=1]
%add = fadd <4 x float> %tmp, %tmp1 ; <<4 x float>> [#uses=1]
ret <4 x float> %add
}
This implements rdar://8248065
llvm-svn: 109733
2010-07-29 06:26:06 +00:00
Chris Lattner
9fa15c3608
ignore structs that wrap vectors in IR, the abstraction shouldn't add penalty.
...
Before we'd compile the example into something like:
%coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1]
%1 = bitcast <4 x float>* %coerce.dive2 to <2 x double>* ; <<2 x double>*> [#uses=1]
%2 = load <2 x double>* %1, align 1 ; <<2 x double>> [#uses=1]
ret <2 x double> %2
Now we produce:
%coerce.dive2 = getelementptr %struct.v4f32wrapper* %retval, i32 0, i32 0 ; <<4 x float>*> [#uses=1]
%0 = load <4 x float>* %coerce.dive2, align 1 ; <<4 x float>> [#uses=1]
ret <4 x float> %0
llvm-svn: 109732
2010-07-29 05:02:29 +00:00
Chris Lattner
4200fe4e50
move the 'pretty 16-byte vector' inferring code up to be shared
...
with return values, improving stuff that returns __m128 etc.
llvm-svn: 109731
2010-07-29 04:56:46 +00:00