summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
Commit message (Collapse)AuthorAgeFilesLines
* Test case for llvm r110712.Devang Patel2010-08-101-0/+8
| | | | llvm-svn: 110713
* When initializing a static local, pop the guard-abort EH cleanup afterJohn McCall2010-08-101-1/+1
| | | | | | the variable is fully initialized. llvm-svn: 110704
* Inline a special case of EmitAggregateCopy into EmitNullInitializationJohn McCall2010-08-071-0/+18
| | | | | | | | | to avoid the awesome-but-wrong-in-this-case assertion in the canon EAC. Fixes PR7834. Also fix a subtle address-space bug in the memset path. llvm-svn: 110511
* Don't crash when mangling empty anonymous unions. We never actually *need*John McCall2010-08-051-0/+11
| | | | | | | these, but it's convenient to mangle them when deferring them (in the 99.99% case where it's not an anonymous union, of course). llvm-svn: 110381
* It turns out that linkers (at least, the Darwin linker) don't necessarilyJohn McCall2010-08-054-11/+11
| | | | | | | | | | | do the right thing with mixed-visibility symbols, so disable the visibility optimization where that's possible, i.e. with template classes (since it's possible that an arbitrary template might be subject to an explicit instantiation elsewhere). 447.dealII actually does this. I've put the code under an option that's currently not hooked up to anything. llvm-svn: 110374
* Tests for #pragma GCC visibility.Eli Friedman2010-08-051-0/+72
| | | | llvm-svn: 110316
* Extend the visibility-hidden optimization to linkonce_odr thunks forJohn McCall2010-08-041-1/+14
| | | | | | | | | functions with in-line definitions, since such thunks will be emitted at any use of the function. Completes the feature work for rdar://problem/7523229. llvm-svn: 110285
* Emit standard-library RTTI with external linkage, not weak_odr.John McCall2010-08-044-72/+89
| | | | | | | | | | Apply hidden visibility to most RTTI; libstdc++ does not rely on exact pointer equality for the type info (just the type info names). Apply the same optimization to RTTI that we do to vtables. Fixes PR5962. llvm-svn: 110192
* Extend the hidden-visibility vtables optimization to template classes thatJohn McCall2010-08-043-8/+16
| | | | | | haven't been explicitly instantiated. llvm-svn: 110189
* Do a very simple pass over every function we emit to infer whether we canJohn McCall2010-08-031-1/+1
| | | | | | | mark it nounwind based on whether it contains any non-nounwind calls. <rdar://problem/8087431> llvm-svn: 110163
* Emit weak vtables of non-template classes with hidden visibility.John McCall2010-08-034-7/+17
| | | | llvm-svn: 110107
* Emit global destructors even if the destroyed object has no initializers or hasJohn McCall2010-07-301-2/+17
| | | | | | | | an initializer requiring temporary object disposal. Fixes rdar:://problem/8246444. llvm-svn: 109849
* fix PR5179 and correctly fix PR5831 to not miscompile.Chris Lattner2010-07-303-6/+21
| | | | | | | | | | | | | | | | | | | | The X86-64 ABI code didn't handle the case when a struct would get classified and turn up as "NoClass INTEGER" for example. This is perfectly possible when the first slot is all padding (e.g. due to empty base classes). In this situation, the first 8-byte doesn't take a register at all, only the second 8-byte does. This fixes this by enhancing the x86-64 abi stuff to allow and handle this case, reverts the broken fix for PR5831, and enhances the target independent stuff to be able to handle an argument value in registers being accessed at an offset from the memory value. This is the last x86-64 calling convention related miscompile that I'm aware of. llvm-svn: 109848
* fix PR7742 / rdar://8250764, a miscompilation of structChris Lattner2010-07-291-0/+16
| | | | | | | | | | | return where the struct has a base but no fields. This was because the x86-64 abi logic was checking the wrong predicate in one place. This was introduced in r91874, which was a fix for PR5831, which lacked a CHECK line, so I verified and added it. llvm-svn: 109759
* Kill off the 'coerce' ABI passing form. Now 'direct' and 'extend' alwaysChris Lattner2010-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* PR7736: Make sure to mark &Class::Member correctly as being type-dependentEli Friedman2010-07-281-0/+18
| | | | | | inside a template class. llvm-svn: 109697
* When creating a jump destination, its scope should be the scope of theJohn McCall2010-07-281-0/+35
| | | | | | | | | enclosing normal cleanup, not the top of the EH stack. I'm *really* surprised this hasn't been causing more problems. Fixes rdar://problem/8231514. llvm-svn: 109569
* Test for the presence of EH branch-throughs instead of normal branch-throughs.John McCall2010-07-261-0/+18
| | | | | | I knew this code duplication would bite me. llvm-svn: 109463
* Mangle enum constant expressions. Fixes rdar://problem/8204122John McCall2010-07-241-0/+11
| | | | llvm-svn: 109315
* turn down the logical bitwise confusion warning to not warn Chris Lattner2010-07-241-1/+1
| | | | | | | | | when the RHS of the ||/&& is ever 0 or 1. This handles a variety of creative idioms for "true" used in C programs and fixes many false positives at the expense of a few false negatives. This fixes rdar://8230351. llvm-svn: 109314
* Revise cleanup IR generation to fix a major bug with cleanups (PR7686)John McCall2010-07-232-8/+79
| | | | | | | as well as some significant asymptotic inefficiencies with threading multiple jumps through deep cleanups. llvm-svn: 109274
* Implement proper base/member destructor EH chaining.John McCall2010-07-211-1/+47
| | | | llvm-svn: 108989
* Convert the EH cleanups for base and member destructors in a constructor intoJohn McCall2010-07-211-5/+5
| | | | | | lazy cleanups. llvm-svn: 108978
* Implement zero-initialization for array new when there is anDouglas Gregor2010-07-211-4/+38
| | | | | | | | | initializer of (). Make sure to use a simple memset() when we can, or fall back to generating a loop when a simple memset will not suffice. Fixes <rdar://problem/8212208>, a regression due to my work in r107857. llvm-svn: 108977
* Fix the IR generation for catching pointers by references.John McCall2010-07-201-0/+41
| | | | | | Fixes <rdar://problem/8212123>. llvm-svn: 108944
* in 'new int[4]', constant fold the 4*4=16 instead of Chris Lattner2010-07-201-0/+1
| | | | | | doing an overflow check. llvm-svn: 108943
* don't demand names to be on IR.Chris Lattner2010-07-201-3/+2
| | | | llvm-svn: 108937
* temporarily disable this to fix the build bot.Chris Lattner2010-07-201-1/+0
| | | | llvm-svn: 108936
* Follow the implementation approach suggested by PR6687,Chris Lattner2010-07-201-4/+3
| | | | | | | | | | | | | | | | | | | | | | which generates more efficient and more obviously conformant code. We now test for overflow of the multiply then force the result to -1 if so. On X86, this generates nice code like this: __Z4testl: ## @_Z4testl ## BB#0: ## %entry subl $12, %esp movl $4, %eax mull 16(%esp) testl %edx, %edx movl $-1, %ecx cmovel %eax, %ecx movl %ecx, (%esp) call __Znam addl $12, %esp ret llvm-svn: 108927
* Print template argument names for template class.Devang Patel2010-07-201-0/+9
| | | | llvm-svn: 108916
* implement rdar://5739832 - operator new should check for overflow in multiply,Chris Lattner2010-07-201-2/+16
| | | | | | | | | | | | | | | | | | | | causing clang to compile this code into something that correctly throws a length error, fixing a potential integer overflow security attack: void *test(long N) { return new int[N]; } int main() { test(1L << 62); } We do this even when exceptions are disabled, because it is better for the code to abort than for the attack to succeed. This is heavily based on a patch that Fariborz wrote. llvm-svn: 108915
* Adjust test for float printing differences. Windows uses three digits for ↵Benjamin Kramer2010-07-191-6/+6
| | | | | | the exponent, everyone else two. llvm-svn: 108693
* Fix mangling for static member variables of classes inside an extern "C"Eli Friedman2010-07-181-0/+11
| | | | | | | linkage specification. Not sure if this is the ideal fix, but I'm reasonably sure it's correct vs. gcc. llvm-svn: 108656
* Fix crash initializing a bit-field with a non-constant in a place where weEli Friedman2010-07-171-0/+5
| | | | | | try to evaluate the initializer as a constant. llvm-svn: 108632
* When deferring the emission of declarations with initializers in C++, rememberJohn McCall2010-07-151-0/+22
| | | | | | | the order they appeared in the translation unit. If they get emitted, put them in their proper order. Fixes rdar://problem/7458115 llvm-svn: 108477
* Reinstate the scalar-cast-to-const-reference improvements, this timeDouglas Gregor2010-07-151-0/+170
| | | | | | | | | with the proper spelling of "non-class prvalue". Silly me, I think class rvalues were xvalues rather than prvalues! Hah hah hah. llvm-svn: 108443
* Revert r108431 and r108433 (the cast-to-const-reference fixes), whichDouglas Gregor2010-07-151-170/+0
| | | | | | broke nightlytest. llvm-svn: 108439
* Revert 108220 and subsequent patch. Devang Patel2010-07-151-20/+0
| | | | | | This is not required (I am not 100% sure why) but method.exp from gdb testsuite flagged regression due to this patch. llvm-svn: 108434
* Teach CodeGenFunction::EmitCastLValue() to handle casts to an lvalueDouglas Gregor2010-07-151-0/+170
| | | | | | | | that involve binding a reference to a pure rvalue temporary (e.g., not a class temporary), by creating a new temporary and copying the result there. Fixes PR6024. llvm-svn: 108431
* Add lvalue-bitcast support for complex numbers.Douglas Gregor2010-07-141-0/+49
| | | | llvm-svn: 108363
* Fix the mangling of template template arguments, which do not alwaysJohn McCall2010-07-141-1/+12
| | | | | | | | follow <name>; instead they follow <type>, which has <name> as a subset. Fixes PR7446. llvm-svn: 108326
* Add missing testcases for lvalue bitcastsDouglas Gregor2010-07-131-0/+114
| | | | llvm-svn: 108296
* Allow for the possibility that __cxa_end_catch might throw for a catch-all blockJohn McCall2010-07-131-4/+36
| | | | | | | or a catch of a record type by value or reference. Also convert this to a lazy cleanup. llvm-svn: 108287
* Switch the __cxa_free_exception cleanup to be lazy.John McCall2010-07-131-3/+0
| | | | llvm-svn: 108276
* Teach IR generation how to lazily emit cleanups. This has a lot of advantages,John McCall2010-07-132-16/+17
| | | | | | | | | | | | | | | mostly in avoiding unnecessary work at compile time but also in producing more sensible block orderings. Move the destructor cleanups for local variables over to use lazy cleanups. Eventually all cleanups will do this; for now we have some awkward code duplication. Tell IR generation just to never produce landing pads in -fno-exceptions. This is a much more comprehensive solution to a problem which previously was half-solved by checks in most cleanup-generation spots. llvm-svn: 108270
* More block instantiation stuff. Set variable/param DeclContextFariborz Jahanian2010-07-131-0/+26
| | | | | | to block context when first instantiating them. llvm-svn: 108266
* Add a warning to catch a bug recently caught by code review, like this:Chris Lattner2010-07-131-1/+1
| | | | | | | | | | | t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wlogical-bitwise-confusion] return x && 4; ^ ~ wording improvement suggestions are welcome. llvm-svn: 108260
* Add volatile qualifiers for "this".Devang Patel2010-07-131-0/+20
| | | | llvm-svn: 108245
* Reinstate the optimization suppressing available_externally functionsDouglas Gregor2010-07-132-2/+2
| | | | | | | | at -O0. The only change from the previous patch is that we don't try to generate virtual method thunks for an available_externally function. llvm-svn: 108230
* Speculatively revert r108156; it appears to be breaking self-host.Douglas Gregor2010-07-122-2/+2
| | | | llvm-svn: 108194
OpenPOWER on IntegriCloud