platform/upstream/llvm.git
6 years ago[llvm-undname] Remove a superfluous semicolon. NFC.
Martin Storsjo [Fri, 20 Jul 2018 20:48:36 +0000 (20:48 +0000)]
[llvm-undname] Remove a superfluous semicolon. NFC.

llvm-svn: 337615

6 years ago[COFF] Use symbolic constants instead of hardcoded numbers. NFCI.
Martin Storsjo [Fri, 20 Jul 2018 20:48:33 +0000 (20:48 +0000)]
[COFF] Use symbolic constants instead of hardcoded numbers. NFCI.

Patch by Martell Malone.

llvm-svn: 337614

6 years ago[COFF] Adjust how we flag weak externals
Martin Storsjo [Fri, 20 Jul 2018 20:48:29 +0000 (20:48 +0000)]
[COFF] Adjust how we flag weak externals

This fixes PR36096.

Originally based on a patch by Martell Malone.

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

llvm-svn: 337613

6 years agoAMDGPU: Switch default dwarf version to 2
Konstantin Zhuravlyov [Fri, 20 Jul 2018 20:46:25 +0000 (20:46 +0000)]
AMDGPU: Switch default dwarf version to 2

There were some problems unearthed with version 5,
which I am going to look at.

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

llvm-svn: 337612

6 years ago[CStringSyntaxChecker] Fix build bot builds != x86 archs
David Carlier [Fri, 20 Jul 2018 20:39:49 +0000 (20:39 +0000)]
[CStringSyntaxChecker] Fix build bot builds != x86 archs

Reviewers: NoQ,george.karpenkov

Reviewed By: NoQ

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

llvm-svn: 337611

6 years ago[ELF] Check eh_frame_hdr overflow with PC offsets instead of PC absolute addresses
Fangrui Song [Fri, 20 Jul 2018 20:27:42 +0000 (20:27 +0000)]
[ELF] Check eh_frame_hdr overflow with PC offsets instead of PC absolute addresses

Reviewers: grimar, ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 337610

6 years ago[FileCheck] Provide an option for FileCheck to dump original input to stderr on failure
George Karpenkov [Fri, 20 Jul 2018 20:21:57 +0000 (20:21 +0000)]
[FileCheck] Provide an option for FileCheck to dump original input to stderr on failure

The option can be either set using environment variable (e.g. env
FILECHECK_DUMP_INPUT_ON_FAILURE=1 ninja check-fuzzer) or with a
FileCheck flag.

This can be extremely useful for debugging, cf.
https://groups.google.com/forum/#!topic/llvm-dev/kLrzg8OM_h8 for
discussion.

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

llvm-svn: 337609

6 years agoRevert r337595 "[ORC] Add new symbol lookup methods to ExecutionSessionBase in prepar...
Reid Kleckner [Fri, 20 Jul 2018 20:20:45 +0000 (20:20 +0000)]
Revert r337595 "[ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for"

Breaks the build with LLVM_ENABLE_THREADS=OFF.

llvm-svn: 337608

6 years ago[AST] Various micro-optimizations in CXXInheritance
Benjamin Kramer [Fri, 20 Jul 2018 20:13:08 +0000 (20:13 +0000)]
[AST] Various micro-optimizations in CXXInheritance

1. Pack std::pair<bool, unsigned> in CXXBasePaths::ClassSubobjects.
2. Use a SmallPtrSet instead of a SmallDenseSet for CXXBasePaths::VisitedDependentRecords.
3. Reorder some members of CXXBasePaths to save 8 bytes.
4. Use a SmallSetVector instead of a SetVector in CXXBasePaths::ComputeDeclsFound to avoid some allocations.

This speeds up an -fsyntax-only on all of Boost by approx 0.15%,
mainly by speeding up CXXBasePaths::lookupInBases by
approx 10%. No functional changes.

Patch by Bruno Ricci!

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

llvm-svn: 337607

6 years agoReapply "[LSV] Refactoring + supporting bitcasts to a type of different size"
Roman Tereshin [Fri, 20 Jul 2018 20:10:04 +0000 (20:10 +0000)]
Reapply "[LSV] Refactoring + supporting bitcasts to a type of different size"

This reapplies commit r337489 reverted by r337541
Additionally, this commit contains a speculative fix to the issue reported in r337541
(the report does not contain an actionable reproducer, just a stack trace)

llvm-svn: 337606

6 years ago[FileCheck] Fix search ranges for DAG-NOT-DAG
Joel E. Denny [Fri, 20 Jul 2018 20:09:56 +0000 (20:09 +0000)]
[FileCheck] Fix search ranges for DAG-NOT-DAG

A DAG-NOT-DAG is a CHECK-DAG group, X, followed by a CHECK-NOT group,
N, followed by a CHECK-DAG group, Y.  Let y be the initial directive
of Y.  This patch makes the following changes to the behavior:

    1. Directives in N can no longer match within part of Y's match
       range just because y happens not to be the earliest match from
       Y.  Specifically, this patch withdraws N's search range end
       from y's match range start to Y's match range start.

    2. y can no longer match within X's match range, where a y match
       produced a reordering complaint, which is thus no longer
       possible.  Specifically, this patch withdraws y's search range
       start from X's permitted range start to X's match range end,
       which was already the search range start for other members of
       Y.

Both of these changes can only increase the number of test passes: #1
constrains the ability of CHECK-NOTs to match, and #2 expands the
ability of CHECK-DAGs to match without complaints.

These changes are based on discussions at:

   <http://lists.llvm.org/pipermail/llvm-dev/2018-May/123550.html>
   <https://reviews.llvm.org/D47106>

which conclude that:

    1. These changes simplify the FileCheck conceptual model.  First,
       it makes search ranges for DAG-NOT-DAG more consistent with
       other cases.  Second, it was confusing that y was treated
       differently from the rest of Y.

    2. These changes add theoretical use cases for DAG-NOT-DAG that
       had no obvious means to be expressed otherwise.  We can justify
       the first half of this assertion with the observation that
       these changes can only increase the number of test passes.

    3. Reordering detection for DAG-NOT-DAG had no obvious real
       benefit.

We don't have evidence from real uses cases to help us debate
conclusions #2 and #3, but #1 at least seems intuitive.

Reviewed By: probinson

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

llvm-svn: 337605

6 years ago[llvm-objcopy] Add basic support for --rename-section
Jordan Rupprecht [Fri, 20 Jul 2018 19:54:24 +0000 (19:54 +0000)]
[llvm-objcopy] Add basic support for --rename-section

Summary:
Add basic support for --rename-section=old=new to llvm-objcopy.

A full replacement for GNU objcopy requires also modifying flags (i.e. --rename-section=old=new,flag1,flag2); I'd like to keep that in a separate change to keep this simple.

Reviewers: jakehehrlich, alexshap

Subscribers: llvm-commits

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

llvm-svn: 337604

6 years agoMark REAL(swapcontext) with indirect_return attribute on x86
H.J. Lu [Fri, 20 Jul 2018 19:24:11 +0000 (19:24 +0000)]
Mark REAL(swapcontext) with indirect_return attribute on x86

When shadow stack from Intel CET is enabled, the first instruction of all
indirect branch targets must be a special instruction, ENDBR.

lib/asan/asan_interceptors.cc has

...
  int res = REAL(swapcontext)(oucp, ucp);
...

REAL(swapcontext) is a function pointer to swapcontext in libc.  Since
swapcontext may return via indirect branch on x86 when shadow stack is
enabled, as in this case,

int res = REAL(swapcontext)(oucp, ucp);
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^  This function may be
returned via an indirect branch.

Here compiler must insert ENDBR after call, like

call *bar(%rip)
endbr64

I opened an LLVM bug:

https://bugs.llvm.org/show_bug.cgi?id=38207

to add the indirect_return attribute so that it can be used to inform
compiler to insert ENDBR after REAL(swapcontext) call.  We mark
REAL(swapcontext) with the indirect_return attribute if it is available.

This fixed:

https://bugs.llvm.org/show_bug.cgi?id=38249

Reviewed By: eugenis

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

llvm-svn: 337603

6 years ago[clang-doc] Adding PublicOnly flag
Julie Hockett [Fri, 20 Jul 2018 18:49:55 +0000 (18:49 +0000)]
[clang-doc] Adding PublicOnly flag

Submitted on behalf of Annie Cherkaev (@anniecherk)

Added a flag which, when enabled, documents only those methods and
fields which have a Public attribute.

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

llvm-svn: 337602

6 years ago[clangd] Fix racy use-after-scope in unittest
Benjamin Kramer [Fri, 20 Jul 2018 18:45:25 +0000 (18:45 +0000)]
[clangd] Fix racy use-after-scope in unittest

This only shows up with asan when the stars align in a bad way.

llvm-svn: 337601

6 years agoAnd add a lit substitution for llvm-undname, as the comment says to
Reid Kleckner [Fri, 20 Jul 2018 18:45:01 +0000 (18:45 +0000)]
And add a lit substitution for llvm-undname, as the comment says to

llvm-svn: 337600

6 years agoRemove a superfluous semicolon
Martin Storsjo [Fri, 20 Jul 2018 18:43:42 +0000 (18:43 +0000)]
Remove a superfluous semicolon

llvm-svn: 337599

6 years ago[COFF] Sort .reloc before all other discardable sections
Martin Storsjo [Fri, 20 Jul 2018 18:43:35 +0000 (18:43 +0000)]
[COFF] Sort .reloc before all other discardable sections

If a binary is stripped, which can remove discardable sections (except
for the .reloc section, which also is marked as discardable as it isn't
loaded at runtime, only read by the loader), the .reloc section should
be first of them, in order not to create gaps in the image.

Previously, binaries with relocations were broken if they were stripped
by GNU binutils strip. Trying to execute such binaries produces an error
about "xx is not a valid win32 application".

This fixes GNU binutils bug 23348.

Prior to SVN r329370 (which didn't intend to have functional changes),
the code for moving discardable sections to the end didn't clearly
express how other discardable sections should be ordered compared to
.reloc, but the change retained the exact same end result as before.

After SVN r329370, the code (and comments) more clearly indicate that
it tries to make the .reloc section the absolutely last one; this patch
changes that.

This matches how GNU binutils ld sorts .reloc compared to dwarf debug
info sections.

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

Signed-off-by: Martin Storsjö <martin@martin.st>
llvm-svn: 337598

6 years agoMake check-llvm depend on llvm-undname
Reid Kleckner [Fri, 20 Jul 2018 18:42:19 +0000 (18:42 +0000)]
Make check-llvm depend on llvm-undname

llvm-svn: 337597

6 years ago[Demangler] Correctly factor in assignment when allocating.
Zachary Turner [Fri, 20 Jul 2018 18:35:06 +0000 (18:35 +0000)]
[Demangler] Correctly factor in assignment when allocating.

Incidentally all allocations that we currently perform were
properly aligned, but this was only an accident.

Thanks to Erik Pilkington for catching this.

llvm-svn: 337596

6 years ago[ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for
Lang Hames [Fri, 20 Jul 2018 18:31:53 +0000 (18:31 +0000)]
[ORC] Add new symbol lookup methods to ExecutionSessionBase in preparation for
deprecating SymbolResolver and AsynchronousSymbolQuery.

Both lookup overloads take a VSO search order to perform the lookup. The first
overload is non-blocking and takes OnResolved and OnReady callbacks. The second
is blocking, takes a boolean flag to indicate whether to wait until all symbols
are ready, and returns a SymbolMap. Both overloads take a RegisterDependencies
function to register symbol dependencies (if any) on the query.

llvm-svn: 337595

6 years ago[ORC] Simplify VSO::lookupFlags to return the flags map.
Lang Hames [Fri, 20 Jul 2018 18:31:52 +0000 (18:31 +0000)]
[ORC] Simplify VSO::lookupFlags to return the flags map.

This discards the unresolved symbols set and returns the flags map directly
(rather than mutating it via the first argument).

The unresolved symbols result made it easy to chain lookupFlags calls, but such
chaining should be rare to non-existant (especially now that symbol resolvers
are being deprecated) so the simpler method signature is preferable.

llvm-svn: 337594

6 years ago[ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.
Lang Hames [Fri, 20 Jul 2018 18:31:50 +0000 (18:31 +0000)]
[ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.

A search order is a list of VSOs to be searched linearly to find symbols. Each
VSO now has a search order that will be used when fixing up definitions in that
VSO. Each VSO's search order defaults to just that VSO itself.

This is a first step towards removing symbol resolvers from ORC altogether. In
practice symbol resolvers tended to be used to implement a search order anyway,
sometimes with additional programatic generation of symbols. Now that VSOs
support programmatic generation of definitions via fallback generators, search
orders provide a cleaner way to achieve the desired effect (while removing a lot
of boilerplate).

llvm-svn: 337593

6 years ago[Demangler] Add missing overrides
Benjamin Kramer [Fri, 20 Jul 2018 18:22:12 +0000 (18:22 +0000)]
[Demangler] Add missing overrides

-Winconsistent-missing-override complains about this.

llvm-svn: 337592

6 years agoFix a few warnings and style issues in MS demangler.
Zachary Turner [Fri, 20 Jul 2018 18:07:33 +0000 (18:07 +0000)]
Fix a few warnings and style issues in MS demangler.

Also remove a broken test case.

llvm-svn: 337591

6 years ago[X86] Remove isel patterns for MOVSS/MOVSD ISD opcodes with integer types.
Craig Topper [Fri, 20 Jul 2018 17:57:53 +0000 (17:57 +0000)]
[X86] Remove isel patterns for MOVSS/MOVSD ISD opcodes with integer types.

Ideally our ISD node types going into the isel table would have types consistent with their instruction domain. This prevents us having to duplicate patterns with different types for the same instruction.

Unfortunately, it seems our shuffle combining is currently relying on this a little remove some bitcasts. This seems to enable some switching between shufps and shufd. Hopefully there's some way we can address this in the combining.

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

llvm-svn: 337590

6 years ago[X86] Remove what appear to be unnecessary uses of DCI.CombineTo
Craig Topper [Fri, 20 Jul 2018 17:57:42 +0000 (17:57 +0000)]
[X86] Remove what appear to be unnecessary uses of DCI.CombineTo

CombineTo is most useful when you need to replace multiple results, avoid the worklist management, or you need to something else after the combine, etc. Otherwise you should be able to just return the new node and let DAGCombiner go through its usual worklist code.

All of the places changed in this patch look to be standard cases where we should be able to use the more stand behavior of just returning the new node.

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

llvm-svn: 337589

6 years agoFix linker failure with Any.
Zachary Turner [Fri, 20 Jul 2018 17:50:53 +0000 (17:50 +0000)]
Fix linker failure with Any.

This is due to a difference in MS ABI which is why I didn't see
it locally.  The included fix should work on all compilers.

llvm-svn: 337588

6 years ago[CUDA] Provide integer SIMD functions for CUDA-9.2
Artem Belevich [Fri, 20 Jul 2018 17:44:34 +0000 (17:44 +0000)]
[CUDA] Provide integer SIMD functions for CUDA-9.2

CUDA-9.2 made all integer SIMD functions into compiler builtins,
so clang no longer has access to the implementation of these
functions in either headers of libdevice and has to provide
its own implementation.

This is mostly a 1:1 mapping to a corresponding PTX instructions
with an exception of vhadd2/vhadd4 that don't have an equivalent
instruction and had to be implemented with a bit hack.

Performance of this implementation will be suboptimal for SM_50
and newer GPUs where PTXAS generates noticeably worse code for
the SIMD instructions compared to the code it generates
for the inline assembly generated by nvcc (or used to come
with CUDA headers).

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

llvm-svn: 337587

6 years ago[llvm-mca][x86] Add movsx/movzx instructions to general x86_64 resource tests
Simon Pilgrim [Fri, 20 Jul 2018 17:43:42 +0000 (17:43 +0000)]
[llvm-mca][x86] Add movsx/movzx instructions to general x86_64 resource tests

llvm-svn: 337586

6 years agoPrevent Scoped Enums from being Integral constant expressions:
Erich Keane [Fri, 20 Jul 2018 17:42:09 +0000 (17:42 +0000)]
Prevent Scoped Enums from being Integral constant expressions:

Discovered because of: https://bugs.llvm.org/show_bug.cgi?id=38235

It seems to me that a scoped enum should NOT be an integral constant expression
without a cast, so this seems like a sensical change.

Attributes that check for an integer parameter simply use this function to
ensure that they have an integer, so it was previously allowing a scoped enum.

Also added a test based on Richard's feedback to ensure that case labels still work.

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

llvm-svn: 337585

6 years agoAdd a Microsoft Demangler.
Zachary Turner [Fri, 20 Jul 2018 17:27:48 +0000 (17:27 +0000)]
Add a Microsoft Demangler.

This adds initial support for a demangling library (LLVMDemangle)
and tool (llvm-undname) for demangling Microsoft names.  This
doesn't cover 100% of cases and there are some known limitations
which I intend to address in followup patches, at least until such
time that we have (near) 100% test coverage matching up with all
of the test cases in clang/test/CodeGenCXX/mangle-ms-*.

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

llvm-svn: 337584

6 years ago[Any] Fix a typo: didn't use the correct argument
Philip Pfaffe [Fri, 20 Jul 2018 17:24:11 +0000 (17:24 +0000)]
[Any] Fix a typo: didn't use the correct argument

llvm-svn: 337583

6 years agoMerge changes to ItaniumDemangle over to libcxxabi.
Zachary Turner [Fri, 20 Jul 2018 17:16:49 +0000 (17:16 +0000)]
Merge changes to ItaniumDemangle over to libcxxabi.

ItaniumDemangle had a small NFC refactor to make some of its
code reusable by the newly added Microsoft demangler.  To keep
the libcxxabi demangler as close as possible to the master copy
this refactor is being merged over.

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

llvm-svn: 337582

6 years ago[MemorySSA] Add API to update MemoryPhis, following CFG changes.
Alina Sbirlea [Fri, 20 Jul 2018 17:13:05 +0000 (17:13 +0000)]
[MemorySSA] Add API to update MemoryPhis, following CFG changes.

Summary:
When splitting predecessors in BasicBlockUtils, we create a new block as an immediate predecessor of the original BB, then we connect a given set of predecessors to the new block.
The API in this patch will be used to update MemoryPhis for this CFG change.
If all predecessors are being moved, we move the MemoryPhi directly. Otherwise we create a new MemoryPhi in the NewBB and populate its incoming values, while deleting them from BB's Phi.
[Split from D45299 for easier review]

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 337581

6 years ago[CodeGen][ObjC] Make copying and disposing of a non-escaping block
Akira Hatanaka [Fri, 20 Jul 2018 17:10:32 +0000 (17:10 +0000)]
[CodeGen][ObjC] Make copying and disposing of a non-escaping block
no-ops.

A non-escaping block on the stack will never be called after its
lifetime ends, so it doesn't have to be copied to the heap. To prevent
a non-escaping block from being copied to the heap, this patch sets
field 'isa' of the block object to NSConcreteGlobalBlock and sets the
BLOCK_IS_GLOBAL bit of field 'flags', which causes the runtime to treat
the block as if it were a global block (calling _Block_copy on the block
just returns the original block and calling _Block_release is a no-op).

Also, a new flag bit 'BLOCK_IS_NOESCAPE' is added, which allows the
runtime or tools to distinguish between true global blocks and
non-escaping blocks.

rdar://problem/39352313

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

llvm-svn: 337580

6 years agoOn Darwin switch from the `VM_MEMORY_ANALYSIS_TOOL` VM tag to
Dan Liew [Fri, 20 Jul 2018 17:07:35 +0000 (17:07 +0000)]
On Darwin switch from the `VM_MEMORY_ANALYSIS_TOOL` VM tag to
`VM_MEMORY_SANITIZER`.

It turns out that `VM_MEMORY_ANALYSIS_TOOL` is already reserved for
use by other tools so switch to a tag reserved for use by the Sanitizers.

rdar://problem/41969783

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

llvm-svn: 337579

6 years ago[X86][XOP] Fix SUB constant folding for VPSHA/VPSHL shift lowering
Simon Pilgrim [Fri, 20 Jul 2018 16:55:18 +0000 (16:55 +0000)]
[X86][XOP] Fix SUB constant folding for VPSHA/VPSHL shift lowering

We can safely use getConstant here as we're still lowering, which allows constant folding to kick in and simplify the vector shift codegen.

Noticed while working on D49562.

llvm-svn: 337578

6 years ago[MSan] Hotfix compilation
Alexander Potapenko [Fri, 20 Jul 2018 16:52:12 +0000 (16:52 +0000)]
[MSan] Hotfix compilation

Make sure NewSI is used in materializeStores()

llvm-svn: 337577

6 years agoChange bool_constant to integral_constant.
Zachary Turner [Fri, 20 Jul 2018 16:51:55 +0000 (16:51 +0000)]
Change bool_constant to integral_constant.

bool_constant is C++17.

llvm-svn: 337576

6 years ago[ARM] Add new feature to enable optimizing the VFP registers
Evandro Menezes [Fri, 20 Jul 2018 16:49:28 +0000 (16:49 +0000)]
[ARM] Add new feature to enable optimizing the VFP registers

Enable the optimization of operations on DPR and SPR via a feature instead
of checking the target.

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

llvm-svn: 337575

6 years agoAdd llvm::Any.
Zachary Turner [Fri, 20 Jul 2018 16:39:32 +0000 (16:39 +0000)]
Add llvm::Any.

This is analogous to std::any which is only available in C++17.

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

llvm-svn: 337573

6 years agoRewrite the VS integration scripts.
Zachary Turner [Fri, 20 Jul 2018 16:30:02 +0000 (16:30 +0000)]
Rewrite the VS integration scripts.

This is a new modernized VS integration installer.  It adds a
Visual Studio .sln file which, when built, outputs a VSIX that can
be used to install ourselves as a "real" Visual Studio Extension.
We can even upload this extension to the visual studio marketplace.

This fixes a longstanding problem where we didn't support installing
into VS 2017 and higher.  In addition to supporting VS 2017, due
to the way this is written we now longer need to do anything special
to support future versions of VS as well.  Everything should
"just work".  This also fixes several bugs with our old integration,
such as MSBuild triggering full rebuilds when /Zi was used.

Finally, we add a new UI page called "LLVM" which becomes visible
when the LLVM toolchain is selected.  For now this only contains
one option which is the path to clang-cl.exe, but in the future
we can add more things here.

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

llvm-svn: 337572

6 years ago[MSan] run materializeChecks() before materializeStores()
Alexander Potapenko [Fri, 20 Jul 2018 16:28:49 +0000 (16:28 +0000)]
[MSan] run materializeChecks() before materializeStores()

When pointer checking is enabled, it's important that every pointer is
checked before its value is used.
For stores MSan used to generate code that calculates shadow/origin
addresses from a pointer before checking it.
For userspace this isn't a problem, because the shadow calculation code
is quite simple and compiler is able to move it after the check on -O2.
But for KMSAN getShadowOriginPtr() creates a runtime call, so we want the
check to be performed strictly before that call.

Swapping materializeChecks() and materializeStores() resolves the issue:
both functions insert code before the given IR location, so the new
insertion order guarantees that the code calculating shadow address is
between the address check and the memory access.

llvm-svn: 337571

6 years ago[X86][SSE] Use SplitOpsAndApply to improve HADD/HSUB lowering
Simon Pilgrim [Fri, 20 Jul 2018 16:20:45 +0000 (16:20 +0000)]
[X86][SSE] Use SplitOpsAndApply to improve HADD/HSUB lowering

Improve AVX1 256-bit vector HADD/HSUB matching by using SplitOpsAndApply to split into 128-bit instructions.

llvm-svn: 337568

6 years ago[llvm-objcopy, tests] Fix several llvm-objcopy tests
Stella Stamenova [Fri, 20 Jul 2018 16:19:36 +0000 (16:19 +0000)]
[llvm-objcopy, tests] Fix several llvm-objcopy tests

Summary: In Python 3, sys.stdout.write expects a string rather than bytes. In order to be able to write the bytes to stdout, we need to use the buffer directly instead. This change is borrowing the implementation for writing to stdout that cat.py uses. Note that we cannot use cat.py directly because the file we are trying to open is a gzip file.

Reviewers: asmith, bkramer, alexshap, jakehehrlich

Reviewed By: alexshap, jakehehrlich

Subscribers: jakehehrlich, llvm-commits

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

llvm-svn: 337567

6 years ago[X86][AVX] Add support for i16 256-bit vector horizontal op redundant shuffle removal
Simon Pilgrim [Fri, 20 Jul 2018 15:51:01 +0000 (15:51 +0000)]
[X86][AVX] Add support for i16 256-bit vector horizontal op redundant shuffle removal

llvm-svn: 337566

6 years ago[X86][AVX] Add v16i16 horizontal op redundant shuffle tests
Simon Pilgrim [Fri, 20 Jul 2018 15:41:15 +0000 (15:41 +0000)]
[X86][AVX] Add v16i16 horizontal op redundant shuffle tests

llvm-svn: 337565

6 years agoFix build breakage from r337562
Pavel Labath [Fri, 20 Jul 2018 15:40:24 +0000 (15:40 +0000)]
Fix build breakage from r337562

I changed a variable's type from pointer to reference, but forgot to
update the assert-only code.

llvm-svn: 337564

6 years ago[DAG] Avoid Node Update assertion due to AND simplification
Nirav Dave [Fri, 20 Jul 2018 15:27:24 +0000 (15:27 +0000)]
[DAG] Avoid Node Update assertion due to AND simplification

Check for construction-time folding for incomplete AND nodes in
BackwardsPropagateMask.

Fixes PR38185.

Reviewers: RKSimon, samparker

Reviewed By: samparker

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 337563

6 years agoDwarfDebug: Reduce duplication in addAccel*** methods
Pavel Labath [Fri, 20 Jul 2018 15:24:13 +0000 (15:24 +0000)]
DwarfDebug: Reduce duplication in addAccel*** methods

Summary:
Each of the four methods had a dozen lines and was doing almost exactly
the same thing: get the appropriate accelerator table kind and insert an
entry into it. I move this common logic to a helper function and make
these methods delegate to it.

This came up in the context of D49493, where I've needed to make adding
a string to a string pool slightly more complicated, and it seemed to
make sense to do it in one place instead of five.

To make this work I've needed to unify the interface of the AccelTable
data types, as some used to store DIE& and others DIE*. I chose to unify
to a reference as that's what the caller uses.

This technically isn't NFC, because it changes the StringPool used for
apple tables in the DWO case (now it uses the main file like DWARF v5
instead of the DWO file). However, that shouldn't matter, as DWO is not
a thing on apple targets (clang frontend simply ignores -gsplit-dwarf).

Reviewers: JDevlieghere, aprantl, probinson

Subscribers: llvm-commits

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

llvm-svn: 337562

6 years ago[X86][AVX] Add support for 32/64 bits 256-bit vector horizontal op redundant shuffle...
Simon Pilgrim [Fri, 20 Jul 2018 15:24:12 +0000 (15:24 +0000)]
[X86][AVX] Add support for 32/64 bits 256-bit vector horizontal op redundant shuffle removal

llvm-svn: 337561

6 years ago[DAG] Fix Memory ordering check in ReduceLoadOpStore.
Nirav Dave [Fri, 20 Jul 2018 15:20:50 +0000 (15:20 +0000)]
[DAG] Fix Memory ordering check in ReduceLoadOpStore.

When merging through a TokenFactor we need to check that the
load may be ordered such that no other aliasing memory operations may
happen. It is not sufficient to just check that the load is a member
of the chain token factor as it there may be a indirect chain. Require
the load's chain has only one use.

This fixes PR37826.

Reviewers: spatel, davide, efriedma, craig.topper, RKSimon

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 337560

6 years ago[analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.
Reka Kovacs [Fri, 20 Jul 2018 15:14:49 +0000 (15:14 +0000)]
[analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.

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

llvm-svn: 337559

6 years ago[X86][AVX] Add 256-bit vector horizontal op redundant shuffle tests
Simon Pilgrim [Fri, 20 Jul 2018 15:07:53 +0000 (15:07 +0000)]
[X86][AVX] Add 256-bit vector horizontal op redundant shuffle tests

llvm-svn: 337558

6 years ago[scudo] Simplify internal names (NFC)
Kostya Kortchinsky [Fri, 20 Jul 2018 15:07:17 +0000 (15:07 +0000)]
[scudo] Simplify internal names (NFC)

Summary:
There is currently too much redundancy in the class/variable/* names in Scudo:
- we are in the namespace `__scudo`, so there is no point in having something
  named `ScudoX` to end up with a final name of `__scudo::ScudoX`;
- there are a lot of types/* that have `Allocator` in the name, given that
  Scudo is an allocator I figure this doubles up as well.

So change a bunch of the Scudo names to make them shorter, less redundant, and
overall simpler. They should still be pretty self explaining (or at least it
looks so to me).

The TSD part will be done in another CL (eg `__scudo::ScudoTSD`).

Reviewers: alekseyshl, eugenis

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 337557

6 years ago[www] Add CodeCompass and CodeChecker to Clang Related Projects page
Bruno Cardoso Lopes [Fri, 20 Jul 2018 14:46:10 +0000 (14:46 +0000)]
[www] Add CodeCompass and CodeChecker to Clang Related Projects page

llvm-svn: 337555

6 years ago[IPSCCP] Fix for bot failure caused by r337548
Florian Hahn [Fri, 20 Jul 2018 14:37:10 +0000 (14:37 +0000)]
[IPSCCP] Fix for bot failure caused by r337548

llvm-svn: 337554

6 years agoImplement cpu_dispatch/cpu_specific Multiversioning
Erich Keane [Fri, 20 Jul 2018 14:13:28 +0000 (14:13 +0000)]
Implement cpu_dispatch/cpu_specific Multiversioning

As documented here: https://software.intel.com/en-us/node/682969 and
https://software.intel.com/en-us/node/523346. cpu_dispatch multiversioning
is an ICC feature that provides for function multiversioning.

This feature is implemented with two attributes: First, cpu_specific,
which specifies the individual function versions. Second, cpu_dispatch,
which specifies the location of the resolver function and the list of
resolvable functions.

This is valuable since it provides a mechanism where the resolver's TU
can be specified in one location, and the individual implementions
each in their own translation units.

The goal of this patch is to be source-compatible with ICC, so this
implementation diverges from the ICC implementation in a few ways:
1- Linux x86/64 only: This implementation uses ifuncs in order to
properly dispatch functions. This is is a valuable performance benefit
over the ICC implementation. A future patch will be provided to enable
this feature on Windows, but it will obviously more closely fit ICC's
implementation.
2- CPU Identification functions: ICC uses a set of custom functions to identify
the feature list of the host processor. This patch uses the cpu_supports
functionality in order to better align with 'target' multiversioning.
1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function
marked cpu_dispatch be an empty definition. This patch supports that as well,
however declarations are also permitted, since the linker will solve the
issue of multiple emissions.

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

llvm-svn: 337552

6 years agoRegenerate partial vector fold test. NFCI.
Simon Pilgrim [Fri, 20 Jul 2018 13:58:57 +0000 (13:58 +0000)]
Regenerate partial vector fold test. NFCI.

llvm-svn: 337551

6 years agoesan: fix shadow setup
Dmitry Vyukov [Fri, 20 Jul 2018 13:40:08 +0000 (13:40 +0000)]
esan: fix shadow setup

r337531 changed return type of MmapFixedNoReserve, but esan wasn't updated.
As the result esan shadow setup always fails.
We probably need to make MmapFixedNoAccess signature consistent
with MmapFixedNoReserve. But this is just to unbreak tests.

llvm-svn: 337550

6 years ago[NFC][testcases] fold sdiv if two operands are negated and non-overflow
Chen Zheng [Fri, 20 Jul 2018 13:38:59 +0000 (13:38 +0000)]
[NFC][testcases] fold sdiv if two operands are negated and non-overflow

llvm-svn: 337549

6 years agoRecommit r328307: [IPSCCP] Use constant range information for comparisons of parameters.
Florian Hahn [Fri, 20 Jul 2018 13:29:12 +0000 (13:29 +0000)]
Recommit r328307: [IPSCCP] Use constant range information for comparisons of parameters.

This version contains a fix to add values for which the state in ParamState change
to the worklist if the state in ValueState did not change. To avoid adding the
same value multiple times, mergeInValue returns true, if it added the value to
the worklist. The value is added to the worklist depending on its state in
ValueState.

Original message:
For comparisons with parameters, we can use the ParamState lattice
elements which also provide constant range information. This improves
the code for PR33253 further and gets us closer to use
ValueLatticeElement for all values.

Also, as we are using the range information in the solver directly, we
do not need tryToReplaceWithConstantRange afterwards anymore.

Reviewers: dberlin, mssimpso, davide, efriedma

Reviewed By: mssimpso

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

llvm-svn: 337548

6 years ago[X86][AVX] Convert X86ISD::VBROADCAST demanded elts combine to use SimplifyDemandedVe...
Simon Pilgrim [Fri, 20 Jul 2018 13:26:51 +0000 (13:26 +0000)]
[X86][AVX] Convert X86ISD::VBROADCAST demanded elts combine to use SimplifyDemandedVectorElts

This is an early step towards using SimplifyDemandedVectorElts for target shuffle combining - this merely moves the existing X86ISD::VBROADCAST simplification code to use the SimplifyDemandedVectorElts mechanism.

Adds X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode to handle X86ISD::VBROADCAST - in time we can support all target shuffles (and other ops) here.

llvm-svn: 337547

6 years agoRegenerate remainder test.
Simon Pilgrim [Fri, 20 Jul 2018 13:14:29 +0000 (13:14 +0000)]
Regenerate remainder test.

llvm-svn: 337546

6 years ago[InstSimplify] fold srem instruction if its two operands are negated.
Chen Zheng [Fri, 20 Jul 2018 13:00:47 +0000 (13:00 +0000)]
[InstSimplify] fold srem instruction if its two operands are negated.

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

llvm-svn: 337545

6 years ago[DebugInfo] Generate .debug_names section when it makes sense
Pavel Labath [Fri, 20 Jul 2018 12:59:05 +0000 (12:59 +0000)]
[DebugInfo] Generate .debug_names section when it makes sense

Summary:
This patch makes us generate the debug_names section in response to some
user-facing commands (previously it was only generated if explicitly
selected via the -accel-tables option).

My goal was to make this work for DWARF>=5 (as it's an official part of
that standard), and also, as an extension, for DWARF<5 if one is
explicitly tuning for lldb as a debugger (because it brings a large
performance improvement there).

This is slightly complicated by the fact that the debug_names tables are
incompatible with the DWARF v4 type units (they assume that the type
units are in the debug_info section), and unfortunately, right now we
generate DWARF v4-style type units even for -gdwarf-5. For this reason,
I disable all accelerator tables if the user requested type unit
generation. I do this even for apple tables, as they have the same
problem (in fact generating type units for apple targets makes us crash
even before we get around to emitting the accelerator tables).

Reviewers: JDevlieghere, aprantl, dblaikie, echristo, probinson

Subscribers: llvm-commits

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

llvm-svn: 337544

6 years ago[NFC][testcases] more testcases for folding srem if its two operands are negatived.
Chen Zheng [Fri, 20 Jul 2018 12:53:45 +0000 (12:53 +0000)]
[NFC][testcases] more testcases for folding srem if its two operands are negatived.

llvm-svn: 337543

6 years ago[SystemZ] Test case formatting fixes
Ulrich Weigand [Fri, 20 Jul 2018 12:12:10 +0000 (12:12 +0000)]
[SystemZ] Test case formatting fixes

Fix systematically wrong whitespace from a prior automated change.

NFC.

llvm-svn: 337542

6 years agoRevert "[LSV] Refactoring + supporting bitcasts to a type of different size"
Sam McCall [Fri, 20 Jul 2018 12:03:00 +0000 (12:03 +0000)]
Revert "[LSV] Refactoring + supporting bitcasts to a type of different size"

This reverts commit r337489.
It causes asserts to fire in some TensorFlow tests, e.g.
tensorflow/compiler/tests/gather_test.py on GPU.

Example stack trace:
Start test case: GatherTest.testHigherRank
assertion failed at third_party/llvm/llvm/lib/Support/APInt.cpp:819 in llvm::APInt llvm::APInt::trunc(unsigned int) const: width && "Can't truncate to 0 bits"
    @     0x5559446ebe10  __assert_fail
    @     0x55593ef32f5e  llvm::APInt::trunc()
    @     0x55593d78f86e  (anonymous namespace)::Vectorizer::lookThroughComplexAddresses()
    @     0x55593d78f2bc  (anonymous namespace)::Vectorizer::areConsecutivePointers()
    @     0x55593d78d128  (anonymous namespace)::Vectorizer::isConsecutiveAccess()
    @     0x55593d78c926  (anonymous namespace)::Vectorizer::vectorizeInstructions()
    @     0x55593d78c221  (anonymous namespace)::Vectorizer::vectorizeChains()
    @     0x55593d78b948  (anonymous namespace)::Vectorizer::run()
    @     0x55593d78b725  (anonymous namespace)::LoadStoreVectorizer::runOnFunction()
    @     0x55593edf4b17  llvm::FPPassManager::runOnFunction()
    @     0x55593edf4e55  llvm::FPPassManager::runOnModule()
    @     0x55593edf563c  (anonymous namespace)::MPPassManager::runOnModule()
    @     0x55593edf5137  llvm::legacy::PassManagerImpl::run()
    @     0x55593edf5b71  llvm::legacy::PassManager::run()
    @     0x55593ced250d  xla::gpu::IrDumpingPassManager::run()
    @     0x55593ced5033  xla::gpu::(anonymous namespace)::EmitModuleToPTX()
    @     0x55593ced40ba  xla::gpu::(anonymous namespace)::CompileModuleToPtx()
    @     0x55593ced33d0  xla::gpu::CompileToPtx()
    @     0x55593b26b2a2  xla::gpu::NVPTXCompiler::RunBackend()
    @     0x55593b21f973  xla::Service::BuildExecutable()
    @     0x555938f44e64  xla::LocalService::CompileExecutable()
    @     0x555938f30a85  xla::LocalClient::Compile()
    @     0x555938de3c29  tensorflow::XlaCompilationCache::BuildExecutable()
    @     0x555938de4e9e  tensorflow::XlaCompilationCache::CompileImpl()
    @     0x555938de3da5  tensorflow::XlaCompilationCache::Compile()
    @     0x555938c5d962  tensorflow::XlaLocalLaunchBase::Compute()
    @     0x555938c68151  tensorflow::XlaDevice::Compute()
    @     0x55593f389e1f  tensorflow::(anonymous namespace)::ExecutorState::Process()
    @     0x55593f38a625  tensorflow::(anonymous namespace)::ExecutorState::ScheduleReady()::$_1::operator()()
*** SIGABRT received by PID 7798 (TID 7837) from PID 7798; ***

llvm-svn: 337541

6 years agoSema: Fix explicit address space cast in C++
Yaxun Liu [Fri, 20 Jul 2018 11:32:51 +0000 (11:32 +0000)]
Sema: Fix explicit address space cast in C++

Currently clang does not allow implicit cast of a pointer to a pointer type
in different address space but allows C-style cast of a pointer to a pointer
type in different address space. However, there is a bug in Sema causing
incorrect Cast Expr in AST for the latter case, which in turn results in
invalid LLVM IR in codegen.

This is because Sema::IsQualificationConversion returns true for a cast of
pointer to a pointer type in different address space, which in turn allows
a standard conversion and results in a cast expression with no op in AST.

This patch fixes that by let Sema::IsQualificationConversion returns false
for a cast of pointer to a pointer type in different address space, which
in turn disallows standard conversion, implicit cast, and static cast.
Finally it results in an reinterpret cast and correct conversion kind is set.

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

llvm-svn: 337540

6 years ago[UBSan] Also use blacklist for 'Address; Undefined' setting
Florian Hahn [Fri, 20 Jul 2018 10:12:31 +0000 (10:12 +0000)]
[UBSan] Also use blacklist for 'Address; Undefined' setting

It looks like currently the UBSan blacklist is only applied when "Undefined" is selected.
This patch updates the cmake file to apply it whenever Undefined is selected
 (e.g. 'Address; Undefined' ). This  allows us to use the workaround added in
rL335525 when using AddressSan and UBSan together.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

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

llvm-svn: 337539

6 years ago[SystemZ] Reimplent SchedModel IssueWidth and WriteRes/ReadAdvance mappings.
Jonas Paulsson [Fri, 20 Jul 2018 09:40:43 +0000 (09:40 +0000)]
[SystemZ] Reimplent SchedModel IssueWidth and WriteRes/ReadAdvance mappings.

As a consequence of recent discussions
(http://lists.llvm.org/pipermail/llvm-dev/2018-May/123164.html), this patch
changes the SystemZ SchedModels so that the IssueWidth is 6, which is the
decoder capacity, and NumMicroOps become the number of decoder slots needed
per instruction.

In addition, the SchedWrite latencies now match the MachineInstructions
def-operand indexes, and ReadAdvances have been added on instructions with
one register operand and one memory operand.

Review: Ulrich Weigand
https://reviews.llvm.org/D47008

llvm-svn: 337538

6 years agoImproved sched model for X86 BSWAP* instrs.
Andrew V. Tischenko [Fri, 20 Jul 2018 09:39:14 +0000 (09:39 +0000)]
Improved sched model for X86 BSWAP* instrs.
Differential Revision: https://reviews.llvm.org/D49477

llvm-svn: 337537

6 years ago[Xray] fix c99 warning build about flexible array semantics
David Carlier [Fri, 20 Jul 2018 09:22:22 +0000 (09:22 +0000)]
[Xray] fix c99 warning build about flexible array semantics

Reviewers: dberris

Reviewed By: dberris

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

llvm-svn: 337536

6 years agoReapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"
Matt Arsenault [Fri, 20 Jul 2018 09:05:08 +0000 (09:05 +0000)]
Reapply "AMDGPU: Fix handling of alignment padding in DAG argument lowering"

Reverts r337079 with fix for msan error.

llvm-svn: 337535

6 years ago[AArch64][SVE] Asm: Support for bit/byte reverse operations.
Sander de Smalen [Fri, 20 Jul 2018 09:00:44 +0000 (09:00 +0000)]
[AArch64][SVE] Asm: Support for bit/byte reverse operations.

This patch adds the following instructions:

  RBIT      reverse bits within each active elemnt (predicated), e.g.
                rbit z0.d, p0/m, z1.d

            for 8, 16, 32 and 64 bit elements.

  REV       reverse order of elements in data/predicate vector
            (unpredicated), e.g.
                rev z0.d, z1.d
                rev p0.d, p1.d

            for 8, 16, 32 and 64 bit elements.

  REVB      reverse order of bytes within each active element, e.g.
                revb z0.d, p0/m, z1.d

            for 16, 32 and 64 bit elements.

  REVH      reverse order of 16-bit half-words within each active
            element, e.g.
                revh z0.d, p0/m, z1.d

            for 32 and 64 bit elements.

  REVW      reverse order of 32-bit words within each active element,
            e.g.
                revw z0.d, p0/m, z1.d

            for 64 bit elements.

llvm-svn: 337534

6 years ago[AArch64][SVE] Asm: Support for FTMAD instruction.
Sander de Smalen [Fri, 20 Jul 2018 08:47:26 +0000 (08:47 +0000)]
[AArch64][SVE] Asm: Support for FTMAD instruction.

Floating-point trigonometric multiply-add coefficient,
e.g.

  ftmad z0.h, z0.h, z1.h, #7

with variants for 16, 32 and 64-bit elements.

llvm-svn: 337533

6 years agoadjust incorrect comment
Eric Fiselier [Fri, 20 Jul 2018 08:36:45 +0000 (08:36 +0000)]
adjust incorrect comment

llvm-svn: 337532

6 years agosanitizers: consistently check result of MmapFixedNoReserve
Dmitry Vyukov [Fri, 20 Jul 2018 08:33:41 +0000 (08:33 +0000)]
sanitizers: consistently check result of MmapFixedNoReserve

MmapFixedNoReserve does not terminate process on failure.
Failure to check its result and die will always lead to harder
to debug crashes later in execution. This was observed in Go
processes due to some address space conflicts.

Consistently check result of MmapFixedNoReserve.
While we are here also add warn_unused_result attribute
to prevent such bugs in future and change return type to bool
as that's what all callers want.

Reviewed in https://reviews.llvm.org/D49367

llvm-svn: 337531

6 years agoChange \t to spaces
Fangrui Song [Fri, 20 Jul 2018 08:19:20 +0000 (08:19 +0000)]
Change \t to spaces

llvm-svn: 337530

6 years ago[Index] Set OrigD before D is changed.
Eric Liu [Fri, 20 Jul 2018 08:08:56 +0000 (08:08 +0000)]
[Index] Set OrigD before D is changed.

Reviewers: akyrtzi, arphaman

Reviewed By: akyrtzi

Subscribers: cfe-commits

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

llvm-svn: 337529

6 years ago[ELF] - Fix mistypes in test cases.
George Rimar [Fri, 20 Jul 2018 08:07:33 +0000 (08:07 +0000)]
[ELF] - Fix mistypes in test cases.

llvm-svn: 337528

6 years ago[clangd] FuzzyMatch exposes an API for its word segmentation. NFC
Sam McCall [Fri, 20 Jul 2018 08:01:37 +0000 (08:01 +0000)]
[clangd] FuzzyMatch exposes an API for its word segmentation. NFC

Summary: This is intended to be used for indexing, e.g. in D49417

Reviewers: ioeric, omtcyfz

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 337527

6 years ago[COFF] Write the debug directory and build id to a separate section for MinGW
Martin Storsjo [Fri, 20 Jul 2018 05:44:34 +0000 (05:44 +0000)]
[COFF] Write the debug directory and build id to a separate section for MinGW

For dwarf debug info, an executable normally either contains the debug
info, or it is stripped out. To reduce the storage needed (slightly)
for the debug info kept separately from the released, stripped binaries,
one can choose to only copy the debug data from the original executable
(essentially the reverse of the strip operation), producing a file with
only debug info.

When copying the debug data from an executable with GNU objcopy,
the build id and debug directory need to reside in a separate section,
as this will be kept while the rest of the .rdata section is removed.

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

llvm-svn: 337526

6 years agoDocument -fobjc-weak as an extension.
John McCall [Fri, 20 Jul 2018 05:40:12 +0000 (05:40 +0000)]
Document -fobjc-weak as an extension.

Fixes rdar://24091053.

llvm-svn: 337525

6 years agoFix and improve the ARC spec's wording about unmanaged objects.
John McCall [Fri, 20 Jul 2018 05:40:09 +0000 (05:40 +0000)]
Fix and improve the ARC spec's wording about unmanaged objects.

llvm-svn: 337524

6 years agoAdd x86_64-unkown triple to llc for x86 test.
Stephen Canon [Fri, 20 Jul 2018 03:50:55 +0000 (03:50 +0000)]
Add x86_64-unkown triple to llc for x86 test.

llvm-svn: 337523

6 years ago[libFuzzer] Use separate test directory for each config
Joel E. Denny [Fri, 20 Jul 2018 02:39:01 +0000 (02:39 +0000)]
[libFuzzer] Use separate test directory for each config

Previously, check-all failed many tests for me.  It was running the
X86_64DefaultLinuxConfig, X86_64LibcxxLinuxConfig, and
X86_64StaticLibcxxLinuxConfig configs out of
llvm-build/projects/compiler-rt/test/fuzzer.  Now, it runs them out of
separate subdirectories there, and most tests pass.

Reviewed By: morehouse, george.karpenkov

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

llvm-svn: 337521

6 years agoFix two test failures in <experimental/filesystem>
Eric Fiselier [Fri, 20 Jul 2018 01:51:48 +0000 (01:51 +0000)]
Fix two test failures in <experimental/filesystem>

First, <experimental/filesystem> didn't correctly guard
against min/max macros. This adds the proper push/pop macro guards.

Second, an internal time helper had been renamed but the test for
it hadn't been updated. This patch updates those tests.

llvm-svn: 337520

6 years agoUse _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return
Eric Fiselier [Fri, 20 Jul 2018 01:44:33 +0000 (01:44 +0000)]
Use _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return

llvm-svn: 337519

6 years ago[DAGCombiner] Fold X - (-Y *Z) -> X + (Y * Z)
Craig Topper [Fri, 20 Jul 2018 01:40:03 +0000 (01:40 +0000)]
[DAGCombiner] Fold X - (-Y *Z) -> X + (Y * Z)

llvm-svn: 337518

6 years agocleanup test assertion inside library
Eric Fiselier [Fri, 20 Jul 2018 01:25:06 +0000 (01:25 +0000)]
cleanup test assertion inside library

llvm-svn: 337517

6 years ago[libc++] Implement Directory Entry Caching -- Sort of.
Eric Fiselier [Fri, 20 Jul 2018 01:22:32 +0000 (01:22 +0000)]
[libc++] Implement Directory Entry Caching -- Sort of.

Summary:
This patch implements directory_entry caching *almost* as specified in P0317r1. However, I explicitly chose to deviate from the standard as I'll explain below.

The approach I decided to take is a fully caching one. When `refresh()` is called, the cache is populated by calls to `stat` and `lstat` as needed.
During directory iteration the cache is only populated with the `file_type` as reported by `readdir`.
The cache can be in the following states:

* `_Empty`: There is nothing in the cache (likely due to an error)
* `_IterSymlink`: Created by directory iteration when we walk onto a symlink only the symlink file type is known.
* `_IterNonSymlink`: Created by directory iteration when we walk onto a non-symlink. Both the regular file type and symlink file type are known.
* `_RefreshSymlink` and `_RefreshNonSymlink`: A full cache created by `refresh()`.  This case includes dead symlinks.
* `_RefreshSymlinkUnresolved`: A partial cache created by refresh when we fail to resolve the file pointed to by a symlink (likely due to permissions). Symlink attributes are cached, but attributes about the linked entity are not.

As mentioned, this implementation purposefully deviates from the standard. According to some readings of the specification, and the Windows filesystem implementation, the constructors and modifiers which don't pass an `error_code` must throw when the `directory_entry` points to a entity which doesn't exist. or when attribute resolution fails for another reason.

@BillyONeal  has proposed a more reasonable set of requirements, where modifiers other than refresh ignore errors. This is the behavior libc++ currently implements, with the expectation some form of the new language will be accepted into the standard.

Some additional semantics which differ from the Windows implementation:

1. `refresh` will not throw when the entry doesn't exist. In this case we can still meet the functions specification, so we don't treat it as an error.
2. We don't clear the path name when a constructor fails via refresh (this will hopefully be changed in the standard as well).

It should be noted that libstdc++'s current implementation has the same behavior as libc++, except for point (2).

If the changes to the specification don't get accepted, we'll be able to make the changes later.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0317r1.html

Reviewers: mclow.lists, gromer, ldionne, aaron.ballman

Subscribers: BillyONeal, christof, cfe-commits

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

llvm-svn: 337516

6 years agoDefend LoadImageUsingPaths against a path list
Jim Ingham [Fri, 20 Jul 2018 01:20:18 +0000 (01:20 +0000)]
Defend LoadImageUsingPaths against a path list
with empty paths on it.

llvm-svn: 337515

6 years agoReapply "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"
Duncan P. N. Exon Smith [Fri, 20 Jul 2018 00:44:58 +0000 (00:44 +0000)]
Reapply "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"

I'm optimistically reverting commit r337511, effectively reapplying
r337504 *without* changes.

The failing bots that had `SmallVector` in the backtrace recovered after
the unrelated commit r337508.  The backtraces looked bogus anyway, with
`SmallVector::size()` calling (e.g.) `ConstantArray::get()`.

Here's the original commit message:

    ADT: Shrink size of SmallVector by 8B on 64-bit platforms

    Represent size and capacity directly as unsigned and calculate
    `end()` using `begin() + size()`.

    This limits the maximum size/capacity of a vector to UINT32_MAX.

    https://reviews.llvm.org/D48518

llvm-svn: 337514

6 years agoRevert "[docs] Add support for Markdown documentation in Sphinx"
Michael J. Spencer [Fri, 20 Jul 2018 00:24:36 +0000 (00:24 +0000)]
Revert "[docs] Add support for Markdown documentation in Sphinx"

The buildbots have an old version of Sphinx (need at least 1.3).  Revert until they are upgraded.

llvm-svn: 337513

6 years ago[WebAssembly] Disable a test that violates DR1696
Heejin Ahn [Fri, 20 Jul 2018 00:13:42 +0000 (00:13 +0000)]
[WebAssembly] Disable a test that violates DR1696

Summary:
lifetime2.C violates DR1696, which prevents reference members from being
initialized to temporaries, whose lifetime would end at the end of ctor.

Reviewers: sbc100

Subscribers: dschuff, sunfish, llvm-commits

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

llvm-svn: 337512

6 years agoRevert "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"
Duncan P. N. Exon Smith [Fri, 20 Jul 2018 00:09:56 +0000 (00:09 +0000)]
Revert "ADT: Shrink size of SmallVector by 8B on 64-bit platforms"

This reverts commit r337504 while I investigate a TSan bot failure that
seems related:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/26526

    #8 0x000055581f2895d8 (/b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/bin/clang-7+0x1eb45d8)
    #9 0x000055581f294323 llvm::ConstantAggrKeyType<llvm::ConstantArray>::create(llvm::ArrayType*) const /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:409:0
    #10 0x000055581f294323 llvm::ConstantUniqueMap<llvm::ConstantArray>::create(llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray>, std::pair<unsigned int, std::pair<llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray> > >&) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:635:0
    #11 0x000055581f294323 llvm::ConstantUniqueMap<llvm::ConstantArray>::getOrCreate(llvm::ArrayType*, llvm::ConstantAggrKeyType<llvm::ConstantArray>) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/ConstantsContext.h:654:0
    #12 0x000055581f2944cb llvm::ConstantArray::get(llvm::ArrayType*, llvm::ArrayRef<llvm::Constant*>) /b/sanitizer-x86_64-linux-autoconf/build/llvm/lib/IR/Constants.cpp:964:0
    #13 0x000055581fa27e19 llvm::SmallVectorBase::size() const /b/sanitizer-x86_64-linux-autoconf/build/llvm/include/llvm/ADT/SmallVector.h:53:0
    #14 0x000055581fa27e19 llvm::SmallVectorImpl<llvm::Constant*>::resize(unsigned long) /b/sanitizer-x86_64-linux-autoconf/build/llvm/include/llvm/ADT/SmallVector.h:347:0
    #15 0x000055581fa27e19 (anonymous namespace)::EmitArrayConstant(clang::CodeGen::CodeGenModule&, clang::ConstantArrayType const*, llvm::Type*, unsigned int, llvm::SmallVectorImpl<llvm::Constant*>&, llvm::Constant*) /b/sanitizer-x86_64-linux-autoconf/build/llvm/tools/clang/lib/CodeGen/CGExprConstant.cpp:669:0

llvm-svn: 337511

6 years ago[x86/SLH] Clean up helper naming for return instruction handling and
Chandler Carruth [Thu, 19 Jul 2018 23:46:24 +0000 (23:46 +0000)]
[x86/SLH] Clean up helper naming for return instruction handling and
remove dead declaration of a call instruction handling helper.

This moves to the 'harden' terminology that I've been trying to settle
on for returns. It also adds a really detailed comment explaining what
all we're trying to accomplish with return instructions and why.
Hopefully this makes it much more clear what exactly is being
"hardened".

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

llvm-svn: 337510