Richard Trieu [Wed, 20 May 2015 23:29:18 +0000 (23:29 +0000)]
Check for bool-like conversion in conditional expressions.
Add a check for bool-like conversions for the condition expression of
conditional operators. This is similiar to the checking of condition
expressions of if statements, for-loops, while-loops, and do-while loops.
Specificially, this is to fix the problem of assert("message") not triggering
-Wstring-conversion when the assert macro uses a conditional operator.
Richard Smith [Wed, 20 May 2015 22:48:44 +0000 (22:48 +0000)]
[OpenMP] Make default OpenMP library (the one selected with just -fopenmp)
configurable in the CMake build. There shouldn't be any change in default
behavior.
Justin Bogner [Wed, 20 May 2015 16:16:23 +0000 (16:16 +0000)]
InstrProf: Increment the profile counter for all types of destructor
-fprofile-instr-generate does not emit counter increment intrinsics
for Dtor_Deleting and Dtor_Complete destructors with assigned
counters. This causes unnecessary [-Wprofile-instr-out-of-date]
warnings during profile-use runs even if the source has never been
modified since profile collection.
Alexey Bataev [Wed, 20 May 2015 11:57:02 +0000 (11:57 +0000)]
[MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov
There are 3 cases of defining static const member:
initialized inside the class, not defined outside the class.
initialized inside the class, defined outside the class.
not initialized inside the class, defined outside the class.
Revision r213304 was supposed to fix the linkage problem of case (1), but mistakenly it made case (2) behave the same.
As a result, out-of-line definition of static data member is not handled correctly.
Proposed patch distinguishes between cases (1) and (2) and allows to properly emit static const members under –fms-compatibility option.
This fixes http://llvm.org/PR21164.
Differential Revision: http://reviews.llvm.org/D9850
Yaron Keren [Wed, 20 May 2015 07:15:28 +0000 (07:15 +0000)]
Fix CGRecordLayouts description to say it maps clang types not llvm types
and de-duplicate data fields names from comments according to the coding
standard.
Alexey Bataev [Wed, 20 May 2015 04:24:19 +0000 (04:24 +0000)]
[OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736
Alexey Bataev [Wed, 20 May 2015 03:46:04 +0000 (03:46 +0000)]
Fix for aggregate copying of variable length arrays.
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:
<total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
If simple copying is requested, size is calculated like:
<total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
memcpy() is used with this calculated size of the VLA.
Differential Revision: http://reviews.llvm.org/D9851
David Blaikie [Tue, 19 May 2015 21:31:34 +0000 (21:31 +0000)]
[opaque pointer type] Pass the explicit call type when creating calls from LazyRuntimeFunctions
The implicit conversion was causing issues for a helper being added that
would take an llvm::Function rather than an llvm::Value to make the
CallInst. Since we'll eventually need to specify the type of the call
explicitly anyway, fix these up to avoid the future ambiguity.
Richard Smith [Tue, 19 May 2015 19:58:11 +0000 (19:58 +0000)]
Revert r237609 for now.
glibc's headers use __need_* macros to selectively export parts of themselves
to each other. This requires us to enter those files repeatedly when building
a glibc module.
This can be unreverted once we have a better mechanism to deal with that
non-modular aspect of glibc (possibly some way to mark a header as "textual if
this macro is defined").
Alexey Bataev [Tue, 19 May 2015 12:31:28 +0000 (12:31 +0000)]
[OPENMP] Fixed codegen for copying/initialization of array variables/parameters.
This modification generates proper copyin/initialization sequences for array variables/parameters. Before they were considered as pointers, not arrays.
Alexey Bataev [Tue, 19 May 2015 08:44:56 +0000 (08:44 +0000)]
[OPENMP] Prohibit VLAs in 'private/firstprivate' clauses of 'task' directive.
Currently runtime does not allow to support variably modified types for 'private' and 'firstprivate' clauses in 'task' directives.
David Majnemer [Tue, 19 May 2015 00:57:16 +0000 (00:57 +0000)]
[AST] Put VarDeclBitfields on a diet
VarDeclBitfields contained bits which are never present in parameters.
Split these out so that ParmVarDeclBitfields wouldn't grow past 32-bits
if another field was added.
Reid Kleckner [Mon, 18 May 2015 22:46:30 +0000 (22:46 +0000)]
Revert changes to DefaultABIInfo accidentally introduced in r208733
Also add trivial handling of transparent unions.
PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This
should worry you, because DefaultABIInfo is not implementing the rules
of any particular ABI.
Richard Trieu [Mon, 18 May 2015 20:25:44 +0000 (20:25 +0000)]
Create new diagnostic group -Wmove
-Wmove includes the three existing warnings for std::move calls, self move,
reduntant move, and pessimizing move. -Wmove is included in -Wmost, so that
it can be discoverable to people using that or -Wall.
Richard Smith [Mon, 18 May 2015 20:02:41 +0000 (20:02 +0000)]
[modules] When a file is listed as a non-textual header in a module map, don't
enter it more than once, even if it doesn't have #include guards -- we already
know that it is intended to have the same effect every time it's included, and
it's already had that effect. This particularly helps with local submodule
visibility builds, where the include guard macro may not be visible in the
includer, but will become visible the moment we enter the included file.
Alexey Bataev [Mon, 18 May 2015 07:54:53 +0000 (07:54 +0000)]
[OPENMP] Fix for '#pragma omp task' codegen.
Internal task structure must be generated like
typedef struct kmp_task {
void * shareds;
kmp_routine_entry_t routine;
kmp_int32 part_id;
kmp_routine_entry_t destructors;
} kmp_task_t;
struct kmp_task_t_with_privates {
kmp_task_t task_data;
.kmp_private. privates;
};
to avoid possible additional alignment bytes in first fields (shareds, routine, part_id and destructors). Runtime library is not aware of such kind additional alignment bytes.
Richard Smith [Mon, 18 May 2015 03:52:30 +0000 (03:52 +0000)]
[modules] If we see a #include that maps to a module, but use of precompiled modules is disabled, track submodule visibility anyway if -fmodules-local-submodule-visibility is enabled. This, in effect, gives modules semantics but without precompilation.
David Majnemer [Mon, 18 May 2015 00:05:29 +0000 (00:05 +0000)]
[MS ABI] Give __attribute__((overloadable)) functions pretty names
It turns out that there is a mangling for 'extern "C"', it's only used
by MSVC in /clr mode. Co-opt this mangling so that extern "C" functions
marked overloadable get demangled nicely.
Daniel Jasper [Sun, 17 May 2015 07:27:09 +0000 (07:27 +0000)]
clang-format: Improve line wrapping around << operators.
Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
just a single such pair, as that doesn't help much.
Nico Weber [Sun, 17 May 2015 01:07:16 +0000 (01:07 +0000)]
Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.
In -fdelayed-template-parsing mode, templates that aren't used are not parsed
at all. For some diagnostic plugins, this is a problem since they want to
analyse the contents of the template function body. What has been suggested
on cfe-dev [1] is to explicitly parse interesting templates in
HandleTranslationUnit(); IWYU does this for example [2].
This is workable, but since the delayed parsing doesn't run below a call to
ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the
stack to clean up TemplateIds that are created during parsing. To fix this,
let ~Parser() clean them up in delayed template parsing mode instead of
leaking (or asserting in +Assert builds).
(r219810, relanded in r220400, fixed the same problem in incremental processing
mode; the review thread of r219810 has a good discussion of the problem.)
To test this, give the PrintFunctionNames plugin a flag to force parsing
of a template and add a test that uses it in -fdelayed-template-parsing mode.
Without the Parser.cpp change, that test asserts.
Richard Smith [Sat, 16 May 2015 02:28:53 +0000 (02:28 +0000)]
[modules] Retain the name as written for umbrella headers and directories, rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require.
Bill Schmidt [Sat, 16 May 2015 01:02:25 +0000 (01:02 +0000)]
[PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:
vpksdss
vpksdus
vpkudus
vpkudum
vupkhsw
vupklsw
These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces. These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.
The first three instructions perform saturating pack operations. The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated. The other
instructions are only generated via built-in support for now.
I noticed during patch preparation that the macro __VSX__ was not
previously predefined when the power8-vector or direct-move features
are requested. This is an error, and I've corrected that here as
well.
Appropriate tests have been added.
There is a companion patch to llvm for the rest of this support.
Richard Trieu [Fri, 15 May 2015 22:07:49 +0000 (22:07 +0000)]
Reverse the order of types in the reference dropping qualifiers error.
The error has the form ... 'int' ... 'const int' ... dropped qualifiers. At
first glance, it appears that the const qualifier is added. Reverse the types
so that the second type is less qualified than the first.
Richard Smith [Fri, 15 May 2015 20:05:43 +0000 (20:05 +0000)]
[modules] Add local submodule visibility support for declarations.
With this change, enabling -fmodules-local-submodule-visibility results in name
visibility rules being applied to submodules of the current module in addition
to imported modules (that is, names no longer "leak" between submodules of the
same top-level module). This also makes it much safer to textually include a
non-modular library into a module: each submodule that textually includes that
library will get its own "copy" of that library, and so the library becomes
visible no matter which including submodule you import.
Serge Pavlov [Fri, 15 May 2015 10:10:28 +0000 (10:10 +0000)]
Limit set of types instantiated in FindInstantiatedDecl.
Starting from r236426 FindInstantiatedDecl may instantiate types that
are referenced before definition. This change limit the set of types
that can be instantiated by this function.
Daniel Jasper [Fri, 15 May 2015 09:41:59 +0000 (09:41 +0000)]
clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.
Summary:
r235215 enables support in LLVM for legalizing f16 type in the IR. AArch64
already had support for this. r235215 and some backend patches brought support
for ARM, X86, X86-64, Mips and Mips64.
This change exposes the LangOption 'NativeHalfType' in the command line, so the
backend legalization can be used if desired. NativeHalfType is enabled for
OpenCL (current behavior) or if '-fnative-half-type' is set.
Justin Bogner [Thu, 14 May 2015 22:14:10 +0000 (22:14 +0000)]
InstrProf: Only disable coverage in built-in macros, not all system macros
The issue I was trying to solve in r236547 was about built-in macros,
but I disabled coverage in all system macros. This is actually a bit
of overkill, and makes the display of coverage around system macros
degrade unnecessarily. Instead, limit this to builtins specifically.
Nemanja Ivanovic [Thu, 14 May 2015 20:02:24 +0000 (20:02 +0000)]
Testing for the fix for bug 23429.
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
- powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).
Sergey Dmitrouk [Thu, 14 May 2015 19:58:03 +0000 (19:58 +0000)]
[CodeGen] Reuse stack space from unused function results
Summary:
Space on stack allocated for unused structures returned by functions was unused
even when it's lifetime didn't intersect with lifetime of any other objects that
could use the same space.
The test added also checks for named and auto objects. It seems to make sense
to have this all in one place.