Commit Graph

1448 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 5929ef2ee7 Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.

This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
 return 0;
}

This finally fixes PR5464 and PR5477.
---------------------

I also reverted r151641 which was enhancement on top of r151638.

llvm-svn: 151667
2012-02-28 23:39:14 +00:00
James Molloy 051390fffa Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:

enum e {x, y};
int f(enum {y, x} n) {
  return 0;
}

This finally fixes PR5464 and PR5477.

llvm-svn: 151638
2012-02-28 18:12:11 +00:00
Eli Friedman afa84ae85b Add missing code for compound literals of complex type. <rdar://problem/10938628>
llvm-svn: 151549
2012-02-27 20:26:13 +00:00
Chad Rosier d6a56db7b6 Test case for r151429/r151430, which ensures llvm.lifetime intrinsics are not
being emitted at -O0, but are emitted when optimizations are enabled.

llvm-svn: 151533
2012-02-27 18:45:03 +00:00
Eli Friedman cb3785e450 Fix a stupid mistake in r151133. Reported to me by Joerg Sonnenberger.
llvm-svn: 151407
2012-02-24 23:53:49 +00:00
Aaron Ballman 0c84ebb539 Turned on support for __declspecs: noreturn, noinline, nothrow and naked in MS compatibility mode.
llvm-svn: 151295
2012-02-23 22:46:33 +00:00
Chandler Carruth a2a5410e6d Add 3dNOW intrinsic header to x86intrin.h, conditioned on __3dNOW__ to
match the behavior of GCC. Also add a test for these intrinsics, which
apparently have *zero* tests. =[ Not surprisingly, Clang crashed when
compiling these.

Fix the bug in CodeGen where we failed to bitcast the argument type to
x86mmx prior to calling the LLVM intrinsic. This fixes an assert on the
new 3dnow-builtins.c test.

This is one issue impacting the efforts to get Clang to emulate the
Microsoft intrinsics headers -- 3dnow intrinsics are implictitly made
available there.

llvm-svn: 150948
2012-02-20 07:35:45 +00:00
David Chisnall 0867d9cfbc Implement #pragma redefine_extname.
This fixes PR5172 and allows clang to compile C++ programs on Solaris using the system headers.

llvm-svn: 150881
2012-02-18 16:12:34 +00:00
Evgeniy Stepanov 0247b99171 Loosen the test from r150238 a bit to make some of our bots happy.
llvm-svn: 150242
2012-02-10 10:04:01 +00:00
Evgeniy Stepanov 3fae4aeae4 Fix function prolog codegen whe coerce-to type is a struct.
This changes function prolog in such a way as to avoid out-of-bounds
stack store in the case when coerce-to type has a larger storage size
than the real argument type.

Fixes PR11905.

llvm-svn: 150238
2012-02-10 09:30:15 +00:00
Akira Hatanaka 4984f5dbbe Class objects passed by value follow the same rules as structure objects.
Double fields of by-value class objects should be passed in floating point
registers.

llvm-svn: 150200
2012-02-09 19:54:16 +00:00
Akira Hatanaka b6f7443c3c Fix bugs in function MipsABIInfo::returnAggregateInRegs. Functions returning
class objects follow the same rules as those returning struct objects.

llvm-svn: 150196
2012-02-09 18:49:26 +00:00
Craig Topper e5ea3b0239 Remove vperm2f* and vperm2i builtins. Same effect can be achieved with builtin_shufflevector.
llvm-svn: 150064
2012-02-08 07:33:36 +00:00
Craig Topper fec9f8edb7 Remove vpermilp* builtins. Same effect can be achieved with builtin_shufflevector.
llvm-svn: 150056
2012-02-08 05:16:54 +00:00
Akira Hatanaka c07c4655f1 Do not return records with non trivial destructors or copy constructors in
registers.

llvm-svn: 150035
2012-02-08 01:31:22 +00:00
Eli Friedman 1b125c3e31 Make FunctionDecl::doesDeclarationForceExternallyVisibleDefinition use the same logic as FunctionDecl::isInlineDefinitionExternallyVisible to figure out whether to emit a definition. Based on work by Anton Yartsev.
llvm-svn: 149963
2012-02-07 03:50:18 +00:00
Bob Wilson 49708d41a6 Preserve alignment for Neon vld1_lane/dup and vst1_lane intrinsics.
We had been generating load/store instructions with the default alignment
for the vector element type, even when the pointer argument had less alignment.
<rdar://problem/10538555>

llvm-svn: 149794
2012-02-04 23:58:08 +00:00
Devang Patel fb04ece198 Update tests so that they don't rely upon LLVMDebugVersion number.
llvm-svn: 149726
2012-02-03 23:58:39 +00:00
Chad Rosier d1956e46dd [frontend] Don't allow a mapping to a warning override an error/fatal mapping.
rdar://10736625

llvm-svn: 149662
2012-02-03 01:49:51 +00:00
Anton Yartsev 79de4d49a6 r149587 reverted
llvm-svn: 149594
2012-02-02 06:06:34 +00:00
Anton Yartsev 3da212585e Fix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)
extern inline case considered

llvm-svn: 149587
2012-02-02 05:13:59 +00:00
Craig Topper d6d3a05b4f Cleanup 3dnow builtin handling. Most of them were already handled by LLVM connecting intrinsics and builtins in IntrinsicsX86.td.
llvm-svn: 149233
2012-01-30 08:18:19 +00:00
Benjamin Kramer 1412816686 Make the __builtin_c[lt]zs builtins target independent.
There is really no reason to have these only available on x86. It's
just __builtin_c[tl]z for shorts.

Modernize the test while at it.

llvm-svn: 149183
2012-01-28 18:42:57 +00:00
Bob Wilson a7a61e2701 Make clz/ctz builtins defined for zero on ARM targets. rdar://10732455
ARM supports clz and ctz directly and both operations have well-defined
results for zero.  There is no disadvantage in performance to using the
defined-at-zero versions of llvm.ctlz/cttz intrinsics.  We're running into
ARM-specific code written with the assumption that __builtin_clz(0) == 32,
even though that value is technically undefined.  The code is failing now
because of llvm optimizations that are taking advantage of the undef
behavior (specifically svn r147255).  There's nothing wrong with that
optimization on x86 where any incorrect assumptions about __builtin_clz(0)
will quickly be exposed.  For ARM, though, optimizations based on that undef
behavior are likely to cause subtle bugs.  Other targets with defined-at-zero
clz/ctz support may want to override the default behavior as well.

llvm-svn: 149086
2012-01-26 22:14:27 +00:00
Douglas Gregor 35696d1a88 Try harder to get X7 defined
llvm-svn: 149072
2012-01-26 18:38:13 +00:00
Douglas Gregor e6e5406122 Force layout of more of the unions and structures in this test
llvm-svn: 149066
2012-01-26 17:23:00 +00:00
Chandler Carruth d0a41fead3 Suppress any warnings from this test. They aren't interesting, and they
end up in the same output file as the layout stuff. There may even be
a race condition which is causing this output to confuse the FileCheck
in some cases. I actually don't know how on earth the parsing of the
layout file even works given that there are diagnostics in the middle of
it. ;]

llvm-svn: 149058
2012-01-26 09:28:50 +00:00
Douglas Gregor e9fc377a44 Extend the ExternalASTSource interface to allow the AST source to
provide the layout of records, rather than letting Clang compute
the layout itself. LLDB provides the motivation for this feature:
because various layout-altering attributes (packed, aligned, etc.)
don't get reliably get placed into DWARF, the record layouts computed
by LLDB from the reconstructed records differ from the actual layouts,
and badness occurs. This interface lets the DWARF data drive layout,
so we don't need the attributes preserved to get the answer write.

The testing methodology for this change is fun. I've introduced a
variant of -fdump-record-layouts called -fdump-record-layouts-simple
that always has the simple C format and provides size/alignment/field
offsets. There is also a -cc1 option -foverride-record-layout=<file>
to take the output of -fdump-record-layouts-simple and parse it to
produce a set of overridden layouts, which is introduced into the AST
via a testing-only ExternalASTSource (called
LayoutOverrideSource). Each test contains a number of records to lay
out, which use various layout-changing attributes, and then dumps the
layouts. We then run the test again, using the preprocessor to
eliminate the layout-changing attributes entirely (which would give us
different layouts for the records), but supplying the
previously-computed record layouts. Finally, we diff the layouts
produced from the two runs to be sure that they are identical.

Note that this code makes the assumption that we don't *have* to
provide the offsets of bases or virtual bases to get the layout right,
because the alignment attributes don't affect it. I believe this
assumption holds, but if it does not, we can extend
LayoutOverrideSource to also provide base offset information.

Fixes the Clang side of <rdar://problem/10169539>.

llvm-svn: 149055
2012-01-26 07:55:45 +00:00
Eli Friedman a98d1f8ca6 Add some ABI tweaks for i386-pc-win32 triple so that we return structs in an MSVC-compatible way. Patch by Joe Groff.
llvm-svn: 148992
2012-01-25 22:46:34 +00:00
NAKAMURA Takumi 509b7af017 test/CodeGen/avx-builtins.c: Fix more for -Asserts.
llvm-svn: 148944
2012-01-25 09:11:21 +00:00
Craig Topper 80df922f2f Re-enable test that was broken by r148919
llvm-svn: 148932
2012-01-25 06:23:23 +00:00
Chris Lattner f07b612313 disable this test for now.
llvm-svn: 148928
2012-01-25 05:38:06 +00:00
Chris Lattner 29969cd86a fix broken testcase.
llvm-svn: 148925
2012-01-25 05:29:46 +00:00
Craig Topper 9e9301a83a Represent 256-bit unaligned loads natively and remove the builtins. Similar change was made for 128-bit versions a while back.
llvm-svn: 148919
2012-01-25 04:26:17 +00:00
Kostya Serebryany 588d6abf7d The following patch adds __attribute__((no_address_safety_analysis)) which will allow to disable
address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function.

When building with AddressSanitizer, add AddressSafety function attribute to every generated function
except for those that have __attribute__((no_address_safety_analysis)).

With this patch we will be able to
1. disable AddressSanitizer for a particular function
2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on.

llvm-svn: 148842
2012-01-24 19:25:38 +00:00
Seth Cantrell a7956f92df add tests for wide character encodings
and fix typo

llvm-svn: 148603
2012-01-21 00:16:11 +00:00
Sebastian Pop 422377cfd3 rename -ccc-host-triple into -target
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Seth Cantrell 6255c257e9 Add and update tests for character literals
llvm-svn: 148392
2012-01-18 12:27:10 +00:00
Nick Lewycky e2367d2508 Add testcase for r148375!
llvm-svn: 148378
2012-01-18 04:28:31 +00:00
Tanya Lattner 81ce08c983 Add new line.
llvm-svn: 148255
2012-01-16 21:15:33 +00:00
Tanya Lattner 20248226a9 Add support for OpenCL 1.1 logical operations.
llvm-svn: 148254
2012-01-16 21:02:28 +00:00
David Chisnall fa35df628a Some improvements to the handling of C11 atomic types:
- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type.  This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks.  The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases

llvm-svn: 148242
2012-01-16 17:27:18 +00:00
Richard Smith dafff94759 constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.

llvm-svn: 148178
2012-01-14 04:30:29 +00:00
Eli Friedman d749c6bf2e Revert r148138; it's causing test failures.
llvm-svn: 148141
2012-01-13 21:33:06 +00:00
Sebastian Pop 9a8d528ddf rename -ccc-host-triple into -target
llvm-svn: 148138
2012-01-13 20:37:02 +00:00
Akira Hatanaka acf9896ca1 Fix test case committed in r147986.
llvm-svn: 147993
2012-01-12 01:27:24 +00:00
Akira Hatanaka 32604a9708 Take into account the pointer to an aggregate that is passed as a hidden
argument when Offset is initialized.

llvm-svn: 147986
2012-01-12 01:10:09 +00:00
NAKAMURA Takumi 68a75e879d clang/test/CodeGen/vla-4.c: Relax expression for -Asserts.
llvm-svn: 147934
2012-01-11 08:34:52 +00:00
Abramo Bagnara fa95ed4074 Fixed VLA code generation.
llvm-svn: 147933
2012-01-11 08:19:46 +00:00
Akira Hatanaka 428f5b2008 Add field IsIEEE in FloatingLiteral to distinguish between different 128-bit
floating point formats.

llvm-svn: 147887
2012-01-10 22:40:09 +00:00