Commit Graph

37487 Commits

Author SHA1 Message Date
David Blaikie 8e90d221f1 Formatting for prior commit
llvm-svn: 219692
2014-10-14 17:09:38 +00:00
David Blaikie 8e6c36eb80 DebugInfo: Don't leak location information from one function into the prologue of the next function.
CodeGenFunction objects aren't really designed to be reused for more
than one function, and doing so can leak debug info location information
from one function into the prologue of the next.

Add an assertion in to catch reuses of CodeGenFunction, which
surprisingly only caught the ObjC atomic getter/setter cases. Fix those
and add a test to demonstrate the issue.

The test is a bit slim, because we're just testing for the absence of a
debug location on the prologue instructions, which by itself probably
wouldn't be the end of the world - but the particular debug location
that was ending up there was for the previous function's last
instruction. This produced debug info for another function within this
function, which is something I'm trying to remove all cases of as its a
substantial source of bugs, especially around inlining (see r219215).

llvm-svn: 219690
2014-10-14 16:43:46 +00:00
Justin Bogner f884723799 Re-apply "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
I'd mispelled "Bitcode/BitCodes.h" before, and tested on a case
insensitive filesystem.

This reverts commit r219649, effectively re-applying r219647 and
r219648.

llvm-svn: 219664
2014-10-14 06:30:31 +00:00
Richard Smith 99891da71a Extend -Rmodule-build to also remark when module building finishes.
In cases of nested module builds, or when you care how long module builds take,
this information was not previously easily available / obvious.

llvm-svn: 219658
2014-10-14 02:08:30 +00:00
Richard Smith 32952e1e42 [modules] Merging for class-scope using-declarations.
llvm-svn: 219657
2014-10-14 02:00:47 +00:00
Justin Bogner d776d67268 Revert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
The bots can't seem to find an include file. Reverting for now and
I'll look into it in a bit.

This reverts commits r219647 and r219648.

llvm-svn: 219649
2014-10-14 00:57:34 +00:00
Justin Bogner 0b4ab665f9 Frontend: Try to fix cmake builders after r219647
Looks like I missed a dependency here.

llvm-svn: 219648
2014-10-14 00:51:18 +00:00
Justin Bogner e40845b0dd Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)
We currently read serialized diagnostics directly in the C API, which
makes it difficult to reuse this logic elsewhere. This extracts the
core of the serialized diagnostic parsing logic into a base class that
can be subclassed using a visitor pattern.

llvm-svn: 219647
2014-10-14 00:40:55 +00:00
Alexey Samsonov eb47d8a2c8 Sanitize upcasts and conversion to virtual base.
This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
   and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
   virtual base, we check that pointer-to-derived has a matching vptr.

llvm-svn: 219642
2014-10-13 23:59:00 +00:00
David Majnemer 3e8b6ac54c Fix the build
llvm-svn: 219637
2014-10-13 22:18:22 +00:00
Fariborz Jahanian 12f7ef39ce Objective-C [Sema]. Fixes a bug in comparing qualified
Objective-C pointer types. In this case, checker incorrectly
claims incompatible pointer types if redundant protocol conformance 
is specified. rdar://18491222

llvm-svn: 219630
2014-10-13 21:07:45 +00:00
Jordan Rose 679659f58c [analyzer] Check all 'nonnull' attributes, not just the first one.
Patch by Daniel Fahlgren!

llvm-svn: 219625
2014-10-13 19:38:02 +00:00
Samuel Benzaquen 193d87fd8c Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
If it evaluates right-to-left, the vector gets moved before we read the
kind from it.

llvm-svn: 219624
2014-10-13 18:17:11 +00:00
Samuel Benzaquen 2009960ea3 Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
Change r219118 fixed the bug for anyOf and eachOf, but it is still
present for unless.
The variadic wrapper doesn't have enough information to know how to
restrict the type. Different operators handle restrict failures in
different ways.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5731

llvm-svn: 219622
2014-10-13 17:38:12 +00:00
Renato Golin 5886bc35b0 Adds support for the Cortex-A17 processor to Clang
Patch by Matthew Wahab.

llvm-svn: 219607
2014-10-13 10:22:48 +00:00
Bradley Smith 9ff64332a0 [AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is
possible for a 64-bit multiply-accumulate instruction in AArch64 state to
generate an incorrect result.  The details are quite complex and hard to
determine statically, since branches in the code may exist in some
circumstances, but all cases end with a memory (load, store, or prefetch)
instruction followed immediately by the multiply-accumulate operation.

The safest work-around for this issue is to make the compiler avoid emitting
multiply-accumulate instructions immediately after memory instructions and the
simplest way to do this is to insert a NOP.

This patch implements clang options to enable this workaround in the backend.

The work-around code generation is not enabled by default.

llvm-svn: 219604
2014-10-13 10:16:06 +00:00
Alexey Bataev b205978100 [OPENMP] Codegen for 'num_threads' clause in 'parallel' directive.
This patch generates call to "kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads);" library function before calling "kmpc_fork_call" each time there is an associated "num_threads" clause in the "omp parallel" directive.
Differential Revision: http://reviews.llvm.org/D5145

llvm-svn: 219599
2014-10-13 08:23:51 +00:00
Alexey Bataev d74d060d6d [OPENMP] Codegen for 'if' clause in 'parallel' directive.
Adds codegen for 'if' clause. Currently only for 'if' clause used with the 'parallel' directive.
If condition evaluates to true, the code executes parallel version of the code by calling __kmpc_fork_call(loc, 1, microtask, captured_struct/*context*/), where loc - debug location, 1 - number of additional parameters after "microtask" argument, microtask - is outlined finction for the code associated with the 'parallel' directive, captured_struct - list of variables captured in this outlined function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

global_thread_id.addr = alloca i32
store i32 global_thread_id, global_thread_id.addr
zero.addr = alloca i32
store i32 0, zero.addr
kmpc_serialized_parallel(loc, global_thread_id);
microtask(global_thread_id.addr, zero.addr, captured_struct/*context*/);
kmpc_end_serialized_parallel(loc, global_thread_id);

Where loc - debug location, global_thread_id - global thread id, returned by __kmpc_global_thread_num() call or passed as a first parameter in microtask() call, global_thread_id.addr - address of the variable, where stored global_thread_id value, zero.addr - implicit bound thread id (should be set to 0 for serial call), microtask() and captured_struct are the same as in parallel call.

Also this patch checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D4716

llvm-svn: 219597
2014-10-13 06:02:40 +00:00
Tyler Nowicki 6a0354af46 Fixed a problem in r19589.
Several systems failed to compile the array allocation of the TokenArray.

llvm-svn: 219590
2014-10-12 21:28:02 +00:00
Tyler Nowicki c724a83e20 Allow constant expressions in pragma loop hints.
Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1).

Reviewed by Richard Smith

llvm-svn: 219589
2014-10-12 20:46:07 +00:00
David Majnemer 571162af6b CodeGen: Strip qualifiers from qualified array types in catches
While we ran getUnqualifiedType over the catch type,
it isn't enough for array types.  Use getUnqualifiedArrayType instead.

This fixes PR21252.

llvm-svn: 219582
2014-10-12 06:58:22 +00:00
Chandler Carruth 60fdc41346 Suppress a warning about an unused variable in NDEBUG builds.
llvm-svn: 219571
2014-10-11 11:29:26 +00:00
Chandler Carruth b29a743891 [complex] Teach the other two binary operators on complex numbers (==
and !=) to support mixed complex and real operand types.

This requires removing an assert from SemaChecking, and adding support
both to the constant evaluator and the code generator to synthesize the
imaginary part when needed. This seemed somewhat cleaner than having
just the comparison operators force real-to-complex conversions.

I've added test cases for these operations. I'm really terrified that
there were *no* tests in-tree which exercised this.

This turned up when trying to build R after my change to the complex
type lowering.

llvm-svn: 219570
2014-10-11 11:03:30 +00:00
Chandler Carruth 686de24128 [complex] Use the much more powerful EmitCall routine to call libcalls
for complex math.

This should fix the windows build bots that started having trouble here
and generally fix complex libcall emission on targets which use sret for
complex data types. It also makes the code a bit simpler (despite
calling into a much more complex bucket of code).

llvm-svn: 219565
2014-10-11 09:24:41 +00:00
Daniel Jasper ec8e838baa clang-format: [ObjC] Wrap ObjC method declarations before annotations.
Before:
  - (instancetype)initXxxxxxxxxxxxxxxxxxxxxxxxx:(id<x>)x
                                              y:(id<yyyyyyyyyyyyyyyyyyyy>)
                                                    y NS_DESIGNATED_INITIALIZER;
After:
  - (instancetype)initXxxxxxxxxxxxxxxxxxxxxxxxx:(id<x>)x
                                              y:(id<yyyyyyyyyyyyyyyyyyyy>)y
      NS_DESIGNATED_INITIALIZER;

llvm-svn: 219564
2014-10-11 08:24:56 +00:00
Alexey Bataev 8d4fae3d8b Fix deserialization of PredefinedExpr in dependent context.
llvm-svn: 219561
2014-10-11 05:07:24 +00:00
Chandler Carruth a216cad0fc [complex] Teach Clang to preserve different-type operands to arithmetic
operators where one type is a C complex type, and to emit both the
efficient and correct implementation for complex arithmetic according to
C11 Annex G using this extra information.

For both multiply and divide the old code was writing a long-hand
reduced version of the math without any of the special handling of inf
and NaN recommended by the standard here. Instead of putting more
complexity here, this change does what GCC does which is to emit
a libcall for the fully general case.

However, the old code also failed to do the proper minimization of the
set of operations when there was a mixed complex and real operation. In
those cases, C provides a spec for much more minimal operations that are
valid. Clang now emits the exact suggested operations. This change isn't
*just* about performance though, without minimizing these operations, we
again lose the correct handling of infinities and NaNs. It is critical
that this happen in the frontend based on assymetric type operands to
complex math operations.

The performance implications of this change aren't trivial either. I've
run a set of benchmarks in Eigen, an open source mathematics library
that makes heavy use of complex. While a few have slowed down due to the
libcall being introduce, most sped up and some by a huge amount: up to
100% and 140%.

In order to make all of this work, also match the algorithm in the
constant evaluator to the one in the runtime library. Currently it is
a broken port of the simplifications from C's Annex G to the long-hand
formulation of the algorithm.

Splitting this patch up is very hard because none of this works without
the AST change to preserve non-complex operands. Sorry for the enormous
change.

Follow-up changes will include support for sinking the libcalls onto
cold paths in common cases and fastmath improvements to allow more
aggressive backend folding.

Differential Revision: http://reviews.llvm.org/D5698

llvm-svn: 219557
2014-10-11 00:57:18 +00:00
Richard Smith 41c79d934b [modules] When instantiating a class member, don't expect to find the previous
declaration in the instantiation if the previous declaration came from another
definition of the class template that got merged into the pattern definition.

llvm-svn: 219552
2014-10-11 00:37:16 +00:00
Ehsan Akhgari 4b5ca9a222 clang-cl: Don't warn for unused private fields when encountering a late parsed template member
Summary: This fixes PR21235.

Test Plan: Includes an automated test.

Reviewers: hansw

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5718

llvm-svn: 219551
2014-10-11 00:24:15 +00:00
Bob Wilson 7f294b54b3 Treat -mios-simulator-version-min option as an alias for -mios-version-min.
We can safely rely on the architecture to distinguish iOS device builds from
iOS simulator builds. We already have code to do that, in fact. This simplifies
some of the error checking for the option handling.

llvm-svn: 219545
2014-10-10 23:10:10 +00:00
Richard Smith 337f7c9716 [modules] Delay loading the field declared with an anonymous tag declaration
until after we've had a chance to merge that tag.

llvm-svn: 219539
2014-10-10 22:37:41 +00:00
Fariborz Jahanian c985a7f6df Objective-C [qoi]. When reporting that a property is not
auto synthesized because it is synthesized in its super
class. locate property declaration in super class
which will default synthesize the property. rdar://18488727

llvm-svn: 219535
2014-10-10 22:08:23 +00:00
Bob Wilson f42585fd96 Remove rest of the comment that is no longer true after r219527.
llvm-svn: 219528
2014-10-10 19:59:18 +00:00
Bob Wilson 771b7cd812 Remove a FIXME: use the ios_simulator_version_min linker option consistently.
This was previously only used when explicitly requested with a command line
option because it had to work with some old versions of the linker when it
was first introduced. That is ancient history now, and it should be safe to
use the correct option even when using the IPHONEOS_DEPLOYMENT_TARGET
environment variable to specify that the target is the iOS simulator.
Besides updating the test for this, I also added a few more tests for the
iOS linker options.

llvm-svn: 219527
2014-10-10 19:38:34 +00:00
Alexey Bataev 769562a382 Bugfix for predefined expressions in dependent context.
This bug break compilation with precompiled headers and predefined expressions in dependent context.

llvm-svn: 219525
2014-10-10 18:58:13 +00:00
David Majnemer a586eb2c70 CodeGen: FieldMemcpyizer didn't handle copies starting inside bitfields
It's possible to construct cases where the first field we are trying to
copy is in the middle of an IR field.  In some complicated cases, we
would fail to use an appropriate offset inside the object.  Earlier
builds of clang seemed to miscompile the code by copying an insufficient
number of bytes.  Up until now, we would assert: the copying offset was
insufficiently aligned.

This fixes PR21232.

llvm-svn: 219524
2014-10-10 18:57:10 +00:00
John McCall c90c1498f0 Change how we distinguish bitfield widths, in-class
initializers, and captured VLA types so that we can
answer questions like "is this a bit-field" without
looking at the enclosing DeclContext.  NFC.

llvm-svn: 219522
2014-10-10 18:44:34 +00:00
Bill Schmidt 8c184e3627 [PowerPC] Reduce names from Power8Vector to P8Vector
Per Hal Finkel's review, improving typability of some variable names.

llvm-svn: 219515
2014-10-10 17:21:23 +00:00
Benjamin Kramer ad8e079c61 Reduce double set lookups. NFC.
llvm-svn: 219504
2014-10-10 15:32:48 +00:00
Bill Schmidt 59eb767e11 [PowerPC] Add feature for Power8 vector extensions
The current VSX feature for PowerPC specifies availability of the VSX
instructions added with the 2.06 architecture version.  With 2.07, the
architecture adds new instructions to both the Category:Vector and
Category:VSX instruction sets.  Additionally, unaligned vector storage
operations have improved performance.

This patch adds a feature to provide access to the new instructions
and performance capabilities of Power8.  For compatibility with GCC,
the feature is controlled via a new -mpower8-vector switch, and the
feature causes the __POWER8_VECTOR__ builtin define to be generated by
the preprocessor.

There is a companion patch for llvm being committed at the same time.

llvm-svn: 219502
2014-10-10 15:09:43 +00:00
Benjamin Kramer c52193f4c7 Unfriend CGOpenMPRegionInfo so it can go into an anonymous namespace.
Also remove some unnecessary virtual keywords. NFC.

llvm-svn: 219497
2014-10-10 13:57:57 +00:00
Aaron Ballman c6924d8690 Fixing the MSVC 2013 build, NFC.
llvm-svn: 219491
2014-10-10 12:40:56 +00:00
Alexey Bataev 1809571c76 Code reformatting and improvement for OpenMP.
Moved CGOpenMPRegionInfo from CGOpenMPRuntime.h to CGOpenMPRuntime.cpp file and reworked the code for this change. Also added processing of ThreadID variable passed as an argument in outlined functions in parallel and task directives.

llvm-svn: 219490
2014-10-10 12:19:54 +00:00
Alexey Bataev 435ad7ba5e Code improvements in OpenMP CodeGen.
This patch makes class OMPPrivateScope a common class for all private variables. Reworked processing of firstprivate variables (now it is based on OMPPrivateScope too).

llvm-svn: 219486
2014-10-10 09:48:26 +00:00
Nick Lewycky 5d1159ebe9 Revert r218865 because it introduced PR21236, a crash in codegen emitting the try block.
llvm-svn: 219470
2014-10-10 04:05:00 +00:00
Bob Wilson 43ec870a73 Remove support for the IOS_SIMULATOR_DEPLOYMENT_TARGET env var.
It turns out that this was never used. Instead we just use the
IPHONEOS_DEPLOYMENT_TARGET variable for both iOS devices and simulator.
rdar://problem/18596744

llvm-svn: 219467
2014-10-10 03:12:15 +00:00
Dan Albert a4ec57c2c5 Hopefully fixes test failures for msvc.
Looks like llvm::sys::path::filename() was canonicalizing my paths
before emitting them for FileCheck to stumble over.

Fix a style nit with r219460 while I'm at it.

llvm-svn: 219464
2014-10-10 02:26:00 +00:00
Dan Albert b8e7eaedcb PR21195: Emit .gcno files to the proper location.
When building with coverage, -no-integrated-as, and -c, the driver was
emitting -cc1 -coverage-file pointing at a file in /tmp. Ensure the
coverage file is emitted in the same directory as the output file.

llvm-svn: 219460
2014-10-10 01:01:29 +00:00
Reid Kleckner 79b0fd7a48 Promote null pointer constants used as arguments to variadic functions
Make it possible to pass NULL through variadic functions on 64-bit
Windows targets. The Visual C++ headers define NULL to 0, when they
should define it to 0LL on Win64 so that NULL is a pointer-sized
integer.

Fixes PR20949.

Reviewers: thakis, rsmith

Differential Revision: http://reviews.llvm.org/D5480

llvm-svn: 219456
2014-10-10 00:05:45 +00:00
Samuel Benzaquen b63c251894 Fix completion logic to allow for heterogeneous argument types in matcher overloads.
Summary:
There was an assumption that there were no matchers that were overloaded
on matchers and other types of arguments.
This assumption was broken recently with the addition of new matcher
overloads.

Fixes http://llvm.org/PR21226

Reviewers: pcc

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5711

llvm-svn: 219450
2014-10-09 22:08:52 +00:00