Commit Graph

66859 Commits

Author SHA1 Message Date
George Burgess IV 1a39b86d0f [CodeGen] Unique constant CompoundLiterals.
Our newly aggressive constant folding logic makes it possible for
CGExprConstant to see the same CompoundLiteralExpr more than once. So,
emitting a new GlobalVariable every time we see a CompoundLiteral is no
longer correct.

We had a similar issue with BlockExprs that was caught while testing
said aggressive folding, so I applied the same style of fix (see D26410)
here. If we find yet another case where this needs to happen, we should
probably refactor this so we don't have a third DenseMap+getter+setter.

As a design note: getAddrOfConstantCompoundLiteralIfEmitted is really
only intended to be called by ConstExprEmitter::EmitLValue. So,
returning a GlobalVariable* instead of a ConstantAddress costs us
effectively nothing, and saves us either a few bytes per entry in our
map or a bit of code duplication.

llvm-svn: 290661
2016-12-28 07:27:40 +00:00
Richard Smith 15361a21e0 Mark 'auto' as dependent when instantiating the type of a non-type template
parameter. Fixes failed deduction for 'auto' non-type template parameters
nested within templates.

llvm-svn: 290660
2016-12-28 06:27:18 +00:00
Richard Smith 57aae07b4a DR1315: a non-type template argument in a partial specialization is permitted
to make reference to template parameters. This is only a partial
implementation; we retain the restriction that the argument must not be
type-dependent, since it's unclear how that would work given the existence of
other language rules requiring an exact type match in this context, even for
type-dependent cases (a question has been raised on the core reflector).

llvm-svn: 290647
2016-12-28 02:37:25 +00:00
Michael Kuperstein 071345178b Update test that relies on the optimizer to match new output.
llvm-svn: 290642
2016-12-28 00:30:43 +00:00
David Blaikie deeca6de08 DebugInfo: Don't include size/alignment on class declarations
This seems like it must've been a leftover by accident - no tests were
backing it up & it doesn't make much sense to include size/alignment on
class declarations (it'd only be on those declarations for which the
definition was available - otherwise the size/alignment would not be
known).

llvm-svn: 290631
2016-12-27 22:05:35 +00:00
Richard Smith fa4a09d8af Add warning flag for "partial specialization is not more specialized than primary template" error (since Eigen hits it), and while I'm here also add a warning flag for "partial specialization is not usable because one or more of its parameters cannot be deduced" warning.
llvm-svn: 290625
2016-12-27 20:03:09 +00:00
Ekaterina Romanova c9ed514632 [DOXYGEN] Improved doxygen comments for xmmintrin.h intrinsics.
Added \n commands to insert a line breaks where necessary, since one long line of documentation is nearly unreadable.
Formatted comments to fit into 80 chars.
In some cases added \a command in front of the parameter names to display them in italics.

llvm-svn: 290619
2016-12-27 18:53:29 +00:00
Richard Smith 0e617ecdd1 DR1495: A partial specialization is ill-formed if it is not (strictly) more
specialized than the primary template. (Put another way, if we imagine there
were a partial specialization matching the primary template, we should never
select it if some other partial specialization also matches.)

llvm-svn: 290593
2016-12-27 07:56:27 +00:00
Richard Smith f0071ccd08 Add reference/non-reference mismatch test.
llvm-svn: 290587
2016-12-27 06:18:22 +00:00
Richard Smith d92eddf02d Work around a standard defect: template argument deduction for non-type
template parameters of reference type basically doesn't work, because we're
always deducing from an argument expression of non-reference type, so the type
of the deduced expression never matches. Instead, compare the type of an
expression naming the parameter to the type of the argument.

llvm-svn: 290586
2016-12-27 06:14:37 +00:00
George Burgess IV b531698ff0 Emit CCEDiags when evaluating a const variable.
This addresses post-review feedback from r290577.

llvm-svn: 290584
2016-12-27 05:33:20 +00:00
Craig Topper 70536f4e47 [AVX-512] Replace masked 512-bit pmuldq and pmuludq builtins with the newly added unmasked versions and selects.
llvm-svn: 290580
2016-12-27 04:04:57 +00:00
Craig Topper 32866ab800 Revert r290574 "foo"
This was supposed to be merged with another commit with a real commit message. Sorry.

llvm-svn: 290579
2016-12-27 04:03:29 +00:00
Craig Topper c5ab78d4c3 Revert r290575 "[AVX-512] Replace masked 512-bit pmuldq and pmuludq builtins with the newly added unmasked versions and selects."
I failed to merge this with r290574.

llvm-svn: 290578
2016-12-27 04:03:25 +00:00
George Burgess IV ddb49837aa Add a test for `const` folding introduced by r290297. NFC.
AFAICT, we didn't add a test targeted at the new "const can sometimes
act as constexpr" behavior introduced by r290297.

llvm-svn: 290577
2016-12-27 04:01:22 +00:00
Richard Smith 5d10289639 Factor out repeated code for deducing a non-type template parameter as a given
argument value. No functionality change intended.

llvm-svn: 290576
2016-12-27 03:59:58 +00:00
Craig Topper 6ad5bcc8ac [AVX-512] Replace masked 512-bit pmuldq and pmuludq builtins with the newly added unmasked versions and selects.
llvm-svn: 290575
2016-12-27 03:46:16 +00:00
Craig Topper 39b9e32493 foo
llvm-svn: 290574
2016-12-27 03:46:13 +00:00
Saleem Abdulrasool a5ad591918 Driver: switch Windows to static RelocModel
Windows uses PE/COFF which is inherently position independent.  The use
of the PIC model is unnecessary.  In fact, we would generate invalid
code using the ELF PIC model when PIC was enabled previously.  Now that
we no longer accept -fPIC and -fpoc, this switches the internal
representation to the static model to permit us to make PIC modules
invalid when targeting Windows.  This should not change the code
generation, only the internal state management.

llvm-svn: 290569
2016-12-27 02:20:35 +00:00
Richard Smith 01bfa68fec Check and build conversion sequences for non-type template arguments in
dependent contexts when processing the template in C++11 and C++14, just like
we do in C++98 and C++1z. This allows us to diagnose invalid templates earlier.

llvm-svn: 290567
2016-12-27 02:02:09 +00:00
Ekaterina Romanova dffe45b3e6 [DOXYGEN] Improved doxygen comments for x86 intrinsics.
Improved doxygen comments for the following intrinsics headers:  __wmmintrin_pclmul.h, bmiintrin.h, emmintrin.h, f16cintrin.h, immintrin.h, mmintrin.h, pmmintrin.h, tmmintrin.h

Added \n commands to insert a line breaks where necessary, since one long line of documentation is nearly unreadable.
Formatted comments to fit into 80 chars.
In some cases added \a command in front of the parameter names to display them in italics.

llvm-svn: 290561
2016-12-27 00:49:38 +00:00
Chandler Carruth 88c4ffb4e0 [PM] The new pass manager requires a registered target for these, and
given that they hard code specific triples that seems reasonable so add
the REQUIRES.

llvm-svn: 290560
2016-12-27 00:31:34 +00:00
Chandler Carruth 6d1b83ef87 [PH] Teach the new PM code path to support -disable-llvm-passes.
This is kind of funny because I specifically did work to make this easy
and then it didn't actually get implemented.

I've also ported a set of tests that rely on this functionality to run
with the new PM as well as the old PM so that we don't mess this up in
the future.

llvm-svn: 290558
2016-12-27 00:13:09 +00:00
Richard Smith 4f9b3f4a5b Update comment to match dr1770.
llvm-svn: 290552
2016-12-26 22:28:29 +00:00
Simon Pilgrim 6f3e1ea403 Wdocumentation fix
llvm-svn: 290547
2016-12-26 18:11:49 +00:00
Marina Yatsina c5cf7a8b00 Fix build error caused by r290539.
llvm-svn: 290541
2016-12-26 13:16:40 +00:00
Marina Yatsina c42fd03bf8 [inline-asm]No error for conflict between inputs\outputs and clobber list
According to extended asm syntax, a case where the clobber list includes a variable from the inputs or outputs should be an error - conflict.
for example:

const long double a = 0.0;
int main()
{

char b;
double t1 = a;
__asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)");

return 0;
}

This should conflict with the output - t1 which is st, and st which is st aswell.
The patch fixes it.

Commit on behald of Ziv Izhar.

Differential Revision: https://reviews.llvm.org/D15075

llvm-svn: 290539
2016-12-26 12:23:42 +00:00
Saleem Abdulrasool c47e1aab1c test: add explicit triples to the invocation
llvm-svn: 290534
2016-12-26 04:00:54 +00:00
Saleem Abdulrasool d133dc226f Driver: warn on -fPIC/-fpic/-fPIE/-fpie on Windows
Use of these flags would result in the use of ELF-style PIE/PIC code
which is incorrect on Windows.  Windows is inherently PIC by means of
the DLL slide that occurs at load.  This also mirrors the behaviour on
GCC for MinGW.  Currently, the Windows x86_64 forces the relocation
model to PIC (Level 2).  This is unchanged for now, though we should
remove any assumptions on that and change it to a static relocation
model.

llvm-svn: 290533
2016-12-26 03:35:24 +00:00
Richard Smith 993f203278 Fix assertion failure when deducing an auto-typed argument against a different-width int.
llvm-svn: 290522
2016-12-25 20:21:12 +00:00
Amjad Aboud e2aab8c30c [DebugInfo] Added support for Checksum debug info feature.
Differential Revision: https://reviews.llvm.org/D27641

llvm-svn: 290515
2016-12-25 10:12:27 +00:00
Richard Smith 87d263e870 Fix some subtle wrong partial ordering bugs particularly with C++1z auto-typed
non-type template parameters.

During partial ordering, when checking the substituted deduced template
arguments match the original, check the types of non-type template arguments
match even if they're dependent. The only way we get dependent types here is if
they really represent types of the other template (which are supposed to be
modeled as being substituted for unique, non-dependent types).

In order to make this work for auto-typed non-type template arguments, we need
to be able to perform auto deduction even when the initializer and
(potentially) the auto type are dependent, support for which is the bulk of
this patch. (Note that this requires the ability to deduce only a single level
of a multi-level dependent type.)

llvm-svn: 290511
2016-12-25 08:05:23 +00:00
David Majnemer a5cfddc367 [MS ABI] Mangle unnamed enums correctly
Unnamed enums take the name of the first enumerator they define.

llvm-svn: 290509
2016-12-25 05:26:02 +00:00
Kelvin Li 83c451e998 [OpenMP] Sema and parsing for 'target teams distribute' pragma
This patch is to implement sema and parsing for 'target teams distribute' pragma.

Differential Revision: https://reviews.llvm.org/D28015

llvm-svn: 290508
2016-12-25 04:52:54 +00:00
Anton Yartsev 5ac3720620 Fix for PR15623 (corrected r290413 reverted at 290415). The patch eliminates unwanted ProgramState checker data propagation from an operand of the logical operation to operation result.
The patch also simplifies an assume of a constraint of the form: "(exp comparison_op expr) != 0" to true into an assume of "exp comparison_op expr" to true. (And similarly, an assume of the form "(exp comparison_op expr) == 0" to true as an assume of exp comparison_op expr to false.) which improves precision overall.
https://reviews.llvm.org/D22862

llvm-svn: 290505
2016-12-25 00:57:51 +00:00
Richard Smith 0da6dc47d1 Factor out duplication between partial ordering for class template partial
specializations and variable template partial specializations.

llvm-svn: 290497
2016-12-24 16:40:51 +00:00
Yaron Keren 1c4bbc9a41 Deduplicate several GD.getDecl() calls into Decl * local variable.
llvm-svn: 290495
2016-12-24 15:32:39 +00:00
Malcolm Parsons 4ca3d18b96 [ASTMatchers] Add hasInClassInitializer traversal matcher for FieldDecl.
Summary:
I needed to know whether a FieldDecl had an in-class
initializer for D26453. I used a narrowing matcher there, but a
traversal matcher might be generally useful.

Reviewers: sbenza, bkramer, klimek, aaron.ballman

Subscribers: aaron.ballman, Prazek, cfe-commits

Differential Revision: https://reviews.llvm.org/D28034

llvm-svn: 290492
2016-12-24 13:35:14 +00:00
Malcolm Parsons 81e48b26bc [ASTMatchers] Fix doc for hasBitWidth
llvm-svn: 290491
2016-12-24 13:22:26 +00:00
Richard Smith 2c3fb80b23 Remove accidentally-left-behind commented out code.
llvm-svn: 290485
2016-12-24 04:22:52 +00:00
Richard Smith e68a38f0a8 Fix crash if substitution fails during deduction of variable template partial specialization arguments.
llvm-svn: 290484
2016-12-24 04:20:31 +00:00
Richard Smith 792c22dbd4 When producing a name of a partial specialization in a diagnostic, use the
template arguments as written rather than the canonical template arguments,
so we print more user-friendly names for template parameters.

llvm-svn: 290483
2016-12-24 04:09:05 +00:00
NAKAMURA Takumi afc8e54205 clangCodeGen: Add LLVMPasses to libdeps. r290450 introduced it.
llvm-svn: 290478
2016-12-24 01:55:12 +00:00
Richard Smith 0bda5b5ff4 ArrayRefize lists of TemplateArguments in template argument deduction.
llvm-svn: 290461
2016-12-23 23:46:56 +00:00
Ekaterina Romanova 16166a4d71 [DOXYGEN] Improved doxygen comments for tmmintrin.h intrinsics.
Added \n commands to insert a line breaks where necessary to make the documentation more readable. 
Formatted comments to fit into 80 chars.

llvm-svn: 290458
2016-12-23 23:36:26 +00:00
Ekaterina Romanova 6de0cd870b [DOXYGEN] Improved doxygen comments for tmmintrin.h intrinsics.
Tagged parameter names with \a doxygen command to display parameters in italics.
Added \n commands to insert a line break to make the documentation more readable. 
Formatted comments to fit into 80 chars.

llvm-svn: 290455
2016-12-23 22:47:16 +00:00
Chandler Carruth b322d1e6f0 [PM] Fix up from r290449 to start requiring the x86 target to be
available.

It doesn't seem terribly important to test this with a specific target
triple but without that target available.

llvm-svn: 290451
2016-12-23 21:19:16 +00:00
Chandler Carruth 50f9e893f2 [PM] Introduce options to enable the (still experimental) new pass
manager, and a code path to use it.

The option is actually a top-level option but does contain
'experimental' in the name. This is the compromise suggested by Richard
in discussions. We expect this option will be around long enough and
have enough users towards the end that it merits not being relegated to
CC1, but it still needs to be clear that this option will go away at
some point.

The backend code is a fresh codepath dedicated to handling the flow with
the new pass manager. This was also Richard's suggested code structuring
to essentially leave a clean path for development rather than carrying
complexity or idiosyncracies of how we do things just to share code with
the parts of this in common with the legacy pass manager. And it turns
out, not much is really in common even though we use the legacy pass
manager for codegen at this point.

I've switched a couple of tests to run with the new pass manager, and
they appear to work. There are still plenty of bugs that need squashing
(just with basic experiments I've found two already!) but they aren't in
this code, and the whole point is to expose the necessary hooks to start
experimenting with the pass manager in more realistic scenarios.

That said, I want to *strongly caution* anyone itching to play with
this: it is still *very shaky*. Several large components have not yet
been shaken down. For example I have bugs in both the always inliner and
inliner that I have already spotted and will be fixing independently.

Still, this is a fun milestone. =D

One thing not in this patch (but that might be very reasonable to add)
is some level of support for raw textual pass pipelines such as what
Sean had a patch for some time ago. I'm mostly interested in the more
traditional flow of getting the IR out of Clang and then running it
through opt, but I can see other use cases so someone may want to add
it.

And of course, *many* features are not yet supported!
- O1 is currently more like O2
- None of the sanitizers are wired up
- ObjC ARC optimizer isn't wired up
- ...

So plenty of stuff still lef to do!

Differential Revision: https://reviews.llvm.org/D28077

llvm-svn: 290450
2016-12-23 20:44:01 +00:00
Ed Schouten c62002fb16 Extend the tests for -Wmissing-variable-declarations.
We shouldn't throw a warning when the static keyword is not present in
an anonymous namespace, just like we do for -Wmissing-prototypes.

llvm-svn: 290443
2016-12-23 19:20:07 +00:00
Egor Churaev 28f00aab73 [OpenCL] Align fake address space map with the SPIR target maps.
Summary:
We compile user opencl kernel code with spir triple. But built-ins are written in OpenCL and we compile it with triple x86_64 to be able to use x86 intrinsics. And we need address spaces to match in both cases. So, we change fake address space map in OpenCL for matching with spir.

On CPU address spaces are not really important but we'd like to preserve address space information in order to perform optimizations relying on this info like enhanced alias analysis.

Reviewers: pekka.jaaskelainen, Anastasia

Subscribers: pekka.jaaskelainen, yaxunl, bader, cfe-commits

Differential Revision: https://reviews.llvm.org/D28048

llvm-svn: 290436
2016-12-23 16:11:25 +00:00