platform/upstream/llvm.git
8 years ago[Cortex-M0] Atomic lowering
Weiming Zhao [Thu, 3 Nov 2016 21:49:08 +0000 (21:49 +0000)]
[Cortex-M0] Atomic lowering

Summary: ARMv6m supports dmb etc fench instructions but not ldrex/strex etc. So for some atomic load/store, LLVM should inline instructions instead of lowering to __sync_ calls.

Reviewers: rengolin, efriedma, t.p.northover, jmolloy

Subscribers: efriedma, aemerson, llvm-commits

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

llvm-svn: 285969

8 years agoAlways use parallel_for_each because it falls back to std::for_each.
Rui Ueyama [Thu, 3 Nov 2016 21:28:19 +0000 (21:28 +0000)]
Always use parallel_for_each because it falls back to std::for_each.

If multi-threading is disabled, parallel_for_each will automatically
fall back to std::for_each, so we don't have to do that ourselves.

llvm-svn: 285968

8 years agoAdd support for the ARM_THREAD_STATE64 and
Kevin Enderby [Thu, 3 Nov 2016 20:51:28 +0000 (20:51 +0000)]
Add support for the ARM_THREAD_STATE64 and
in llvm-objdump for Mach-O files add the printing of the
ARM_THREAD_STATE64 in the same format as
otool-classic(1) on darwin.

To do this the 64-bit ARM general tread state
needed to be defined in include/llvm/Support/MachO.h .

rdar://28985800

llvm-svn: 285967

8 years agoSimplify now that this is only used for global symbols.
Rafael Espindola [Thu, 3 Nov 2016 20:48:57 +0000 (20:48 +0000)]
Simplify now that this is only used for global symbols.

llvm-svn: 285966

8 years agoNow that the ELFFile constructor does nothing, create it when needed.
Rafael Espindola [Thu, 3 Nov 2016 20:44:50 +0000 (20:44 +0000)]
Now that the ELFFile constructor does nothing, create it when needed.

This avoids duplicating the buffer in InputFile.

llvm-svn: 285965

8 years agoNFC - Test commit.
Tony Jiang [Thu, 3 Nov 2016 20:32:21 +0000 (20:32 +0000)]
NFC - Test commit.

Delete an empty line at the end of README.txt file.

llvm-svn: 285964

8 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Nov 2016 20:17:25 +0000 (20:17 +0000)]
Update for llvm change.

llvm-svn: 285962

8 years agoDon't error in the ELFFile constructor.
Rafael Espindola [Thu, 3 Nov 2016 20:16:53 +0000 (20:16 +0000)]
Don't error in the ELFFile constructor.

All error checking now happens when the information is needed. The
only thing left is the minimum size of the buffer and that can be just
a precondition. I will add an ErrorOr create method in a followup
commit.

Also don't store a pointer to the Header, since it is just a trivial
cast.

llvm-svn: 285961

8 years agoAdd debug info support for C++11 inline namespaces.
Adrian Prantl [Thu, 3 Nov 2016 19:42:14 +0000 (19:42 +0000)]
Add debug info support for C++11 inline namespaces.

<rdar://problem/18616046>

llvm-svn: 285960

8 years agoAdd DWARF debug info support for C++11 inline namespaces.
Adrian Prantl [Thu, 3 Nov 2016 19:42:02 +0000 (19:42 +0000)]
Add DWARF debug info support for C++11 inline namespaces.
This implements the DWARF 5 DW_AT_export_symbols feature:
http://dwarfstd.org/ShowIssue.php?issue=141212.1

<rdar://problem/18616046>

llvm-svn: 285959

8 years ago[libFuzzer] fix -error_exitcode=N, now with a test
Kostya Serebryany [Thu, 3 Nov 2016 19:31:18 +0000 (19:31 +0000)]
[libFuzzer] fix -error_exitcode=N, now with a test

llvm-svn: 285958

8 years ago[ADT] IntervalMap: fix setStart and setStop
Michael LeMay [Thu, 3 Nov 2016 19:14:46 +0000 (19:14 +0000)]
[ADT] IntervalMap: fix setStart and setStop

Summary:
These functions currently require that the new closed interval has a length of
at least 2.  They also currently permit empty half-open intervals.  This patch
defines nonEmpty in each traits structure and uses it to correct the
implementations of setStart and setStop.

Reviewers: stoklund, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 285957

8 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Nov 2016 19:07:44 +0000 (19:07 +0000)]
Update for llvm change.

llvm-svn: 285956

8 years agoRemove the last use of report_fatal_error from ELF.h.
Rafael Espindola [Thu, 3 Nov 2016 19:07:15 +0000 (19:07 +0000)]
Remove the last use of report_fatal_error from ELF.h.

llvm-svn: 285955

8 years agoImprove obvious-most-derived-type devirtualization:
Richard Smith [Thu, 3 Nov 2016 18:55:18 +0000 (18:55 +0000)]
Improve obvious-most-derived-type devirtualization:

  * if the base is produced by a series of derived-to-base conversions, check
    the expression inside them when looking for an expression with a known
    dynamic type
  * step past MaterializeTemporaryExprs when checking for a known dynamic type
  * when checking for a known dynamic type, treat all class prvalues as having
    a known dynamic type after skipping all relevant rvalue subobject
    adjustments
  * treat callees formed by pointer-to-member access for a non-reference member
    type like callees formed by member access.

llvm-svn: 285954

8 years agoPDB: Fix some APIs to avoid use-after-frees
Justin Bogner [Thu, 3 Nov 2016 18:28:04 +0000 (18:28 +0000)]
PDB: Fix some APIs to avoid use-after-frees

The buffer is already owned by the PDBFile for all of these APIs, so
don't pass it in separately.

llvm-svn: 285953

8 years agoSimplify by directly using this->Symbols. NFC.
Rui Ueyama [Thu, 3 Nov 2016 18:20:08 +0000 (18:20 +0000)]
Simplify by directly using this->Symbols. NFC.

llvm-svn: 285952

8 years agoAdd error handling to getEntry.
Rafael Espindola [Thu, 3 Nov 2016 18:05:33 +0000 (18:05 +0000)]
Add error handling to getEntry.

Issue found by inspection.

llvm-svn: 285951

8 years agoInstead of resetting the pointer, or releasing it which was the previous
Chandler Carruth [Thu, 3 Nov 2016 18:03:14 +0000 (18:03 +0000)]
Instead of resetting the pointer, or releasing it which was the previous
code, let's just assert that the DiagonsticEngine doesn't own the client
because our constructor took ownership of it and has a std::unique_ptr
that handles deleting it. This seems much more clear -- the release was
harmless but confusing as if there were some memory there it would have
leaked, and the reset was harmless but confusing as if there were some
memory there it would have been double-freed. But in both cases there
was nothing there.

llvm-svn: 285950

8 years agoAdd [<chars>] to the glob matcher to eliminate use of llvm::Regex.
Rui Ueyama [Thu, 3 Nov 2016 17:57:38 +0000 (17:57 +0000)]
Add [<chars>] to the glob matcher to eliminate use of llvm::Regex.

Previously, it didn't support the character class, so we couldn't
eliminate the use fo llvm::Regex. Now that it is supported, we
can remove compileGlobPattern, which converts a glob pattern to
a regex.

This patch contains optimization for exact/prefix/suffix matches.

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

llvm-svn: 285949

8 years agoAMDGPU/SI: Re add VIInstructions.td to unbreak bots
Tom Stellard [Thu, 3 Nov 2016 17:56:46 +0000 (17:56 +0000)]
AMDGPU/SI: Re add VIInstructions.td to unbreak bots

This file is unused as of r285939, but we need to keep it around
for bots that don't do full rebuilds.   We should be able to delete this
again in a few days.

llvm-svn: 285948

8 years agofixed typo in comment
Andrey Churbanov [Thu, 3 Nov 2016 17:48:46 +0000 (17:48 +0000)]
fixed typo in comment

llvm-svn: 285947

8 years agoUsing release to free memory is at best confusing -- one would expect
Chandler Carruth [Thu, 3 Nov 2016 17:42:32 +0000 (17:42 +0000)]
Using release to free memory is at best confusing -- one would expect
that its result is in fact used. Instead, use reset.

This was pointed out by PVS-Studio.

llvm-svn: 285946

8 years agoRemove a redundant condition found by PVS-Studio.
Chandler Carruth [Thu, 3 Nov 2016 17:42:02 +0000 (17:42 +0000)]
Remove a redundant condition found by PVS-Studio.

Filed http://llvm.org/PR30897 to teach Clang to warn on this kind of
stuff.

llvm-svn: 285945

8 years agoReplace another report_fatal_error with an ErrorOr.
Rafael Espindola [Thu, 3 Nov 2016 17:37:28 +0000 (17:37 +0000)]
Replace another report_fatal_error with an ErrorOr.

llvm-svn: 285944

8 years agoAdd RenderScriptScriptGroup to the Xcode project
Enrico Granata [Thu, 3 Nov 2016 17:33:11 +0000 (17:33 +0000)]
Add RenderScriptScriptGroup to the Xcode project

llvm-svn: 285943

8 years agoReplace a report_fatal_error with an ErrorOr.
Rafael Espindola [Thu, 3 Nov 2016 17:28:33 +0000 (17:28 +0000)]
Replace a report_fatal_error with an ErrorOr.

llvm-svn: 285942

8 years agoAdd support to the ObjC type scavenger for finding types via debug info
Enrico Granata [Thu, 3 Nov 2016 17:25:27 +0000 (17:25 +0000)]
Add support to the ObjC type scavenger for finding types via debug info

llvm-svn: 285941

8 years agoDelete dead code.
Rafael Espindola [Thu, 3 Nov 2016 17:18:31 +0000 (17:18 +0000)]
Delete dead code.

llvm-svn: 285940

8 years agoAMDGPU: Add VI i16 support
Tom Stellard [Thu, 3 Nov 2016 17:13:50 +0000 (17:13 +0000)]
AMDGPU: Add VI i16 support

Patch By: Wei Ding

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

llvm-svn: 285939

8 years agoFix spelling mistake.
Akira Hatanaka [Thu, 3 Nov 2016 17:11:28 +0000 (17:11 +0000)]
Fix spelling mistake.

llvm-svn: 285938

8 years agoDelete some dead code and add a missing "0x" prefix to a hex string in
Chandler Carruth [Thu, 3 Nov 2016 17:11:11 +0000 (17:11 +0000)]
Delete some dead code and add a missing "0x" prefix to a hex string in
llvm-readobj.

Another bug caught by PVS-Studio.

It'd be nice to actually have a test for this, but I found it by
inspection from PVS-Studio.

llvm-svn: 285937

8 years agoDelete a dead store found by PVS-Studio.
Chandler Carruth [Thu, 3 Nov 2016 17:01:38 +0000 (17:01 +0000)]
Delete a dead store found by PVS-Studio.

Quite sad we still aren't really using aggressive dead code warnings
from Clang that we could potentially use to catch this and so many other
things.

llvm-svn: 285936

8 years agoDelete dead code.
Rafael Espindola [Thu, 3 Nov 2016 16:58:27 +0000 (16:58 +0000)]
Delete dead code.

llvm-svn: 285935

8 years agoFixed column shift when formatting line containing bit shift operators
Malcolm Parsons [Thu, 3 Nov 2016 16:57:30 +0000 (16:57 +0000)]
Fixed column shift when formatting line containing bit shift operators

Summary:
During clang-format source lexing >> and << operators are split and
treated as two less/greater operators but column position of following
tokens was not adjusted accordingly.

Fixes PR26887

Patch by Paweł Żukowski.

Reviewers: djasper

Subscribers: malcolm.parsons, mprobst, klimek, cfe-commits

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

llvm-svn: 285934

8 years agoChange how we store the symbol table.
Rafael Espindola [Thu, 3 Nov 2016 16:55:44 +0000 (16:55 +0000)]
Change how we store the symbol table.

Instead of remembering a raw Elf_Shdr, store the symbol table proper
and the index of the first non local.

This moves error handling upfront and simplifies it.

llvm-svn: 285933

8 years agoAdd lower level versions of some functions.
Rafael Espindola [Thu, 3 Nov 2016 16:51:44 +0000 (16:51 +0000)]
Add lower level versions of some functions.

This adds versions of getSectionIndex, getSection and getSymbol that
instead of a Elf_Shdr take the content of that section.

llvm-svn: 285932

8 years agoMake this test Windows-only (try to placate buildbots).
Davide Italiano [Thu, 3 Nov 2016 16:43:10 +0000 (16:43 +0000)]
Make this test Windows-only (try to placate buildbots).

llvm-svn: 285931

8 years agoFix a bug found by inspection by PVS-Studio.
Chandler Carruth [Thu, 3 Nov 2016 16:39:25 +0000 (16:39 +0000)]
Fix a bug found by inspection by PVS-Studio.

This condition is trivially always true prior to the change. The comment
at the call site makes it clear that we expect *all* of these to be '=',
'S', or 'I' so fix the code.

We have a bug I will update to track the fact that Clang doesn't warn on
this: http://llvm.org/PR13101

llvm-svn: 285930

8 years agoMove function out of line. NFC.
Rafael Espindola [Thu, 3 Nov 2016 16:24:35 +0000 (16:24 +0000)]
Move function out of line. NFC.

llvm-svn: 285929

8 years agoInline function into only use.
Rafael Espindola [Thu, 3 Nov 2016 16:10:39 +0000 (16:10 +0000)]
Inline function into only use.

llvm-svn: 285928

8 years agovim: special case the CHECK prefix
Saleem Abdulrasool [Thu, 3 Nov 2016 15:56:06 +0000 (15:56 +0000)]
vim: special case the CHECK prefix

A large number of tests in the LLVM tree use the default (CHECK) prefix
to indicate checked expressions via FileCheck.  Highlight it as a
special comment.  Although this wont get all the instances of the
checked patters, it is strictly better than the current state.

llvm-svn: 285927

8 years agoInitialize the StringTable early and do it only once.
Rafael Espindola [Thu, 3 Nov 2016 15:43:47 +0000 (15:43 +0000)]
Initialize the StringTable early and do it only once.

llvm-svn: 285926

8 years agoRename the version of ConstructJob for multiple outputs to ConstructJobMultipleOutputs.
Samuel Antao [Thu, 3 Nov 2016 15:41:50 +0000 (15:41 +0000)]
Rename the version of ConstructJob for multiple outputs to ConstructJobMultipleOutputs.

It was causing trouble with the GCC bots.

llvm-svn: 285925

8 years ago[ScopInfo] Fix isl object leak.
Michael Kruse [Thu, 3 Nov 2016 15:19:41 +0000 (15:19 +0000)]
[ScopInfo] Fix isl object leak.

Fix return from function without releasing isl objects, which was introduced
in r269055.

llvm-svn: 285924

8 years ago[Sema] Avoid instantiating templates only when UncompilableErrorOccurred
Akira Hatanaka [Thu, 3 Nov 2016 15:04:58 +0000 (15:04 +0000)]
[Sema] Avoid instantiating templates only when UncompilableErrorOccurred
and FatalErrorOccurred are both set.

This fixes a crash that occurs when a warning promoted to a fatal error
leaves the AST in an incomplete state, and then later CFG analysis is
run on the incomplete AST.

rdar://problem/28558923

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

llvm-svn: 285923

8 years agoDelete dead code.
Rafael Espindola [Thu, 3 Nov 2016 15:01:12 +0000 (15:01 +0000)]
Delete dead code.

llvm-svn: 285922

8 years agoReturn existing error code.
Rafael Espindola [Thu, 3 Nov 2016 14:53:25 +0000 (14:53 +0000)]
Return existing error code.

Should fix the -Werror bots.

llvm-svn: 285921

8 years agoMove a free function out of ELFFile.
Rafael Espindola [Thu, 3 Nov 2016 14:41:17 +0000 (14:41 +0000)]
Move a free function out of ELFFile.

llvm-svn: 285920

8 years ago[AMDGPU][CodeGen] To improve CGEMM performance: combine LDS reads.
Alexander Timofeev [Thu, 3 Nov 2016 14:37:13 +0000 (14:37 +0000)]
[AMDGPU][CodeGen] To improve CGEMM performance: combine LDS reads.

hange explores the fact that LDS reads may be reordered even if access
the same location.

Prior the change, algorithm immediately stops as soon as any memory
access encountered between loads that are expected to be merged
together. Although, Read-After-Read conflict cannot affect execution
correctness.

Improves hcBLAS CGEMM manually loop-unrolled kernels performance by 44%.
Also improvement expected on any massive sequences of reads from LDS.

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

llvm-svn: 285919

8 years agoUse the getSectionIndex from llvm.
Rafael Espindola [Thu, 3 Nov 2016 14:26:25 +0000 (14:26 +0000)]
Use the getSectionIndex from llvm.

llvm-svn: 285918

8 years agoRefactor creation of X86ISD::SETCC nodes to a helper function. NFC.
Zvi Rackover [Thu, 3 Nov 2016 14:25:24 +0000 (14:25 +0000)]
Refactor creation of X86ISD::SETCC nodes to a helper function. NFC.

llvm-svn: 285917

8 years agoDAGCombiner: fix use-after-free when merging consecutive stores
Nicolai Haehnle [Thu, 3 Nov 2016 14:25:04 +0000 (14:25 +0000)]
DAGCombiner: fix use-after-free when merging consecutive stores

Summary:
Have MergeConsecutiveStores explicitly return information about the stores
that were merged, so that we can safely determine whether the starting
node has been freed.

Reviewers: chandlerc, bogner, niravd

Subscribers: llvm-commits

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

llvm-svn: 285916

8 years agoSplit out a getSectionIndex.
Rafael Espindola [Thu, 3 Nov 2016 14:24:53 +0000 (14:24 +0000)]
Split out a getSectionIndex.

That code is currently duplicated in lld.

llvm-svn: 285915

8 years agoUse existing ELFObj function. NFC.
Rafael Espindola [Thu, 3 Nov 2016 14:17:53 +0000 (14:17 +0000)]
Use existing ELFObj function. NFC.

llvm-svn: 285913

8 years agoRevert "[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently"
James Molloy [Thu, 3 Nov 2016 14:08:01 +0000 (14:08 +0000)]
Revert "[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently"

This reverts commit r285893. It caused (probably) http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/83 .

llvm-svn: 285912

8 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Nov 2016 13:58:26 +0000 (13:58 +0000)]
Update for llvm change.

llvm-svn: 285911

8 years agoreplace a report_fatal_error with a ErrorOr.
Rafael Espindola [Thu, 3 Nov 2016 13:58:15 +0000 (13:58 +0000)]
replace a report_fatal_error with a ErrorOr.

llvm-svn: 285910

8 years agoSupport for Python 3 in libclang python bindings
Jonathan Coe [Thu, 3 Nov 2016 13:55:34 +0000 (13:55 +0000)]
Support for Python 3 in libclang python bindings

Summary:
Python bindings tests now pass in Python 3.

`map` in Python 3 is lazily evaluated so the method by which functions are registered needed updating.

Strings are unicode in Python 3 not UTF-8, I've tried to create an new c_types-like class (c_string_p) to automate the conversion.

String conversions made explicit where required.

Reviewers: eliben, nemanjai, skalinichev, compnerd

Subscribers: mgorny, cfe-commits

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

llvm-svn: 285909

8 years ago[CMake] Make CMAKE_INSTALL_RPATH work again
John Brawn [Thu, 3 Nov 2016 13:55:04 +0000 (13:55 +0000)]
[CMake] Make CMAKE_INSTALL_RPATH work again

r285714 made it so that when CMAKE_INSTALL_RPATH is set _install_rpath is not
set, but that means INSTALL_RPATH gets set to an empty string which isn't what
we want. Fix this by setting INSTALL_RPATH only when _install_rpath is set.

llvm-svn: 285908

8 years ago[clang-tidy] Ignore forward declarations without definitions in the same translation...
Jonathan Coe [Thu, 3 Nov 2016 13:52:09 +0000 (13:52 +0000)]
[clang-tidy] Ignore forward declarations without definitions in the same translation unit in readability-identifier-naming

Summary: This change ensures that forward declarations of classes are not considered for identifier naming checks within a translation unit.

Reviewers: alexfh, aaron.ballman

Subscribers: mgehre

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

llvm-svn: 285907

8 years agoUpdate for llvm change.
Rafael Espindola [Thu, 3 Nov 2016 13:43:51 +0000 (13:43 +0000)]
Update for llvm change.

llvm-svn: 285906

8 years agoReplace a report_fatal_error with an ErrorOr.
Rafael Espindola [Thu, 3 Nov 2016 13:43:30 +0000 (13:43 +0000)]
Replace a report_fatal_error with an ErrorOr.

llvm-svn: 285905

8 years agoPass the section table around instead of recomputing it.
Rafael Espindola [Thu, 3 Nov 2016 13:24:29 +0000 (13:24 +0000)]
Pass the section table around instead of recomputing it.

llvm-svn: 285904

8 years agoSplit getStringTableForSymtab.
Rafael Espindola [Thu, 3 Nov 2016 13:22:51 +0000 (13:22 +0000)]
Split getStringTableForSymtab.

For use in cases where we already have the section table.

llvm-svn: 285903

8 years ago[Renderscript] Add commands for scriptgroup interaction.
Aidan Dodds [Thu, 3 Nov 2016 13:20:37 +0000 (13:20 +0000)]
[Renderscript] Add commands for scriptgroup interaction.

This commit hooks the nofity function that signals script group
compilation.  By tracking scriptgroups compiled at runtine, users
are able to place breakpoints by script group name.  Breakpoints
will be placed on the kernels forming the group.

llvm-svn: 285902

8 years ago[clang-tidy] Handle data() in readability-redundant-string-cstr
Malcolm Parsons [Thu, 3 Nov 2016 12:56:48 +0000 (12:56 +0000)]
[clang-tidy] Handle data() in readability-redundant-string-cstr

Summary:
std::string::data() and std::string::c_str() are equivalent.
Enhance the readability-redundant-string-cstr check to also handle
calls to data().

Reviewers: etienneb, alexfh, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 285901

8 years ago[ELF] - Accept both "-" and "--" for Ttext/Tdata/Tbss options.
George Rimar [Thu, 3 Nov 2016 12:49:25 +0000 (12:49 +0000)]
[ELF] - Accept both "-" and "--" for Ttext/Tdata/Tbss options.

llvm-svn: 285900

8 years agoRemove redundant calls to std::string::data()
Malcolm Parsons [Thu, 3 Nov 2016 12:25:51 +0000 (12:25 +0000)]
Remove redundant calls to std::string::data()

Reviewers: aaron.ballman, mehdi_amini, dblaikie

Subscribers: klimek, cfe-commits

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

llvm-svn: 285899

8 years agoSplit getSHNDXTable in two.
Rafael Espindola [Thu, 3 Nov 2016 12:23:41 +0000 (12:23 +0000)]
Split getSHNDXTable in two.

Some clients already have the section table available.

llvm-svn: 285898

8 years agoWe already have the sections, pass them to getSHNDXTable.
Rafael Espindola [Thu, 3 Nov 2016 12:21:00 +0000 (12:21 +0000)]
We already have the sections, pass them to getSHNDXTable.

llvm-svn: 285897

8 years ago[ELF] Do not create interworking thunks for undefined weak references.
Peter Smith [Thu, 3 Nov 2016 11:49:23 +0000 (11:49 +0000)]
[ELF] Do not create interworking thunks for undefined weak references.

An undefined weak reference is given an address of 0 this will
incorrectly trigger the creation of a Thumb to ARM interworking Thunk
if there is a Thumb branch instruction to the symbol. This results in
an error as Thunks only make sense to defined or shared symbols.

We prevent this by detecting an undefined symbol and not creating a thunk
for it.

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

llvm-svn: 285896

8 years agoUse globMatch() instead of llvm::regex in linker scripts
Eugene Leviant [Thu, 3 Nov 2016 10:54:58 +0000 (10:54 +0000)]
Use globMatch() instead of llvm::regex in linker scripts

This can speed up lld up to 5 times when linking applications
with large number of sections and using linker script.

Differential revision: https://reviews.llvm.org/D26241

llvm-svn: 285895

8 years agoLink lldb-mi only to the llvm components it uses
Pavel Labath [Thu, 3 Nov 2016 10:52:17 +0000 (10:52 +0000)]
Link lldb-mi only to the llvm components it uses

Summary:
liblldb does not re-export the llvm library contained within, so lldb-mi needs to
manage its own dependencies. Right now it only uses the llvm support library.

Reviewers: beanz, zturner, tfiala, clayborg, abidh

Subscribers: ki.stfu, mgorny, lldb-commits

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

llvm-svn: 285894

8 years ago[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
James Molloy [Thu, 3 Nov 2016 10:18:20 +0000 (10:18 +0000)]
[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently

This recommits r281323, which was backed out for two reasons. One, a selfhost failure, and two, it apparently caused Chromium failures. Actually, the latter was a red herring. The log has expired from the former, but I suspect that was a red herring too (actually caused by another problematic patch of mine). Therefore reapplying, and will watch the bots like a hawk.

For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more efficient instruction selection if the bitmask is one consecutive sequence of set bits (32 - clz(bm) - ctz(bm) == popcount(bm)).

1) If the bitmask touches the LSB, then we can remove all the upper bits and set the flags by doing one LSLS.
2) If the bitmask touches the MSB, then we can remove all the lower bits and set the flags with one LSRS.
3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit into the sign bit with one LSLS and change the condition query from NE/EQ to MI/PL (we could also implement this by shifting into the carry bit and branching on BCC/BCS).
4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower zero bits of the mask.

1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two 16-bit instructions but can elide the CMP and doesn't require materializing a complex immediate, so is also a win.

llvm-svn: 285893

8 years agoFix Timer unit test
Pavel Labath [Thu, 3 Nov 2016 10:07:47 +0000 (10:07 +0000)]
Fix Timer unit test

I did not take into account that the output of the Dump function will be
non-deterministic. Fix that by increasing of the times, this also makes the test
check that the dump function sorts the output.

llvm-svn: 285892

8 years agoRemove TimeSpecTimeout class
Pavel Labath [Thu, 3 Nov 2016 09:29:56 +0000 (09:29 +0000)]
Remove TimeSpecTimeout class

the class is unused.

llvm-svn: 285891

8 years agoRefactor Timer class
Pavel Labath [Thu, 3 Nov 2016 09:14:09 +0000 (09:14 +0000)]
Refactor Timer class

Summary:
While removing TimeValue from this class I noticed a lot of room for small
simplifications here. Main are:
  - instead of complicated start-stop dances to compute own time, each Timer
    just starts the timer once, and keeps track of the durations of child
    timers. Then the own time can be computed at the end by subtracting the two
    values.
  - remove double accounting in TimerStack - the stack object already knows the
    number of timers.
The interface does not lend itself well to unit testing, but I have added a
couple of tests which can (and did) catch any obvious errors.

Reviewers: tberghammer, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 285890

8 years agoReverted r285882 (Enhancement to test for -ast-print)
Serge Pavlov [Thu, 3 Nov 2016 08:58:44 +0000 (08:58 +0000)]
Reverted r285882 (Enhancement to test for -ast-print)

It broke buildbot on Windows.

llvm-svn: 285889

8 years ago[ELF] - Update after LLVM change (r285886)
George Rimar [Thu, 3 Nov 2016 08:42:52 +0000 (08:42 +0000)]
[ELF] - Update after LLVM change (r285886)

llvm-svn: 285888

8 years ago[tools/obj2yaml] - Update after LLVM change r285886
George Rimar [Thu, 3 Nov 2016 08:41:46 +0000 (08:41 +0000)]
[tools/obj2yaml] - Update after LLVM change r285886

llvm-svn: 285887

8 years ago[Object/ELF] - Make getSymbol() return Error.
George Rimar [Thu, 3 Nov 2016 08:40:55 +0000 (08:40 +0000)]
[Object/ELF] - Make getSymbol() return Error.

That is consistent with other methods around
and helps to handle error on a caller side.

Differential revision: https://reviews.llvm.org/D26247

llvm-svn: 285886

8 years agoTest for YMMRegisters.
Ravitheja Addepally [Thu, 3 Nov 2016 08:35:55 +0000 (08:35 +0000)]
Test for YMMRegisters.

Summary:
This patch contains test for reading YMM Registers. The test basically
contains an inferior that loads the ymm registers with a bit pattern
and the python test executes register read to check if the bit pattern
is correctly written in the registers. This test is repeated twice for
each register with a different pattern for better sanity.

Reviewers: tberghammer, zturner, clayborg

Subscribers: tberghammer, danalbert, srhines

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

llvm-svn: 285885

8 years ago[ELF] - Removed unused method declaration. NFC.
George Rimar [Thu, 3 Nov 2016 08:20:57 +0000 (08:20 +0000)]
[ELF] - Removed unused method declaration. NFC.

llvm-svn: 285884

8 years agoFix heuristics skipping invalid ctor-initializers with C++11
Olivier Goffart [Thu, 3 Nov 2016 07:36:17 +0000 (07:36 +0000)]
Fix heuristics skipping invalid ctor-initializers with C++11

Use better heuristics to detect if a '{' might be the start of the constructor body
or not. Especially when there is a completion token.

Fix the test 'test/CodeCompletion/ctor-initializer.cpp ' when clang defaults to c++11

The problem was is how we recover invalid code in the ctor-init part as we skip the
function body. In particular, we want to know if a '{' is the begining of the body.
In C++03, we always consider it as the beginng of the body. The problem was that in
C++11, it may be the start of an initializer, so we skip over it, causing further
parse errors later. (It is important that we are able to parse correctly the rest
of the class definition, to know what are the class member, for example)

This commit is improving the heuristics to decide if the '{' is starting a function
body. The rules are the following: If we are not in a template argument, and that the
previous tokens are not an identifier, or a >, then it is much more likely to be the
function body. We verify that further by checking the token after the matching '}'

The commit also fix the behavior when there is a code_completion token in the
ctor-initializers.

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

llvm-svn: 285883

8 years agoEnhancement to test for -ast-print
Serge Pavlov [Thu, 3 Nov 2016 07:32:02 +0000 (07:32 +0000)]
Enhancement to test for -ast-print

Present tests for the functionality provided by command lime option
`-ast-print` check only absence of crash. This change tries to make
testing better, - the output produced by the compiler is compiled again
with option `-print-ast` and both outputs are compared. Such test at
least checks that the output is valid code. This change fixes only the
test for pure C.

llvm-svn: 285882

8 years ago[CMake] Disable rpath for UnitTests
Jonas Hahnfeld [Thu, 3 Nov 2016 06:58:16 +0000 (06:58 +0000)]
[CMake] Disable rpath for UnitTests

This was broken since rL285714.

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

llvm-svn: 285881

8 years ago[Sema] Remove a dead assignment, NFC.
Vedant Kumar [Thu, 3 Nov 2016 06:35:16 +0000 (06:35 +0000)]
[Sema] Remove a dead assignment, NFC.

The assignment to NextIsDereference is either followed by (1) another,
unrelated assignment to NextIsDereference or by (2) an early loop exit.

Found by clang's static analyzer: http://llvm.org/reports/scan-build

(While we're at it fix a typo.)

llvm-svn: 285879

8 years ago[AVX-512] Use 'vnot' instead of 'not' in patterns involving vXi1 vectors.
Craig Topper [Thu, 3 Nov 2016 06:04:28 +0000 (06:04 +0000)]
[AVX-512] Use 'vnot' instead of 'not' in patterns involving vXi1 vectors.

This fixes selection of KANDN instructions and allows us to remove an extra set of patterns for KNOT and KXNOR.

Reviewers: delena, igorb

Subscribers: llvm-commits

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

llvm-svn: 285878

8 years agoExpandload and Compressstore intrinsics
Elena Demikhovsky [Thu, 3 Nov 2016 03:23:55 +0000 (03:23 +0000)]
Expandload and Compressstore intrinsics

2 new intrinsics covering AVX-512 compress/expand functionality.
This implementation includes syntax, DAG builder, operation lowering and tests.
Does not include: handling of illegal data types, codegen prepare pass and the cost model.

llvm-svn: 285876

8 years agoPass the sections to getShtGroupSignature.
Rafael Espindola [Thu, 3 Nov 2016 02:28:13 +0000 (02:28 +0000)]
Pass the sections to getShtGroupSignature.

This avoids fetching it again from the object.

llvm-svn: 285875

8 years agoSplit getSection in two.
Rafael Espindola [Thu, 3 Nov 2016 02:24:59 +0000 (02:24 +0000)]
Split getSection in two.

This will allow avoiding repeated error checking in a few cases.

llvm-svn: 285874

8 years ago[CodeGen] Use StringRef. NFC.
George Burgess IV [Thu, 3 Nov 2016 02:21:43 +0000 (02:21 +0000)]
[CodeGen] Use StringRef. NFC.

Looks like CurFn's name outlives FunctionName, so we can just pass
StringRefs around rather than going from a StringRef to a std::string
to a const char* to a StringRef.

llvm-svn: 285873

8 years ago[Sema] Allow static_cast<T&&>(e) to check explicit conversions for non-reference...
Eric Fiselier [Thu, 3 Nov 2016 02:13:17 +0000 (02:13 +0000)]
[Sema] Allow static_cast<T&&>(e) to check explicit conversions for non-reference-related types.

Summary:
[expr.cast.static] states:
> 3. A glvalue of type “cv1 T1” can be cast to type “rvalue reference to cv2 T2” if “cv2 T2” is reference-compatible
> with “cv1 T1”. The result refers to the object or the specified base class subobject thereof. If T2 is
> an inaccessible or ambiguous base class of T1, a program that necessitates such a cast is
> ill-formed.
>
> 4. Otherwise, an expression e can be explicitly converted to a type T using a static_cast of the form static_-
> cast<T>(e) if the declaration T t(e); is well-formed, for some invented temporary variable t. [...]

Currently when checking p3 Clang will diagnose `static_cast<T&&>(e)` as invalid if the argument is not reference compatible with `T`. However I believe the correct behavior is to also check p4 in those cases.  For example:

```
double y = 42;
static_cast<int&&>(y); // this should be OK.  'int&& t(y)' is well formed
```

Note that we still don't check p4 for non-reference-compatible types which are reference-related since  `T&& t(e);` should never be well formed in those cases.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 285872

8 years ago[ThinLTO] Handle distributed backend case when doing renaming
Teresa Johnson [Thu, 3 Nov 2016 01:07:16 +0000 (01:07 +0000)]
[ThinLTO] Handle distributed backend case when doing renaming

Summary:
The recent change I made to consult the summary when deciding whether to
rename (to handle inline asm) in r285513 broke the distributed build
case. In a distributed backend we will only have a portion of the
combined index, specifically for imported modules we only have the
summaries for any imported definitions. When renaming on import we were
asserting because no summary entry was found for a local reference being
linked in (def wasn't imported).

We only need to consult the summary for a renaming decision for the
exporting module. For imports, we would have prevented importing any
references to NoRename values already.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 285871

8 years agoUpdate manglings for C++17 noexcept function types to match Jason Merrill's
Richard Smith [Thu, 3 Nov 2016 00:27:54 +0000 (00:27 +0000)]
Update manglings for C++17 noexcept function types to match Jason Merrill's
proposal on cxx-abi-dev earlier today.

llvm-svn: 285870

8 years agoTeach clang-query to dump types. I couldn't find any existing tests for clang-query...
Richard Smith [Wed, 2 Nov 2016 23:57:18 +0000 (23:57 +0000)]
Teach clang-query to dump types. I couldn't find any existing tests for clang-query's dumping functionality. =(

llvm-svn: 285869

8 years ago[index] Fix assertion hit when handling a declaration of C++'s 'operator new' function.
Argyrios Kyrtzidis [Wed, 2 Nov 2016 23:42:33 +0000 (23:42 +0000)]
[index] Fix assertion hit when handling a declaration of C++'s 'operator new' function.

Part of this is to allow creating a USR for the canonical decl of that which is implicit and does
not have a source location.

rdar://28978992

llvm-svn: 285868

8 years ago[p0012] Implement ABI support for throwing a noexcept function pointer and
Richard Smith [Wed, 2 Nov 2016 23:41:51 +0000 (23:41 +0000)]
[p0012] Implement ABI support for throwing a noexcept function pointer and
catching as non-noexcept

This implements the following proposal from cxx-abi-dev:

http://sourcerytools.com/pipermail/cxx-abi-dev/2016-October/002988.html

... which is necessary for complete support of http://wg21.link/p0012,
specifically throwing noexcept function and member function pointers and
catching them as non-noexcept pointers.

Differential Review: https://reviews.llvm.org/D26178

llvm-svn: 285867

8 years agoRevert "[InstCombine] allow splat vector folds in adjustMinMax()"
Greg Bedwell [Wed, 2 Nov 2016 23:17:05 +0000 (23:17 +0000)]
Revert "[InstCombine] allow splat vector folds in adjustMinMax()"

This reverts commit r285732.

This change introduced a new assertion failure in the following
testcase at -O2:

typedef short __v8hi __attribute__((__vector_size__(16)));
__v8hi foo(__v8hi &V1, __v8hi &V2, unsigned mask) {
  __v8hi Result = V1;
  if (mask & 0x80)
    Result[0] = V2[0];
  return Result;
}

llvm-svn: 285866