__builtin_astype does not generate correct LLVM IR for vec3 types. This patch inserts bitcasts to/from vec4 when necessary in addition to generating vector shuffle. Sema and codegen tests are added.
Differential Revision: http://reviews.llvm.org/D20133
llvm-svn: 272153
Summary:
The JavaScript import sorter has a corner condition that can cause the overall
source text length to shrink. This change circumvents the issue by appending
trailing space in the line after the import blocks to match at least the
previous source code length.
This needs a better long term fix, but this fixes the immediate issue.
Reviewers: alexeagle, djasper
Subscribers: klimek
Differential Revision: http://reviews.llvm.org/D21108
llvm-svn: 272142
Only half of the intrinsics in this file is documented here. The patch for the o
ther half will be sent out later.
The doxygen comments are automatically generated based on Sony's intrinsics docu
ment.
I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.
llvm-svn: 272121
Given the following C++:
```
void foo();
void foo() __attribute__((enable_if(false, "")));
bool bar() {
auto P = foo;
return P == foo;
}
```
We'll currently happily (and correctly) resolve `foo` to the `foo`
overload without `enable_if` when assigning to `P`. However, we'll
complain about an ambiguous overload on the `P == foo` line, because
`Sema::CheckPlaceholderExpr` doesn't recognize that there's only one
`foo` that could possibly work here.
This patch teaches `Sema::CheckPlaceholderExpr` how to properly deal
with such cases.
Grepping for other callers of things like
`Sema::ResolveAndFixSingleFunctionTemplateSpecialization`, it *looks*
like this is the last place that needed to be fixed up. If I'm wrong,
I'll see if there's something we can do that beats what amounts to
whack-a-mole with bugs.
llvm-svn: 272080
We attempted to use the UnaryTransformType's UnderlyingType instead of
it's BaseType. This is not correct for dependent UnaryTransformType
because the have no underlying type.
This fixes PR28045.
llvm-svn: 272079
We have an assertion failure if, for example, the definition of an unused
inline function starts in one macro and ends in another. This patch fixes
the issue by finding the common ancestor of the start and end locations
of that function's body and changing the locations accordingly.
Thanks to NAKAMURA Takumi for helping with fixing the test failure on Windows.
Differential Revision: http://reviews.llvm.org/D20997
llvm-svn: 271995
Summary:
OpenCL should support array with const value size length, those const
varibale in global and constant address space and variable in constant
address space.
Fixed test case error.
Reviewers: Anastasia, yaxunl, bader
Subscribers: bader, cfe-commits
Differential Revision: http://reviews.llvm.org/D20090
llvm-svn: 271978
Second try at reapplying
"[analyzer] Add checker for correct usage of MPI API in C and C++."
Special thanks to Dan Liew for helping test the fix for the template
specialization compiler error with gcc.
The original patch is by Alexander Droste!
Differential Revision: http://reviews.llvm.org/D12761
llvm-svn: 271977
Summary:
OpenCL should support array with const value size length, those const varibale in global and constant address space and variable in constant address space.
Reviewers: Anastasia, yaxunl, bader
Subscribers: bader, cfe-commits
Differential Revision: http://reviews.llvm.org/D20090
llvm-svn: 271971
We have an assertion failure if, for example, the definition of an unused
inline function starts in one macro and ends in another. This patch fixes
the issue by finding the common ancestor of the start and end locations
of that function's body and changing the locations accordingly.
Differential Revision: http://reviews.llvm.org/D20997
llvm-svn: 271969
Improved the visualizer for TemplateArgumentList to show type arguments in the DisplayString.
E.g., <double, long>. Added a visualizer for MultiLevelTemplateArgumentList.
I decided to display them by how they would appear in a template with the
(non-existent) template-id's omitted, so the DisplayString naturally presents
as something like <double, long>::<char *>.
llvm-svn: 271944
Reapply r271907 with a fix for the compiler error with gcc about specializing
clang::ento::ProgramStateTrait in a different namespace.
Differential Revision: http://reviews.llvm.org/D12761
llvm-svn: 271914
For pack TemplateArguments, visualize all of the items in the pack
Visualize a TemplateArgumentList as a template argument list. E.g., <int, double>
llvm-svn: 271910
This commit adds a static analysis checker to check for the correct usage of the
MPI API in C and C++.
3 path-sensitive checks are included:
- Double nonblocking: Double request usage by nonblocking calls
without intermediate wait.
- Missing wait: Nonblocking call without matching wait.
- Unmatched wait: Waiting for a request that was never used by a
nonblocking call.
Examples of how to use the checker can be found
at https://github.com/0ax1/MPI-Checker
Reviewers: zaks.anna
A patch by Alexander Droste!
Differential Revision: http://reviews.llvm.org/D12761
llvm-svn: 271907
Mention that the code coverage tool becomes less precise whenever
unpredictable changes in control flow occur.
Thanks to Sean Silva for pointing this out!
llvm-svn: 271902
match was the ld.elf_so that should be matched in a second step. Add one
of the ever-present-but-irrelevant-for-this-test arguments to the
pattern to force matching the right argument.
llvm-svn: 271893
Summary:
32-bit CPU's default to O32. 64-bit CPU's default to N64. The default CPU
(mips32r2/mips64r2) still depends on the arch so there's no functional
change when the CPU isn't specified but commands like:
clang -target mips-mti-linux-gnu -mips64r2
will now default to a 64-bit ABI like our gcc toolchains do* instead of
asserting in the backend**.
Other vendors (including Triple::UnknownVendor) still derive the default
ABI from the arch.
* Although not the same one as our gcc toolchains, clang has historically
defaulted to N64 where gcc defaults to N32.
** Mixing O32 and a 64-bit CPU causing assertions is a long-standing bug.
Reviewers: atanasyan
Subscribers: sdardis, cfe-commits
Differential Revision: http://reviews.llvm.org/D21016
llvm-svn: 271884
Summary:
setABI() is still tied to the Arch component of the Triple to preserve existing
behaviour.
Reviewers: atanasyan
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20961
llvm-svn: 271875
Now it gives the StmtClass of the Expr as well as the type. It's still
a long way from full visualization of expressions, but I have found
that having the class really helps when debugging, so definitely
worth submitting.
llvm-svn: 271866
This is really only needed for addition, subtraction, and multiplication, but I did the bitwise ops too for overall consistency. Clang currently doesn't set NSW for signed vector operations so the undefined behavior shouldn't happen today.
llvm-svn: 271778
We would attempt to evaluate the sizeof a dependent type to check for an
integral overflow. However, because the dependent type is not yet resolved, we
cannot determine if the expression would overflow. Report a failure to perform
a symbolic evaluation of a constant involving the dependent type.
llvm-svn: 271762
The assertion added earlier was overly strict. We need to strip the pointer
casts (as when constructing the GV). Correct the types (Function or Variable).
llvm-svn: 271750
We now have a cmake option to change the default: ENABLE_LINKER_BUILD_ID.
The reason is that build-id is fairly expensive, so we shouldn't impose
it in the regular edit/build cycle.
This is similar to gcc, that has an off by default --enable-linker-build-id
option.
llvm-svn: 271692
This patch enables +ras +noras to AArch64 in clang.
Patch by: Roger Ferrer Ibanez and Oliver Stannard
Differential Revision: http://reviews.llvm.org/D20283
llvm-svn: 271672
Summary:
[clang-format] skip empty lines and comments in the top of the code when inserting new headers.
Pair-programmed with @hokein
Reviewers: djasper
Subscribers: ioeric, cfe-commits, hokein, klimek
Differential Revision: http://reviews.llvm.org/D20898
llvm-svn: 271664
Summary:
When this flag is specified, the target llvm-lto is not built, but is still
used as a dependency of the test targets. cmake 2.8 silently ignored this
situation, but with cmake_minimum_required(3.4) it becomes an error. Fix this
by avoiding the inclusion the target as a dependency.
Reviewers: beanz
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20883
llvm-svn: 271533
Instead of setting DeclSpec's range end to point to the next token
after the DeclSpec, we use getLocForEndOfToken to insert fix-it after a type
name.
Before this fix, fix-it will change
^(NSView view) to ^(*NSView view)
This commit correctly updates the source to ^(NSView* view).
rdar://21042144
Differential Revision: http://reviews.llvm.org/D20844
llvm-svn: 271448
The 'cvtt' truncation (round to zero) conversions can be safely represented as generic __builtin_convertvector (fptosi) calls instead of x86 intrinsics. We already do this (implicitly) for the scalar equivalents.
Note: I looked at updating _mm_cvttpd_epi32 as well but this still requires a lot more backend work to correctly lower (both for debug and optimized builds).
Differential Revision: http://reviews.llvm.org/D20859
llvm-svn: 271436
Summary:
This patch fix the scoping of enum literal. They were not resolving
to the right type.
It was not causing any problem as one is a copy of the other one.
The literal in the switch are resolving to Sema.h:5527
```
enum AccessResult {
AR_accessible,
AR_inaccessible,
AR_dependent,
AR_delayed
};
```
Instead of SemaAccess.cpp:27
```
/// A copy of Sema's enum without AR_delayed.
enum AccessResult {
AR_accessible,
AR_inaccessible,
AR_dependent
};
```
This issue was found by a new clang-tidy check (still on-going).
Reviewers: rsmith, aaron.ballman
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20773
llvm-svn: 271431
Add a new test android-ndk-standalone.cpp
with new Android NDK release tree structure.
Detect armv7 sub architecture and thumb mode,
to add system include and link search paths.
Differential Revision: http://reviews.llvm.org/D20600
llvm-svn: 271427
It's possible to have multiple local ObjCLifetime qualifiers. When there is
a conflict, we can't stop after we reach a type that is directly qualified.
We need to keep pulling sugar off and removing the ObjCLifetime qualifers.
rdar://25804796
Differential Revision: http://reviews.llvm.org/D20843
llvm-svn: 271409
Summary: ASI did not handle the ES6 `as` operator correctly.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D20817
llvm-svn: 271401
The `isa' member was previously not given the correct DLL Storage. Ensure that
we give the `isa' constant `__CFConstantStringClassReference' the correct DLL
storage. Default to dllimport unless an explicit specification gives it a
dllexport storage.
llvm-svn: 271361
Summary:
This is particularly important because a some convergent CUDA intrinsics
(e.g. __shfl_down) are implemented in terms of inline asm.
Reviewers: tra
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20836
llvm-svn: 271336
I added this call in r271308. It's redundant because it's dominated by a
call to extendRegion().
Thanks to Justin Bogner for pointing this out!
llvm-svn: 271331
If a closing ')' isn't found for a macro instantiation inside a '[',
the next token is EOF, this leads to crashes if we try to look ahead of
that. This could be triggered whenever trying to parse lambdas or objs
message expressions.
Differential Revision: http://reviews.llvm.org/D20451
rdar://problem/25662647
llvm-svn: 271314
When we import a module that defines a builtin identifier from prefix header and
precompile the prefix header, the macro information related to the identifier
is lost.
If we don't precompile the prefix header, the source file can still see the
macro information. The reason is that we write out the identifier in the pch
but not the macro information since the macro is not defined locally.
This is related to r251565. In that commit, if we read a builtin identifier from
a module that wasn't "interesting" to that module, we will still write it out to
a PCH that imports that module.
The fix is to write exported module macros for PCH as well.
rdar://24666630
Differential Revision: http://reviews.llvm.org/D20383
llvm-svn: 271310
Previous attempts to rename the IBOutletCollection argument to something
other than "Interface" were undone (r127127 and r139620). Instead of
renaming it, work around this in tablegen, so the public facing getter
can have the usual name of 'getInterface'.
Fixes PR26682
llvm-svn: 271305
Summary:
When a replacement's offset is set to UINT_MAX or -1U, it is treated as
a header insertion replacement by cleanupAroundReplacements(). The new #include
directive is then inserted into the correct block.
Reviewers: klimek, djasper
Subscribers: klimek, cfe-commits, bkramer
Differential Revision: http://reviews.llvm.org/D20734
llvm-svn: 271276
Added notes about full support of all non-offloading features of OpenMP
4.5 + info about option -fopenmp-version=[31|40|45] that allows to
control supported OpenMP version.
llvm-svn: 271263
Wilson.
An unqualified lookup for in base classes may cause stack overflow if
the base class is a specialization of current class.
Patch by Will Wilson.
llvm-svn: 271251
According to the gcc headers, intel intrinsics docs and msdn codegen the _mm_store1_pd (and its _mm_store_pd1 equivalent) should use an aligned pointer - the clang headers are the only implementation I can find that assume non-aligned stores (by storing with _mm_storeu_pd).
Additionally, according to the intel intrinsics docs and msdn codegen the _mm_store1_ps (_mm_store_ps1) requires a similarly aligned pointer.
This patch raises the alignment requirements to match the other implementations by calling _mm_store_ps/_mm_store_pd instead.
I've also added the missing _mm_store_pd1 intrinsic (which maps to _mm_store1_pd like _mm_store_ps1 does to _mm_store1_ps).
As a followup I'll update the llvm fast-isel tests to match this codegen.
Differential Revision: http://reviews.llvm.org/D20617
llvm-svn: 271218
Summary: The order is [x, y, z, w], not [w, x, y, z].
Subscribers: cfe-commits, tra
Differential Revision: http://reviews.llvm.org/D20794
llvm-svn: 271215
Adjust the constant CFString emission to emit into more appropriate sections on
ELF and COFF targets. It would previously try to use MachO section names
irrespective of the file format.
llvm-svn: 271211
'simd' modifier.
Runtime library defines new schedule constant kmp_sch_static_balanced_chunked = 45 for static loop-based directives static with chunk adjustment (e.g., simd). Added codegen for this kind of schedule.
llvm-svn: 271204
directives.
'kmp_task_t' record type added a new field for 'priority' clause and
changed the representation of pointer to destructors for privates used
within loop-based directives.
Old representation:
typedef struct kmp_task { /* GEH: Shouldn't this be
aligned somehow? */
void *shareds; /**< pointer to block of
pointers to shared vars */
kmp_routine_entry_t routine; /**< pointer to routine
to call for executing task */
kmp_int32 part_id; /**< part id for the
task */
kmp_routine_entry_t destructors; /* pointer to function to
invoke deconstructors of firstprivate C++ objects */
/* private vars */
} kmp_task_t;
New representation:
typedef struct kmp_task { /* GEH: Shouldn't this be
aligned somehow? */
void *shareds; /**< pointer to block of
pointers to shared vars */
kmp_routine_entry_t routine; /**< pointer to routine
to call for executing task */
kmp_int32 part_id; /**< part id for the
task */
kmp_cmplrdata_t data1; /* Two known
optional additions: destructors and priority */
kmp_cmplrdata_t data2; /* Process
destructors first, priority second */
/* future data */
/* private vars */
} kmp_task_t;
Also excessive initialization of 'destructors' fields to 'null' was
removed from codegen if it is known that no destructors shal be used.
Currently a special bit is used in 'kmp_tasking_flags_t' bitfields
('destructors_thunk' bitfield).
llvm-svn: 271201
OpenCL has large number of "builtin" functions ("builtin" in the sense of OpenCL spec) which are defined in header files. To compile OpenCL kernels using these builtin functions, a header file is needed.
This header file is based on the Khronos implementation (https://github.com/KhronosGroup/SPIR/blob/spirv-1.0/lib/Headers/opencl.h) with heavy refactoring.
Re-commit after fixing failures on ppc64/systemz etc.
Differential Revision: http://reviews.llvm.org/D18369
llvm-svn: 271197
Problem found by Nico, originally committed by me in r213213. The .test
prefix wasn't actually being run. Once that was fixed the test cases had
outdated command line syntax and IR debug info format, so updated for
those issues to get them back up and running.
Thanks Nico!
llvm-svn: 271188
As discussed on http://reviews.llvm.org/D20684, move the unsigned integer vector types used for zero extension to make them available for general use.
llvm-svn: 271187