platform/upstream/llvm.git
9 years agoSimplify the test by using multiple --check-prefix arguments
Alexey Samsonov [Tue, 11 Nov 2014 21:50:44 +0000 (21:50 +0000)]
Simplify the test by using multiple --check-prefix arguments

llvm-svn: 221713

9 years agoRevert "IR: MDNode => Value: Update for LLVM API change in r221375"
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 21:31:03 +0000 (21:31 +0000)]
Revert "IR: MDNode => Value: Update for LLVM API change in r221375"

This reverts commit r221376.

The API change was reverted in r221711.

llvm-svn: 221712

9 years agoRevert "IR: MDNode => Value"
Duncan P. N. Exon Smith [Tue, 11 Nov 2014 21:30:22 +0000 (21:30 +0000)]
Revert "IR: MDNode => Value"

Instead, we're going to separate metadata from the Value hierarchy.  See
PR21532.

This reverts commit r221375.
This reverts commit r221373.
This reverts commit r221359.
This reverts commit r221167.
This reverts commit r221027.
This reverts commit r221024.
This reverts commit r221023.
This reverts commit r220995.
This reverts commit r220994.

llvm-svn: 221711

9 years agoFix build break: remove unused variable in FCFI.
Tom Roeder [Tue, 11 Nov 2014 21:26:33 +0000 (21:26 +0000)]
Fix build break: remove unused variable in FCFI.

llvm-svn: 221710

9 years agoTotally forget deallocated SDNodes in SDDbgInfo.
Frederic Riss [Tue, 11 Nov 2014 21:21:08 +0000 (21:21 +0000)]
Totally forget deallocated SDNodes in SDDbgInfo.

What would happen before that commit is that the SDDbgValues associated with
a deallocated SDNode would be marked Invalidated, but SDDbgInfo would keep
a map entry keyed by the SDNode pointer pointing to this list of invalidated
SDDbgNodes. As the memory gets reused, the list might get wrongly associated
with another new SDNode. As the SDDbgValues are cloned when they are transfered,
this can lead to an exponential number of SDDbgValues being produced during
DAGCombine like in http://llvm.org/bugs/show_bug.cgi?id=20893

Note that the previous behavior wasn't really buggy as the invalidation made
sure that the SDDbgValues won't be used. This commit can be considered a
memory optimization and as such is really hard to validate in a unit-test.

llvm-svn: 221709

9 years agoAdd Forward Control-Flow Integrity.
Tom Roeder [Tue, 11 Nov 2014 21:08:02 +0000 (21:08 +0000)]
Add Forward Control-Flow Integrity.

This commit adds a new pass that can inject checks before indirect calls to
make sure that these calls target known locations. It supports three types of
checks and, at compile time, it can take the name of a custom function to call
when an indirect call check fails. The default failure function ignores the
error and continues.

This pass incidentally moves the function JumpInstrTables::transformType from
private to public and makes it static (with a new argument that specifies the
table type to use); this is so that the CFI code can transform function types
at call sites to determine which jump-instruction table to use for the check at
that site.

Also, this removes support for jumptables in ARM, pending further performance
analysis and discussion.

Review: http://reviews.llvm.org/D4167
llvm-svn: 221708

9 years ago[llvm-mc] Fixing case where if a file ended with non-newline whitespace or a comma...
Colin LeMahieu [Tue, 11 Nov 2014 21:03:09 +0000 (21:03 +0000)]
[llvm-mc] Fixing case where if a file ended with non-newline whitespace or a comma it would access invalid memory.
Cleaned up parse loop.

llvm-svn: 221707

9 years agoUse rcpss/rcpps (X86) to speed up reciprocal calcs (PR21385).
Sanjay Patel [Tue, 11 Nov 2014 20:51:00 +0000 (20:51 +0000)]
Use rcpss/rcpps (X86) to speed up reciprocal calcs (PR21385).

This is a first step for generating SSE rcp instructions for reciprocal
calcs when fast-math allows it. This is very similar to the rsqrt optimization
enabled in D5658 ( http://reviews.llvm.org/rL220570 ).

For now, be conservative and only enable this for AMD btver2 where performance
improves significantly both in terms of latency and throughput.

We may never enable this codegen for Intel Core* chips because the divider circuits
are just too fast. On SandyBridge, divss can be as fast as 10 cycles versus the 21
cycle critical path for the rcp + mul + sub + mul + add estimate.

Follow-on patches may allow configuration of the number of Newton-Raphson refinement
steps, add AVX512 support, and enable the optimization for more chips.

More background here: http://llvm.org/bugs/show_bug.cgi?id=21385

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

llvm-svn: 221706

9 years agoSimplify testcase. NFC.
Rafael Espindola [Tue, 11 Nov 2014 20:49:16 +0000 (20:49 +0000)]
Simplify testcase. NFC.

Thanks to Filipe Cabecinhas for the tip.

llvm-svn: 221705

9 years agoPR16091 continued: Debug Info for member functions with undeduced return types.
David Blaikie [Tue, 11 Nov 2014 20:44:45 +0000 (20:44 +0000)]
PR16091 continued: Debug Info for member functions with undeduced return types.

So DWARF5 specs out auto deduced return types as DW_TAG_unspecified_type
with DW_AT_name "auto", and GCC implements this somewhat, but it
presents a few problems to do this with Clang.

GCC's implementation only applies to member functions where the auto
return type isn't deduced immediately (ie: member functions of templates
or member functions defined out of line). In the common case of an
inline deduced return type function, GCC emits the DW_AT_type as the
deduced return type.

Currently GDB doesn't seem to behave too well with this debug info - it
treats the return type as 'void', even though the definition of the
function has the correctly deduced return type (I guess it sees the
return type the declaration has, doesn't understand it, and assumes
void). This means the function's ABI might be broken (non-trivial return
types, etc), etc.

Clang, on the other hand doesn't track this particular case of a
deducable return type that is deduced immediately versus one that is
deduced 'later'. So if we implement the DWARF5 representation, all
deducible return type functions would get adverse GDB behavior
(including deduced return type lambda functions, inline deduced return
type functions, etc).

Also, we can't just do this for auto types that are not deduced -
because Clang marks even the declaration's return type as deduced (&
provides the underlying type) once a definition is seen that allows the
deduction. So we have to ignore even deduced types - but we can't do
that for auto variables (because this representation only applies to
function declarations - variables and function definitions need the real
type so the function can be called, etc) so we'd need to add an extra
flag to the type unwrapping/creation code to indicate when we want to
see through deduced types and when we don't. It's also not as simple as
just checking at the top level when building a function type (for one
thing, we reuse the function type building for building function pointer
types which might also have 'auto' in them - but be the type of a
variable instead) because the auto might be arbitrarily deeply nested
("auto &", "auto (*)()", etc...)

So, with all that said, let's do the simple thing that works in existing
debuggers for now and treat these functions the same way we do function
templates and implicit special members: omit them from the member list,
since they can't be correctly called anyway (without knowing the return
type the ABI isn't know and a function call could put the arguments in
the wrong place) so they're not much use to the user.

At some point in the future, when GDB understands the DWARF5
representation better it might be worth plumbing through the extra type
builder handling to avoid looking through AutoType for some callers,
etc...

llvm-svn: 221704

9 years ago[PowerPC] Replace foul hackery with real calls to __tls_get_addr
Bill Schmidt [Tue, 11 Nov 2014 20:44:09 +0000 (20:44 +0000)]
[PowerPC] Replace foul hackery with real calls to __tls_get_addr

My original support for the general dynamic and local dynamic TLS
models contained some fairly obtuse hacks to generate calls to
__tls_get_addr when lowering a TargetGlobalAddress.  Rather than
generating real calls, special GET_TLS_ADDR nodes were used to wrap
the calls and only reveal them at assembly time.  I attempted to
provide correct parameter and return values by chaining CopyToReg and
CopyFromReg nodes onto the GET_TLS_ADDR nodes, but this was also not
fully correct.  Problems were seen with two back-to-back stores to TLS
variables, where the call sequences ended up overlapping with unhappy
results.  Additionally, since these weren't real calls, the proper
register side effects of a call were not recorded, so clobbered values
were kept live across the calls.

The proper thing to do is to lower these into calls in the first
place.  This is relatively straightforward; see the changes to
PPCTargetLowering::LowerGlobalTLSAddress() in PPCISelLowering.cpp.
The changes here are standard call lowering, except that we need to
track the fact that these calls will require a relocation.  This is
done by adding a machine operand flag of MO_TLSLD or MO_TLSGD to the
TargetGlobalAddress operand that appears earlier in the sequence.

The calls to LowerCallTo() eventually find their way to
LowerCall_64SVR4() or LowerCall_32SVR4(), which call FinishCall(),
which calls PrepareCall().  In PrepareCall(), we detect the calls to
__tls_get_addr and immediately snag the TargetGlobalTLSAddress with
the annotated relocation information.  This becomes an extra operand
on the call following the callee, which is expected for nodes of type
tlscall.  We change the call opcode to CALL_TLS for this case.  Back
in FinishCall(), we change it again to CALL_NOP_TLS for 64-bit only,
since we require a TOC-restore nop following the call for the 64-bit
ABIs.

During selection, patterns in PPCInstrInfo.td and PPCInstr64Bit.td
convert the CALL_TLS nodes into BL_TLS nodes, and convert the
CALL_NOP_TLS nodes into BL8_NOP_TLS nodes.  This replaces the code
removed from PPCAsmPrinter.cpp, as the BL_TLS or BL8_NOP_TLS
nodes can now be emitted normally using their patterns and the
associated printTLSCall print method.

Finally, as a result of these changes, all references to get-tls-addr
in its various guises are no longer used, so they have been removed.

There are existing TLS tests to verify the changes haven't messed
anything up).  I've added one new test that verifies that the problem
with the original code has been fixed.

llvm-svn: 221703

9 years agoPatch to warn when logical evaluation of operand evalutes to a true value;
Fariborz Jahanian [Tue, 11 Nov 2014 19:59:16 +0000 (19:59 +0000)]
Patch to warn when logical evaluation of operand evalutes to a true value;
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393

llvm-svn: 221702

9 years agoMove a bunch of summary formatters to oneliner mode. This makes more cases eligible...
Enrico Granata [Tue, 11 Nov 2014 19:52:12 +0000 (19:52 +0000)]
Move a bunch of summary formatters to oneliner mode. This makes more cases eligible for oneline printing, and fixes rdar://18120906

llvm-svn: 221701

9 years agoUse a 8 bit immediate when possible.
Rafael Espindola [Tue, 11 Nov 2014 19:46:36 +0000 (19:46 +0000)]
Use a 8 bit immediate when possible.

This fixes pr21529.

llvm-svn: 221700

9 years agoclang-format: Preserve trailing-comma logic even with comments.
Daniel Jasper [Tue, 11 Nov 2014 19:34:57 +0000 (19:34 +0000)]
clang-format: Preserve trailing-comma logic even with comments.

Before:
  vector<int> SomeVector = {// aaa
                            1, 2,
  };

After:
  vector<int> SomeVector = {
      // aaa
      1, 2,
  };

llvm-svn: 221699

9 years agoFirst half of CWG1962: decltype(__func__) should not be a reference type,
Richard Smith [Tue, 11 Nov 2014 19:30:41 +0000 (19:30 +0000)]
First half of CWG1962: decltype(__func__) should not be a reference type,
because __func__ is supposed to act like a local static variable.

llvm-svn: 221698

9 years agoFix typo in allocator_traits::construct. This fixes PR14175, which shows up if an...
Marshall Clow [Tue, 11 Nov 2014 19:22:33 +0000 (19:22 +0000)]
Fix typo in allocator_traits::construct. This fixes PR14175, which shows up if an allocator has a no-args construct method

llvm-svn: 221697

9 years agoFix a warning about ‘r_type’ may be used uninitialized.
Kevin Enderby [Tue, 11 Nov 2014 19:16:45 +0000 (19:16 +0000)]
Fix a warning about ‘r_type’ may be used uninitialized.

Thanks to Aaron Ballman for noticing this!

llvm-svn: 221696

9 years ago[X86][ELF] Fix PR20243 - leaf frame pointer bug with TLS access
Dario Domizioli [Tue, 11 Nov 2014 18:44:49 +0000 (18:44 +0000)]
[X86][ELF] Fix PR20243 - leaf frame pointer bug with TLS access

The ISel lowering for global TLS access in PIC mode was creating a pseudo
instruction that is later expanded to a call, but the code was not
setting the hasCalls flag in the MachineFrameInfo alongside the adjustsStack
flag. This caused some functions to be mistakenly recognized as leaf functions,
and this in turn affected the decision to eliminate the frame pointer.

With the fix, hasCalls is properly set and the leaf frame pointer is correctly
preserved.

llvm-svn: 221695

9 years agoAdd -std=c99 for building the test case of TestValueVarUpdate - for Siva Chandra...
Shawn Best [Tue, 11 Nov 2014 17:45:00 +0000 (17:45 +0000)]
Add -std=c99 for building the test case of TestValueVarUpdate - for Siva Chandra : reviews.llvm.org/D6201

llvm-svn: 221694

9 years agoLLVM incorrectly folds xor into select
Oliver Stannard [Tue, 11 Nov 2014 17:36:01 +0000 (17:36 +0000)]
LLVM incorrectly folds xor into select

LLVM replaces the SelectionDAG pattern (xor (set_cc cc x y) 1) with
(set_cc !cc x y), which is only correct when the xor has type i1.
Instead, we should check that the constant operand to the xor is all
ones.

llvm-svn: 221693

9 years agoSubstitute cc with c++ when compiling c++ test files for Siva Chandra : http://review...
Shawn Best [Tue, 11 Nov 2014 17:34:58 +0000 (17:34 +0000)]
Substitute cc with c++ when compiling c++ test files for Siva Chandra : reviews.llvm.org/D6199

llvm-svn: 221692

9 years agoThis patch fixes a crash after rebuilding call AST of
Fariborz Jahanian [Tue, 11 Nov 2014 16:56:21 +0000 (16:56 +0000)]
This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
(patch reapplied after lldb issue was fixed in r221660).

llvm-svn: 221691

9 years agoFixed a typo in a paper name: 4190 --> N4190
Marshall Clow [Tue, 11 Nov 2014 16:45:50 +0000 (16:45 +0000)]
Fixed a typo in a paper name: 4190 --> N4190

llvm-svn: 221690

9 years agoAdded vector<T>::insert tests suggested by code coverage results
Marshall Clow [Tue, 11 Nov 2014 16:44:05 +0000 (16:44 +0000)]
Added vector<T>::insert tests suggested by code coverage results

llvm-svn: 221689

9 years agoDiagnosticParseKinds is close to running into DiagnosticASTKinds.
Manuel Klimek [Tue, 11 Nov 2014 15:45:49 +0000 (15:45 +0000)]
DiagnosticParseKinds is close to running into DiagnosticASTKinds.

$ grep "def " include/clang/Basic/DiagnosticParseKinds.td |wc -l
396

llvm-svn: 221688

9 years ago[ASan] Fix use of -asan-instrument-assembly in tests
Jay Foad [Tue, 11 Nov 2014 13:44:08 +0000 (13:44 +0000)]
[ASan] Fix use of -asan-instrument-assembly in tests

Summary:
The option -asan-instrument-assembly is declared in the X86 backend.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=All then the
option is tolerated but ignored.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=PowerPC then
the testsuite fails with:
[ 93%] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64-inline.o
clang (LLVM option parsing): Unknown command line argument '-asan-instrument-assembly'.  Try: 'clang (LLVM option parsing) -help'

Fix this inconsistency by only adding the option if that toolchain was
built with the X86 backend included.

Reviewers: kcc, samsonov, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 221687

9 years ago[mips] Add preliminary support for the MIPS II target.
Vasileios Kalintiris [Tue, 11 Nov 2014 11:43:55 +0000 (11:43 +0000)]
[mips] Add preliminary support for the MIPS II target.

Summary:
This patch enables code generation for the MIPS II target. Pre-Mips32
targets don't have the MUL instruction, so we add the correspondent
pattern that uses the MULT/MFLO combination in order to retrieve the
product.

This is WIP as we don't support code generation for select nodes due to
the lack of conditional-move instructions.

Reviewers: dsanders

Subscribers: llvm-commits

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

llvm-svn: 221686

9 years ago[mips] Add hardware register name "hwr_ulr" ($29)
Vasileios Kalintiris [Tue, 11 Nov 2014 11:22:39 +0000 (11:22 +0000)]
[mips] Add hardware register name "hwr_ulr" ($29)

The canonical name when printing assembly is still $29. The reason is that
GAS does not accept "$hwr_ulr" at the moment.

This addresses the comments from r221307, which reverted the original
commit r221299.

llvm-svn: 221685

9 years ago[X86] Add missing check for 'isINSERTPSMask' in method 'isShuffleMaskLegal'.
Andrea Di Biagio [Tue, 11 Nov 2014 11:20:31 +0000 (11:20 +0000)]
[X86] Add missing check for 'isINSERTPSMask' in method 'isShuffleMaskLegal'.

This helps the DAGCombiner to identify more opportunities to fold shuffles.

llvm-svn: 221684

9 years agoAdd support for 32-bit core file dumping. Add support for i386 process core file...
Jason Molenda [Tue, 11 Nov 2014 10:59:15 +0000 (10:59 +0000)]
Add support for 32-bit core file dumping.  Add support for i386 process core file dumping.

llvm-svn: 221683

9 years agoPut the current pc arrow back into the default disassembly format.
Jason Molenda [Tue, 11 Nov 2014 10:32:04 +0000 (10:32 +0000)]
Put the current pc arrow back into the default disassembly format.
I went back and forth on removing this - and tried dropping it for
a few weeks.  But when you're working at an assembly language, it
really is helpful to have this displayed to show where the current
pc is.

llvm-svn: 221682

9 years agoRecommit "[mips] Add names and tests for the hardware registers"
Vasileios Kalintiris [Tue, 11 Nov 2014 10:31:31 +0000 (10:31 +0000)]
Recommit "[mips] Add names and tests for the hardware registers"

The original commit r221299 was reverted in r221307.  I removed the name
"hrw_ulr" ($29) from the original commit because two tests were failing.

llvm-svn: 221681

9 years agollvm-objdump: Skip empty sections when dumping contents
David Majnemer [Tue, 11 Nov 2014 09:58:25 +0000 (09:58 +0000)]
llvm-objdump: Skip empty sections when dumping contents

Empty sections are just noise when using objdump.
This is similar to what binutils does.

llvm-svn: 221680

9 years agoWas convinced in commit comments that requiring a specific python version is the...
Manuel Klimek [Tue, 11 Nov 2014 08:53:18 +0000 (08:53 +0000)]
Was convinced in commit comments that requiring a specific python version is the wrong approach; reverting.

llvm-svn: 221679

9 years agoMC, COFF: Use relocations for function references inside the section
David Majnemer [Tue, 11 Nov 2014 08:43:57 +0000 (08:43 +0000)]
MC, COFF: Use relocations for function references inside the section

Referencing one symbol from another in the same section does not
generally require a relocation.  However, the MS linker has a feature
called /INCREMENTAL which enables incremental links.  It achieves this
by creating thunks to the actual function and redirecting all
relocations to point to the thunk.

This breaks down with the old scheme if you have a function which
references, say, itself.  On x86_64, we would use %rip relative
addressing to reference the start of the function from out current
position.  This would lead to miscompiles because other references might
reference the thunk instead, breaking function pointer equality.

This fixes PR21520.

llvm-svn: 221678

9 years agoAdd an operator== to the RegisterNumber class; it simplifies
Jason Molenda [Tue, 11 Nov 2014 08:26:44 +0000 (08:26 +0000)]
Add an operator== to the RegisterNumber class; it simplifies
RegisterContextLLDB a bit more in a few places.

llvm-svn: 221677

9 years agoCGOpenMPRuntime.h: Fix a couple of \param(s) introduced in r221663. [-Wdocumentation]
NAKAMURA Takumi [Tue, 11 Nov 2014 07:58:06 +0000 (07:58 +0000)]
CGOpenMPRuntime.h: Fix a couple of \param(s) introduced in r221663. [-Wdocumentation]

llvm-svn: 221676

9 years ago[CMake] llvm-shlib: Prune redundant components, AsmPrinter, MC, and SelectionDAG.
NAKAMURA Takumi [Tue, 11 Nov 2014 07:57:25 +0000 (07:57 +0000)]
[CMake] llvm-shlib: Prune redundant components, AsmPrinter, MC, and SelectionDAG.

llvm-svn: 221675

9 years agoAddition to r216371 (SLP and Loop Vectorization) and r218607 where
Suyog Sarda [Tue, 11 Nov 2014 07:39:27 +0000 (07:39 +0000)]
Addition to r216371 (SLP and Loop Vectorization) and r218607 where
cost model for signed division by power of 2 was improved for AArch64.
The revision r218607 missed test case for Loop Vectorization.
Adding it in this revision.

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

llvm-svn: 221674

9 years agoUse uint64_t as the type for the X86 TSFlag format enum. Allows removal of the VEXShi...
Craig Topper [Tue, 11 Nov 2014 07:32:32 +0000 (07:32 +0000)]
Use uint64_t as the type for the X86 TSFlag format enum. Allows removal of the VEXShift hack that was used to access the higher bits of TSFlags.

llvm-svn: 221673

9 years ago[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext
Michael Kuperstein [Tue, 11 Nov 2014 07:07:40 +0000 (07:07 +0000)]
[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext

This fixes an issue with matching trunc -> assertsext -> zext on x86-64, which would not zero the high 32-bits. See PR20494 for details.
Recommitting - This time, with a hopefully working test.

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

llvm-svn: 221672

9 years agoOnly run the gold plugin tests if gold supports the targets we test with.
Rafael Espindola [Tue, 11 Nov 2014 05:27:12 +0000 (05:27 +0000)]
Only run the gold plugin tests if gold supports the targets we test with.

This fixes pr21345.

llvm-svn: 221669

9 years ago[NVPTX] Remove dead code in NVPTXTargetTransformInfo (NFC)
Jingyue Wu [Tue, 11 Nov 2014 05:24:04 +0000 (05:24 +0000)]
[NVPTX] Remove dead code in NVPTXTargetTransformInfo (NFC)

llvm-svn: 221668

9 years agoMCAsmParserExtension has a copy of the MCAsmParser. Use it.
Rafael Espindola [Tue, 11 Nov 2014 05:18:41 +0000 (05:18 +0000)]
MCAsmParserExtension has a copy of the MCAsmParser. Use it.

Base classes were storing a second copy.

llvm-svn: 221667

9 years agoAdd const. NFC.
Rafael Espindola [Tue, 11 Nov 2014 05:11:47 +0000 (05:11 +0000)]
Add const. NFC.

This adds const to a few methods that already return const references or
creates a const version when they reterun non-const references.

llvm-svn: 221666

9 years agoDon't duplicate names in comments. NFC.
Rafael Espindola [Tue, 11 Nov 2014 04:58:32 +0000 (04:58 +0000)]
Don't duplicate names in comments. NFC.

llvm-svn: 221665

9 years agoDon't repeat name in comment. NFC.
Rafael Espindola [Tue, 11 Nov 2014 04:49:14 +0000 (04:49 +0000)]
Don't repeat name in comment. NFC.

llvm-svn: 221664

9 years ago[OPENMP] Codegen for threadprivate variables
Alexey Bataev [Tue, 11 Nov 2014 04:05:39 +0000 (04:05 +0000)]
[OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>);
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002

llvm-svn: 221663

9 years agoFix parsing of fold-expressions within a cast expression. We parse the
Richard Smith [Tue, 11 Nov 2014 03:28:50 +0000 (03:28 +0000)]
Fix parsing of fold-expressions within a cast expression. We parse the
parenthesized expression a bit differently in this case, just in case the
commas have special meaning.

llvm-svn: 221661

9 years agoMade the expression parser more resilient against
Sean Callanan [Tue, 11 Nov 2014 02:49:44 +0000 (02:49 +0000)]
Made the expression parser more resilient against
being asked about symbols it doesn't know about.  If
it's asked about a symbol by mangled name and it finds
nothing, then it will try again with the demangled
base name.

llvm-svn: 221660

9 years agoInstrProf: Remove an unnecessary helper function (NFC)
Justin Bogner [Tue, 11 Nov 2014 02:47:05 +0000 (02:47 +0000)]
InstrProf: Remove an unnecessary helper function (NFC)

VisitSubStmtRBraceState is really just Visit, as long as
VisitCompoundStatement handles braces correctly.

llvm-svn: 221659

9 years agoIgnore templated aggregates in the Objective-C
Sean Callanan [Tue, 11 Nov 2014 02:27:22 +0000 (02:27 +0000)]
Ignore templated aggregates in the Objective-C
runtime.  This eliminates potential confusion
when the compiler has to deal with these weird
types later on.

One day I'd like to actually generate the proper
templates, but this is not the day that I write
the parser code to do that.

<rdar://problem/18887634>

llvm-svn: 221658

9 years ago[X86] Custom lower UINT_TO_FP from v4f32 to v4i32, and for v8f32 to v8i32 if
Quentin Colombet [Tue, 11 Nov 2014 02:23:47 +0000 (02:23 +0000)]
[X86] Custom lower UINT_TO_FP from v4f32 to v4i32, and for v8f32 to v8i32 if
AVX2 is available.
According to IACA, the new lowering has a throughput of 8 cycles instead of 13
with the previous one.

Althought this lowering kicks in some SPECs benchmarks, the performance
improvement was within the noise.

Correctness testing has been done for the whole range of uint32_t with the
following program:
    uint4 v = (uint4) {0,1,2,3};
    uint32_t i;

    //Check correctness over entire range for uint4 -> float4 conversion
    for( i = 0; i < 1U << (32-2); i++ )
    {
        float4 t = test(v);
        float4 c = correct(v);

        if( 0xf != _mm_movemask_ps( t == c ))
        {
            printf( "Error @ %vx: %vf vs. %vf\n", v, c, t);
            return -1;
        }

        v += 4;
    }
Where "correct" is the old lowering and "test" the new one.

The patch adds a test case for the two custom lowering instruction.
It also modifies the vector cost model, which is why cast.ll and uitofp.ll are
modified.
2009-02-26-MachineLICMBug.ll is also modified because we now hoist 7
instructions instead of 4 (3 more constant loads).

rdar://problem/18153096>

llvm-svn: 221657

9 years agoAdd a missing parenthesis mistakenly dropped in r221621.
Bob Wilson [Tue, 11 Nov 2014 02:05:56 +0000 (02:05 +0000)]
Add a missing parenthesis mistakenly dropped in r221621.

llvm-svn: 221656

9 years agoCGExpr.cpp: Suppress a warning. [-Wunused-variable]
NAKAMURA Takumi [Tue, 11 Nov 2014 01:36:11 +0000 (01:36 +0000)]
CGExpr.cpp: Suppress a warning. [-Wunused-variable]

llvm-svn: 221655

9 years ago[mach-o] Fix lazy binding offsets
Nick Kledzik [Tue, 11 Nov 2014 01:31:18 +0000 (01:31 +0000)]
[mach-o] Fix lazy binding offsets

The way lazy binding works in mach-o is that the linker generates a helper
function and has the stub (PLT) initially jump to it.  The helper function
pushes an extra parameter then jumps into dyld.  The extra parameter is an
offset into the lazy binding info where dyld will find the information about
which symbol to bind and way lazy binding pointer to update.

llvm-svn: 221654

9 years ago[Sanitizer] Refactor sanitizer options in LangOptions.
Alexey Samsonov [Tue, 11 Nov 2014 01:26:14 +0000 (01:26 +0000)]
[Sanitizer] Refactor sanitizer options in LangOptions.

Get rid of ugly SanitizerOptions class thrust into LangOptions:
* Make SanitizeAddressFieldPadding a regular language option,
  and rely on default behavior to initialize/reset it.
* Make SanitizerBlacklistFile a regular member LangOptions.
* Introduce the helper class "SanitizerSet" to represent the
  set of enabled sanitizers and make it a member of LangOptions.
  It is exactly the entity we want to cache and modify in CodeGenFunction,
  for instance. We'd also be able to reuse SanitizerSet in
  CodeGenOptions for storing the set of recoverable sanitizers,
  and in the Driver to represent the set of sanitizers
  turned on/off by the commandline flags.

No functionality change.

llvm-svn: 221653

9 years agospeling.
Nico Weber [Tue, 11 Nov 2014 01:13:42 +0000 (01:13 +0000)]
speling.

llvm-svn: 221652

9 years agoFixed two issues in the type encoding parser:
Sean Callanan [Tue, 11 Nov 2014 00:50:10 +0000 (00:50 +0000)]
Fixed two issues in the type encoding parser:

- A correctness issue: with assertions disabled,
  ReadQuotedString would misbehave; and

- A performance issue: BuildType used a long
  chain of if()s; I changed that to two switch
  statements.  That also makes the code much
  nicer to step through when debugging it.

llvm-svn: 221651

9 years ago[ELF] Change order of section match.
Shankar Easwaran [Tue, 11 Nov 2014 00:40:38 +0000 (00:40 +0000)]
[ELF] Change order of section match.

Addressed comments from Sean silva.

llvm-svn: 221650

9 years agoRevert "Add support library."
Shankar Easwaran [Tue, 11 Nov 2014 00:40:36 +0000 (00:40 +0000)]
Revert "Add support library."

This reverts commit r221583.

llvm-svn: 221649

9 years ago[Gnu][Driver] Use StringRef conversion functions
Shankar Easwaran [Tue, 11 Nov 2014 00:40:32 +0000 (00:40 +0000)]
[Gnu][Driver] Use StringRef conversion functions

llvm-svn: 221648

9 years agoFix error handling in NativeProcessLinux::AttachToInferior: http://reviews.llvm.org...
Shawn Best [Tue, 11 Nov 2014 00:28:52 +0000 (00:28 +0000)]
Fix error handling in NativeProcessLinux::AttachToInferior: reviews.llvm.org/D6158

llvm-svn: 221647

9 years agoMove CodeGenOptions constructor out-of-line and add missing headers. NFC.
Alexey Samsonov [Tue, 11 Nov 2014 00:22:12 +0000 (00:22 +0000)]
Move CodeGenOptions constructor out-of-line and add missing headers. NFC.

llvm-svn: 221646

9 years agoMove SanitizerKind class to a separate header. NFC.
Alexey Samsonov [Tue, 11 Nov 2014 00:19:46 +0000 (00:19 +0000)]
Move SanitizerKind class to a separate header. NFC.

llvm-svn: 221645

9 years agoEricQWF's code coverage work showed that none of the libc++ tests were exercising...
Marshall Clow [Tue, 11 Nov 2014 00:16:30 +0000 (00:16 +0000)]
EricQWF's code coverage work showed that none of the libc++ tests were exercising some code in vector<bool>. Add more tests in an attempt to get better coverage

llvm-svn: 221644

9 years agoAdded a testcase that checks that fairly complicated
Sean Callanan [Tue, 11 Nov 2014 00:14:00 +0000 (00:14 +0000)]
Added a testcase that checks that fairly complicated
structures are parsed safely by the Objective-C runtime.

Also made some modifications to the way we parse structs
in the runtime to avoid mis-parsing @ followed by the name
of the next field.

<rdar://problem/18887634>

llvm-svn: 221643

9 years ago[ProcessWindows] Implement breakpoint stop / resume on Windows.
Zachary Turner [Tue, 11 Nov 2014 00:00:14 +0000 (00:00 +0000)]
[ProcessWindows] Implement breakpoint stop / resume on Windows.

This patch implements basic support for stopping at breakpoints
and resuming later.  While a breakpoint is stopped at, LLDB will
cease to process events in the debug loop, effectively suspending
the process, and then resume later when ProcessWindows::DoResume
is called.

As a side effect, this also correctly handles the loader breakpoint
(i.e. the initial stop) so that LLDB goes through the correct state
sequence during the initial process launch.

llvm-svn: 221642

9 years ago[libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
Argyrios Kyrtzidis [Mon, 10 Nov 2014 23:21:35 +0000 (23:21 +0000)]
[libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
report the 'init*' invocation as non-dynamic via clang_Cursor_isDynamicCall.

Of course it is dynamic at runtime, but for purposes of indexing we can treat as an invocation to ClassName's init*.

Addresses rdar://18916871.

llvm-svn: 221641

9 years agoCleaned up the StringLexer a little bit. It turns
Sean Callanan [Mon, 10 Nov 2014 23:20:52 +0000 (23:20 +0000)]
Cleaned up the StringLexer a little bit.  It turns
out we only want to roll back text that was in the
buffer to begin with, so it's not necessary to
provide a pushback stack.

I'm going to use this slightly cleaner API to perform
lookahead for the Objective-C runtime type parser.

llvm-svn: 221640

9 years ago[yaml2obj] Support AArch64 relocations.
Chad Rosier [Mon, 10 Nov 2014 23:02:03 +0000 (23:02 +0000)]
[yaml2obj] Support AArch64 relocations.

Patch by Daniel Stewart <stewartd@codeaurora.org>!
Phabricator Revision: http://reviews.llvm.org/D6192

llvm-svn: 221639

9 years agoconfigure.ac lives in autoconf/, not autotools/
Rafael Espindola [Mon, 10 Nov 2014 22:36:04 +0000 (22:36 +0000)]
configure.ac lives in autoconf/, not autotools/

Patch by Palmer Dabbelt!

llvm-svn: 221638

9 years ago[ProcessWindows] Notify process plugin when the launch succeeds.
Zachary Turner [Mon, 10 Nov 2014 22:32:18 +0000 (22:32 +0000)]
[ProcessWindows] Notify process plugin when the launch succeeds.

llvm-svn: 221637

9 years agoFix some compiler warnings, one of which was a legit bug.
Zachary Turner [Mon, 10 Nov 2014 22:31:51 +0000 (22:31 +0000)]
Fix some compiler warnings, one of which was a legit bug.

MSVC warns that not all control paths return a value when a switch
doesn't have a default case handler.  Changed explicit value checks
to a default check.

Also, it caught a case where bitwise AND was being used instead of
logical AND.  I'm not sure what this fixes, but presumably it is
not covered by any kind of test case.

llvm-svn: 221636

9 years agoPropagate SanitizerKind into CodeGenFunction::EmitCheck() call.
Alexey Samsonov [Mon, 10 Nov 2014 22:27:30 +0000 (22:27 +0000)]
Propagate SanitizerKind into CodeGenFunction::EmitCheck() call.

Make sure CodeGenFunction::EmitCheck() knows which sanitizer
it emits check for. Make CheckRecoverableKind enum an
implementation detail and move it away from header.

Currently CheckRecoverableKind is determined by the type of
sanitizer ("unreachable" and "return" are unrecoverable,
"vptr" is always-recoverable, all the rest are recoverable).
This will change in future if we allow to specify which sanitizers
are recoverable, and which are not by -fsanitize-recover= flag.

No functionality change.

llvm-svn: 221635

9 years agoValidate user headers even if -fmodules-validate-once-per-build-session
Ben Langmuir [Mon, 10 Nov 2014 22:13:10 +0000 (22:13 +0000)]
Validate user headers even if -fmodules-validate-once-per-build-session

is enabled. Unlike system headers, we want to be more careful about
modifications to user headers, because it's still easy to edit a header
while you're building.

llvm-svn: 221634

9 years agoFix comments to match the current reality.
Greg Clayton [Mon, 10 Nov 2014 21:48:12 +0000 (21:48 +0000)]
Fix comments to match the current reality.

llvm-svn: 221633

9 years agoFix selectors not being objc-uniquified in the expression parser after a recent renam...
Greg Clayton [Mon, 10 Nov 2014 21:45:59 +0000 (21:45 +0000)]
Fix selectors not being objc-uniquified in the expression parser after a recent renaming in clang (clang change for revision 221451). This broke all objective C expressions in LLDB.

llvm-svn: 221632

9 years agoAArch64: set all processor features from -arch if nothing else present
Tim Northover [Mon, 10 Nov 2014 21:17:23 +0000 (21:17 +0000)]
AArch64: set all processor features from -arch if nothing else present

Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural
and tuning purposes. So if neither of the explicit options have been given,
forward that on to the proper invocation.

rdar://problem/18906227

llvm-svn: 221631

9 years agoImprove diagnostics if _Noreturn is placed after a function declarator. (This sometim...
Richard Smith [Mon, 10 Nov 2014 21:10:32 +0000 (21:10 +0000)]
Improve diagnostics if _Noreturn is placed after a function declarator. (This sometimes happens when a macro is used that expands to either the GNU noreturn attribute or _Noreturn.)

llvm-svn: 221630

9 years agoReverting r221626 due to a too-strict test.
Michael Kuperstein [Mon, 10 Nov 2014 21:07:41 +0000 (21:07 +0000)]
Reverting r221626 due to a too-strict test.

llvm-svn: 221629

9 years ago[AArch64][FastISel] Fix kill flags for integer extends.
Juergen Ributzka [Mon, 10 Nov 2014 21:05:31 +0000 (21:05 +0000)]
[AArch64][FastISel] Fix kill flags for integer extends.

In the case we optimize an integer extend away and replace it directly with the
source register, we also have to clear all kill flags at all its uses.
This is necessary, because the orignal IR instruction might be trivially dead,
but we replaced it with a nop at MI level.

llvm-svn: 221628

9 years ago[SwitchLowering] Fix the "fixPhis" function.
Juergen Ributzka [Mon, 10 Nov 2014 21:05:27 +0000 (21:05 +0000)]
[SwitchLowering] Fix the "fixPhis" function.

Switch statements may have more than one incoming edge into the same BB if they
all have the same value. When the switch statement is converted these incoming
edges are now coming from multiple BBs. Updating all incoming values to be from
a single BB is incorrect and would generate invalid LLVM IR.

The fix is to only update the first occurrence of an incoming value. Switch
lowering will perform subsequent calls to this helper function for each incoming
edge with a new basic block - updating all edges in the process.

This fixes rdar://problem/18916275.

llvm-svn: 221627

9 years ago[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext
Michael Kuperstein [Mon, 10 Nov 2014 20:40:21 +0000 (20:40 +0000)]
[X86] Fix pattern match for 32-to-64-bit zext in the presence of AssertSext

This fixes an issue with matching trunc -> assertsext -> zext on x86-64, which would not zero the high 32-bits.
See PR20494 for details.

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

llvm-svn: 221626

9 years agoRemove change to set SDKROOT when building compiler-rt on Darwin.
Bob Wilson [Mon, 10 Nov 2014 20:01:19 +0000 (20:01 +0000)]
Remove change to set SDKROOT when building compiler-rt on Darwin.

This reverts the runtime library portion of r194168. As of r221621,
the libclang_rt libraries for Darwin build with explicit SDK options
so there is no need to set SDKROOT here.

llvm-svn: 221625

9 years agoFix a problem reported by Ed Maste where the test harness was failing to call bound...
Enrico Granata [Mon, 10 Nov 2014 19:51:57 +0000 (19:51 +0000)]
Fix a problem reported by Ed Maste where the test harness was failing to call bound methods as cleanup hooks

llvm-svn: 221624

9 years agoUpdate fold-expression mangling to match cxx-abi-dev discussion.
Richard Smith [Mon, 10 Nov 2014 19:44:15 +0000 (19:44 +0000)]
Update fold-expression mangling to match cxx-abi-dev discussion.

llvm-svn: 221623

9 years agoClean up indentation after previous change.
Bob Wilson [Mon, 10 Nov 2014 19:38:18 +0000 (19:38 +0000)]
Clean up indentation after previous change.

llvm-svn: 221622

9 years agoBuild Darwin libclang_rt libraries against real SDKs.
Bob Wilson [Mon, 10 Nov 2014 19:38:15 +0000 (19:38 +0000)]
Build Darwin libclang_rt libraries against real SDKs.

The minimal fake SDK was very useful in allowing us to build for all
Darwin platforms without needing access to the real SDKs, but it did
not support building any of the sanitizer runtimes. It's important to
fix that. As a consequence, if you don't have the iOS SDKs installed,
we will now skip building the iOS-specific libclang_rt libraries.
rdar://problem/18825276

llvm-svn: 221621

9 years agoCopy externally_initialized in GlobalVariable::copyAttributesFrom.
Rafael Espindola [Mon, 10 Nov 2014 18:41:59 +0000 (18:41 +0000)]
Copy externally_initialized in GlobalVariable::copyAttributesFrom.

Patch by Kevin Frei!

llvm-svn: 221620

9 years ago[NVPTX] Add an NVPTX-specific TargetTransformInfo
Jingyue Wu [Mon, 10 Nov 2014 18:38:25 +0000 (18:38 +0000)]
[NVPTX] Add an NVPTX-specific TargetTransformInfo

Summary:
It currently only implements hasBranchDivergence, and will be extended
in later diffs.

Split from D6188.

Test Plan: make check-all

Reviewers: jholewinski

Reviewed By: jholewinski

Subscribers: llvm-commits, meheff, eliben, jholewinski

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

llvm-svn: 221619

9 years agoMisc style fixes. NFC.
Rafael Espindola [Mon, 10 Nov 2014 18:11:10 +0000 (18:11 +0000)]
Misc style fixes. NFC.

This fixes a few cases of:

* Wrong variable name style.
* Lines longer than 80 columns.
* Repeated names in comments.
* clang-format of the above.

This make the next patch a lot easier to read.

llvm-svn: 221615

9 years agoOnly build iOS runtime libraries when the iOS SDKs are available.
Bob Wilson [Mon, 10 Nov 2014 17:46:55 +0000 (17:46 +0000)]
Only build iOS runtime libraries when the iOS SDKs are available.

This was already set up for the iOS simulator ASan dylib simulator,
and this change extends that to the other iOS runtime libraries.
This is in preparation for building all those iOS libraries against
the real SDKs instead of the fake SDKs in compiler-rt.

llvm-svn: 221614

9 years agoFix extra semicolon warning. NFC.
Vasileios Kalintiris [Mon, 10 Nov 2014 17:37:53 +0000 (17:37 +0000)]
Fix extra semicolon warning. NFC.

llvm-svn: 221613

9 years ago[mips][microMIPS] Fix issue with delay slot filler and microMIPS
Zoran Jovanovic [Mon, 10 Nov 2014 17:27:56 +0000 (17:27 +0000)]
[mips][microMIPS] Fix issue with delay slot filler and microMIPS
Differential Revision: http://reviews.llvm.org/D6193

llvm-svn: 221612

9 years agoFix new noreturn test on !darwin platforms
Ed Maste [Mon, 10 Nov 2014 17:22:47 +0000 (17:22 +0000)]
Fix new noreturn test on !darwin platforms

r221575 introduced a NoreturnUnwind test that did not skip the dsym
test on non-darwin platforms, and had the @dwarf_test case as an exact
copy of the dsym case (including the test name, test_with_dsym).

llvm-svn: 221611

9 years agoDo not build a separate x86_64h Haswell slice for the iOS simulator.
Bob Wilson [Mon, 10 Nov 2014 17:05:21 +0000 (17:05 +0000)]
Do not build a separate x86_64h Haswell slice for the iOS simulator.

r199996 added new x86_64h slices for all the Darwin compiler_rt libraries
that had an x86_64 slice, but that is overkill for the iOS Simulator
platform where the x86_64h slice is never used.

llvm-svn: 221610

9 years agoclang-format: Fix pointer formatting.
Daniel Jasper [Mon, 10 Nov 2014 16:57:30 +0000 (16:57 +0000)]
clang-format: Fix pointer formatting.

Before:
  void f(Bar* a = nullptr, Bar * b);
After:
  void f(Bar* a = nullptr, Bar* b);

llvm-svn: 221609

9 years agoFix variable names and comment style. NFC.
Rafael Espindola [Mon, 10 Nov 2014 16:31:06 +0000 (16:31 +0000)]
Fix variable names and comment style. NFC.

llvm-svn: 221608