platform/upstream/llvm.git
5 years agoMark tests from r361278 as unsupported on Windows.
Russell Gallop [Wed, 22 May 2019 12:07:52 +0000 (12:07 +0000)]
Mark tests from r361278 as unsupported on Windows.

llvm-svn: 361374

5 years agoDWARF: Add debug_ranges/rnglists tests
Pavel Labath [Wed, 22 May 2019 11:44:36 +0000 (11:44 +0000)]
DWARF: Add debug_ranges/rnglists tests

.debug_ranges parsing is not well tested [citation needed] because this
section tends to be only used in optimized code, and we don't build
optimized executables in our tests, as they produce unpredictable
results.

This patch aims to add some very simple tests for parsing static range
data, which can serve as a first line of defense in case things break.

I also include one XFAILed test, which demonstrates that we don't
correctly handle mixed DWARF v5 and v4 ranges in a single file.

llvm-svn: 361373

5 years ago[ARM][AArch64] Fix incorrect handling of alignment in va_arg code generation
John Brawn [Wed, 22 May 2019 11:42:54 +0000 (11:42 +0000)]
[ARM][AArch64] Fix incorrect handling of alignment in va_arg code generation

Overaligned and underaligned types (i.e. types where the alignment has been
increased or decreased using the aligned and packed attributes) weren't being
correctly handled in all cases, as the unadjusted alignment should be used.

This patch also adjusts getTypeUnadjustedAlign to correctly handle typedefs of
non-aggregate types, which it appears it never had to handle before.

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

llvm-svn: 361372

5 years ago[VirtualFileSystem] Fix uninitialized variable warning. NFCI.
Simon Pilgrim [Wed, 22 May 2019 11:20:52 +0000 (11:20 +0000)]
[VirtualFileSystem] Fix uninitialized variable warning. NFCI.

llvm-svn: 361371

5 years ago[TargetMachine] error message unsupported code model
Sjoerd Meijer [Wed, 22 May 2019 10:40:26 +0000 (10:40 +0000)]
[TargetMachine] error message unsupported code model

When the tiny code model is requested for a target machine that does not
support this, we get an error message (which is nice) but also this diagnostic
and request to submit a bug report:

    fatal error: error in backend: Target does not support the tiny CodeModel
    [Inferior 2 (process 31509) exited with code 0106]
    clang-9: error: clang frontend command failed with exit code 70 (use -v to see invocation)
    (gdb) clang version 9.0.0 (http://llvm.org/git/clang.git 29994b0c63a40f9c97c664170244a7bba5ecc15e) (http://llvm.org/git/llvm.git 95606fdf91c2d63a931e865f4b78b2e9828ddc74)
    Target: arm-arm-none-eabi
    Thread model: posix
    clang-9: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
    clang-9: note: diagnostic msg:
    ********************
    PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
    Preprocessed source(s) and associated run script(s) are located at:
    clang-9: note: diagnostic msg: /tmp/tiny-dfe1a2.c
    clang-9: note: diagnostic msg: /tmp/tiny-dfe1a2.sh
    clang-9: note: diagnostic msg:

But this is not a bug, this is a feature. :-) Not only is this not a bug, this
is also pretty confusing. This patch causes just to print the fatal error and
not the diagnostic:

fatal error: error in backend: Target does not support the tiny CodeModel

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

llvm-svn: 361370

5 years ago[Driver][Windows] Add dependent lib argument for -fprofile-generate and -fcs-profile...
Russell Gallop [Wed, 22 May 2019 10:06:49 +0000 (10:06 +0000)]
[Driver][Windows] Add dependent lib argument for -fprofile-generate and -fcs-profile-generate

Follows on from r360674 which added it for -fprofile-instr-generate.

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

llvm-svn: 361368

5 years ago[llvm-dlltool] Respect NONAME keyword
Martin Storsjo [Wed, 22 May 2019 09:49:54 +0000 (09:49 +0000)]
[llvm-dlltool] Respect NONAME keyword

This adds proper handling of the NONAME-keyword, which makes llvm-dlltool
generate an import using the ordinal instead of the name.

Patch by by Jannik Vogel, test added by Stefan Schmidt.

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

llvm-svn: 361367

5 years agoRe-land r361257 "[MergeICmps][NFC] Make BCEAtom move-only.""
Clement Courbet [Wed, 22 May 2019 09:45:40 +0000 (09:45 +0000)]
Re-land r361257 "[MergeICmps][NFC] Make BCEAtom move-only.""

llvm-svn: 361366

5 years ago[PPC64] Fix PPC64TargetInfo ABI on clang side after D61950
Fangrui Song [Wed, 22 May 2019 09:26:46 +0000 (09:26 +0000)]
[PPC64] Fix PPC64TargetInfo ABI on clang side after D61950

llvm-svn: 361365

5 years agoCopy symbol length when we replace a symbol.
Rui Ueyama [Wed, 22 May 2019 09:19:30 +0000 (09:19 +0000)]
Copy symbol length when we replace a symbol.

Symbol's NameSize is computed lazily. Currently, when we replace a symbol,
a cached length value can be discarded. This patch propagates that value.

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

llvm-svn: 361364

5 years ago[PPC64] Fix PPC64TargetInfo after D61950
Fangrui Song [Wed, 22 May 2019 09:17:21 +0000 (09:17 +0000)]
[PPC64] Fix PPC64TargetInfo after D61950

llvm-svn: 361363

5 years agoAdd AST logging
Gabor Marton [Wed, 22 May 2019 09:10:19 +0000 (09:10 +0000)]
Add AST logging

Summary:
Log the AST of the TU associated with LLDB's `expr` command, once a declaration
is completed

Reviewers: shafik

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, lldb-commits

Tags: #lldb

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

llvm-svn: 361362

5 years agoDWARFDebugInfoEntry: remove unused variable
Pavel Labath [Wed, 22 May 2019 09:09:44 +0000 (09:09 +0000)]
DWARFDebugInfoEntry: remove unused variable

llvm-svn: 361361

5 years agoDWARF: Introduce DWARFTypeUnit class
Pavel Labath [Wed, 22 May 2019 09:09:39 +0000 (09:09 +0000)]
DWARF: Introduce DWARFTypeUnit class

Summary:
This patch introduces the DWARFTypeUnit class, and teaches lldb to parse
type units out of both the debug_types section (DWARF v4), and from the
regular debug_info section (DWARF v5).

The most important piece of functionality - resolving DW_AT_signatures
to connect type forward declarations to their definitions - is not
implemented here, but even without that, a lot of functionality becomes
available. I've added tests for the commands that start to work after
this patch.

The changes in this patch were greatly inspired by D61505, which in turn took
over changes from D32167.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: mgorny, jankratochvil, lldb-commits

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

llvm-svn: 361360

5 years ago[ELF] Improve error message for relocations to symbols defined in discarded sections
Fangrui Song [Wed, 22 May 2019 09:06:42 +0000 (09:06 +0000)]
[ELF] Improve error message for relocations to symbols defined in discarded sections

Rather than report "undefined symbol: ", give more informative message
about the object file that defines the discarded section.

In particular, PR41133, if the section is a discarded COMDAT, print the
section group signature and the object file with the prevailing
definition. This is useful to track down some ODR issues.

We need to
* add `uint32_t DiscardedSecIdx` to Undefined for this feature.
* make ComdatGroups public and change its type to DenseMap<CachedHashStringRef, const InputFile *>

Reviewed By: ruiu

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

llvm-svn: 361359

5 years agoDelete unnecessary copy ctors
Fangrui Song [Wed, 22 May 2019 08:38:23 +0000 (08:38 +0000)]
Delete unnecessary copy ctors

llvm-svn: 361358

5 years ago[Sanitizer] Add interceptor for wcsdup
Pavel Labath [Wed, 22 May 2019 08:34:56 +0000 (08:34 +0000)]
[Sanitizer] Add interceptor for wcsdup

Summary: The wide-string equivalent of strdup. Implementation trivial.

Reviewers: vitalybuka, eugenis

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

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

llvm-svn: 361357

5 years ago[MIR] Add simple PRE pass to MachineCSE
Anton Afanasyev [Wed, 22 May 2019 07:41:34 +0000 (07:41 +0000)]
[MIR] Add simple PRE pass to MachineCSE

This is the second part of the commit fixing PR38917 (hoisting
partitially redundant machine instruction). Most of PRE (partitial
redundancy elimination) and CSE work is done on LLVM IR, but some of
redundancy arises during DAG legalization. Machine CSE is not enough
to deal with it. This simple PRE implementation works a little bit
intricately: it passes before CSE, looking for partitial redundancy
and transforming it to fully redundancy, anticipating that the next
CSE step will eliminate this created redundancy. If CSE doesn't
eliminate this, than created instruction will remain dead and eliminated
later by Remove Dead Machine Instructions pass.

The third part of the commit is supposed to refactor MachineCSE,
to make it more clear and to merge MachinePRE with MachineCSE,
so one need no rely on further Remove Dead pass to clear instrs
not eliminated by CSE.

First step: https://reviews.llvm.org/D54839

Fixes llvm.org/PR38917

llvm-svn: 361356

5 years ago[PPC64] Parse -elfv1 -elfv2 when specified on target triple
Fangrui Song [Wed, 22 May 2019 07:29:59 +0000 (07:29 +0000)]
[PPC64] Parse -elfv1 -elfv2 when specified on target triple

Summary:
For big-endian powerpc64, the default ABI is ELFv1. OpenPower ABI ELFv2 is supported when -mabi=elfv2 is specified. FreeBSD support for PowerPC64 ELFv2 ABI with LLVM is in progress[1]. This patch adds an alternative way to specify ELFv2 ABI on target triple [2].

The following results are expected:

ELFv1 when using:
-target powerpc64-unknown-freebsd12.0
-target powerpc64-unknown-freebsd12.0 -mabi=elfv1
-target powerpc64-unknown-freebsd12.0-elfv1

ELFv2 when using:
-target powerpc64-unknown-freebsd12.0 -mabi=elfv2
-target powerpc64-unknown-freebsd12.0-elfv2

[1] https://wiki.freebsd.org/powerpc/llvm-elfv2
[2] https://clang.llvm.org/docs/CrossCompilation.html

Patch by Alfredo Dal'Ava Júnior!

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

llvm-svn: 361355

5 years ago[AArch64] Subtarget crypto extension defaults
Sjoerd Meijer [Wed, 22 May 2019 07:10:27 +0000 (07:10 +0000)]
[AArch64] Subtarget crypto extension defaults

The Armv8.2-A crypto extensions all defaulted to true, but should default to
false, like all the other extensions.

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

llvm-svn: 361354

5 years agoFixed a -Wunused-variable warning when assertions are disabled
Dmitri Gribenko [Wed, 22 May 2019 06:57:23 +0000 (06:57 +0000)]
Fixed a -Wunused-variable warning when assertions are disabled

llvm-svn: 361353

5 years ago[X86] Don't compare i128 through vector if construction not cheap (PR41971)
Nikita Popov [Wed, 22 May 2019 06:47:06 +0000 (06:47 +0000)]
[X86] Don't compare i128 through vector if construction not cheap (PR41971)

Fix for https://bugs.llvm.org/show_bug.cgi?id=41971. Make the
combineVectorSizedSetCCEquality() transform more conservative by
checking that the bitcast to the vector type will be cheap/free
for both operands. I'm considering it cheap if it's a constant,
a load or already a vector. I've dropped the explicit check for
f128 because it should fall out naturally (in the cases where
it'd be detrimental).

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

llvm-svn: 361352

5 years agoProperly categorize llvm-objdump options
Serge Guelton [Wed, 22 May 2019 06:30:46 +0000 (06:30 +0000)]
Properly categorize llvm-objdump options

Filters out noise, and distinguish Mach-O related options from others.

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

llvm-svn: 361351

5 years agoSimplify the logic to instantiate Symbols. Should be NFC.
Rui Ueyama [Wed, 22 May 2019 04:56:25 +0000 (04:56 +0000)]
Simplify the logic to instantiate Symbols. Should be NFC.

llvm-svn: 361350

5 years ago[NFC] Remove a blank line (test commit)
Seiya Nuta [Wed, 22 May 2019 04:48:26 +0000 (04:48 +0000)]
[NFC] Remove a blank line (test commit)

llvm-svn: 361349

5 years agoSpeculative fix for std stream destruction order on Windows.
Eric Fiselier [Wed, 22 May 2019 03:45:49 +0000 (03:45 +0000)]
Speculative fix for std stream destruction order on Windows.

The MSVC CRT uses TLS storage to implement per-thread locales.
This storage gets freed during program termination, and if we attempt
to do any io operations (like flushing the std streams) after this occurs
the program may abort.

This patch is a speculative fix for that issue.

The fix tries forcing the initialization of the locale TLS before
initializing the std streams. This should mean that the TLS is freed
after we destroy the streams.

llvm-svn: 361348

5 years ago[PowerPC] use meaningful name for displacement form aligned with x-form - NFC
Chen Zheng [Wed, 22 May 2019 03:17:39 +0000 (03:17 +0000)]
[PowerPC] use meaningful name for displacement form aligned with x-form - NFC

llvm-svn: 361347

5 years ago[PowerPC] [ISEL] select x-form instruction for unaligned offset
Chen Zheng [Wed, 22 May 2019 02:57:31 +0000 (02:57 +0000)]
[PowerPC] [ISEL] select x-form instruction for unaligned offset
Differential Revision: https://reviews.llvm.org/D62173

llvm-svn: 361346

5 years ago[docs] Fix troff macro (.F1 -> .Fl) in ld.lld.1
Fangrui Song [Wed, 22 May 2019 02:15:25 +0000 (02:15 +0000)]
[docs] Fix troff macro (.F1 -> .Fl) in ld.lld.1

llvm-svn: 361345

5 years ago[clang-tidy] remove default header-filter for run-clang-tidy
Don Hinton [Wed, 22 May 2019 01:01:11 +0000 (01:01 +0000)]
[clang-tidy] remove default header-filter for run-clang-tidy

Summary:
run-clang-tidy.py was enforcing '-header-filter' parameter with an
unfortunate default value when none was given. Thus, leading to
overwritten clang-tidy configuration (e.g. from .clang-tidy).

This change removes the default value for '-header-filter' resulting in
the default behaviour of clang-tidy itself.

Fixes PR#41426

Reviewed By: hintonda

Patch by Torbjörn Klatt!

Tags: #clang-tools-extra, #clang

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

llvm-svn: 361344

5 years ago[Docs] Increase Doxygen cache size
Don Hinton [Wed, 22 May 2019 00:56:42 +0000 (00:56 +0000)]
[Docs] Increase Doxygen cache size

Summary:
When building Doxygen docs for llvm and clang, it helpfully prints a warning at
the end noting that the `LOOKUP_CACHE_SIZE` value was too small to keep all
symbols in memory.

By increasing to the size it recommends, Doxygen builds have greatly improved
performance. On my machine, time to run `doxygen-llvm` changes from 34 minutes
to 22 minutes, which is a decent amount of time saved by changing a single
number.

Reviewed By: hintonda

Patch by J. Ryan Stinnett!

Tags: #clang, #llvm

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

llvm-svn: 361343

5 years ago[X86] [CET] Deal with return-twice function such as vfork, setjmp when
Pengfei Wang [Wed, 22 May 2019 00:50:21 +0000 (00:50 +0000)]
[X86] [CET] Deal with return-twice function such as vfork, setjmp when
CET-IBT enabled

Return-twice functions will indirectly jump after the caller's position.
So when CET-IBT is enable, we should make sure these is endbr*
instructions follow these Return-twice function caller. Like GCC does.

Patch by Xiang Zhang (xiangzhangllvm)

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

llvm-svn: 361342

5 years ago[Docs] fix formatting for bullet list; NFC
Sanjay Patel [Wed, 22 May 2019 00:48:47 +0000 (00:48 +0000)]
[Docs] fix formatting for bullet list; NFC

llvm-svn: 361341

5 years ago[Analysis] Link library dependencies to Analysis plugins
Petr Hosek [Wed, 22 May 2019 00:47:37 +0000 (00:47 +0000)]
[Analysis] Link library dependencies to Analysis plugins

These are needed to avoid undefined symbols which aren't satisfied
by Clang itself.

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

llvm-svn: 361340

5 years ago[libFuzzer] Sleep after process exits in merge-sigusr.test.
Matt Morehouse [Wed, 22 May 2019 00:41:54 +0000 (00:41 +0000)]
[libFuzzer] Sleep after process exits in merge-sigusr.test.

Ensure that log file has been fully updated before trying to read it.

llvm-svn: 361339

5 years ago[InstCombine] fold shuffles of insert_subvectors
Sanjay Patel [Wed, 22 May 2019 00:32:25 +0000 (00:32 +0000)]
[InstCombine] fold shuffles of insert_subvectors

This should be a valid exception to the general rule of not creating new shuffle masks in IR...
because we already do it. :)
Also, DAG combining/legalization will undo this by widening the shuffle back out if needed.

Explanation for how we already do this: SLP or vector source can create chains of insert/extract
as shown in 1 of the examples from PR16739:
https://godbolt.org/z/NlK7rA
https://bugs.llvm.org/show_bug.cgi?id=16739

And we expect instcombine or DAGCombine to clean that up by creating relatively simple shuffles.

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

llvm-svn: 361338

5 years ago[Symbol] Remove dead code
Alex Langford [Wed, 22 May 2019 00:06:44 +0000 (00:06 +0000)]
[Symbol] Remove dead code

llvm-svn: 361337

5 years ago[libFuzzer] Kill by session ID in merge-sigusr.test.
Matt Morehouse [Tue, 21 May 2019 23:54:39 +0000 (23:54 +0000)]
[libFuzzer] Kill by session ID in merge-sigusr.test.

Ensures that parent and all child processes are killed at once.

llvm-svn: 361336

5 years ago[PragmaHandler] Expose `#pragma` location
Joel E. Denny [Tue, 21 May 2019 23:51:38 +0000 (23:51 +0000)]
[PragmaHandler] Expose `#pragma` location

Currently, a pragma AST node's recorded location starts at the
namespace token (such as `omp` in the case of OpenMP) after the
`#pragma` token, and the `#pragma` location isn't available.  However,
the `#pragma` location can be useful when, for example, rewriting a
directive using Clang's Rewrite facility.

This patch makes `#pragma` locations available in any `PragmaHandler`
but it doesn't yet make use of them.

This patch also uses the new `struct PragmaIntroducer` to simplify
`Preprocessor::HandlePragmaDirective`.  It doesn't do the same for
`PPCallbacks::PragmaDirective` because that changes the API documented
in `clang-tools-extra/docs/pp-trace.rst`, and I'm not sure about
backward compatibility guarantees there.

Reviewed By: ABataev, lebedev.ri, aaron.ballman

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

llvm-svn: 361335

5 years agoFix target property to make BUILD_SHARED_LIBS work
Chris Bieneman [Tue, 21 May 2019 23:50:15 +0000 (23:50 +0000)]
Fix target property to make BUILD_SHARED_LIBS work

Public and Private link libraries get merged in the LINK_LIBRARIES property instead of being kept separate.

With any luck this will get `BUILD_SHARED_LIBS` working again on Linux.

llvm-svn: 361334

5 years agoAMDGPU: Assume calls read exec
Matt Arsenault [Tue, 21 May 2019 23:23:16 +0000 (23:23 +0000)]
AMDGPU: Assume calls read exec

llvm-svn: 361333

5 years agoAMDGPU: Add some tests for inlineasm behavior
Matt Arsenault [Tue, 21 May 2019 23:23:12 +0000 (23:23 +0000)]
AMDGPU: Add some tests for inlineasm behavior

llvm-svn: 361332

5 years agoAMDGPU: Assume call pseudos are convergent
Matt Arsenault [Tue, 21 May 2019 23:23:10 +0000 (23:23 +0000)]
AMDGPU: Assume call pseudos are convergent

There should probably be nonconvergent versions, but my guess is it
doesn't matter in practice.

llvm-svn: 361331

5 years agoAMDGPU: Fix not marking new gfx10 SGPRs as CSRs
Matt Arsenault [Tue, 21 May 2019 23:23:05 +0000 (23:23 +0000)]
AMDGPU: Fix not marking new gfx10 SGPRs as CSRs

llvm-svn: 361330

5 years ago[c++20] P1330R0: permit simple-assignments that change the active member
Richard Smith [Tue, 21 May 2019 23:15:20 +0000 (23:15 +0000)]
[c++20] P1330R0: permit simple-assignments that change the active member
of a union within constant expression evaluation.

llvm-svn: 361329

5 years agoRefactor: split Uninitialized state on APValue into an "Absent" state
Richard Smith [Tue, 21 May 2019 23:15:18 +0000 (23:15 +0000)]
Refactor: split Uninitialized state on APValue into an "Absent" state
representing no such object, and an "Indeterminate" state representing
an uninitialized object. The latter is not yet used, but soon will be.

llvm-svn: 361328

5 years ago[WebAssembly] Add the signature for the new llround builtin function
Dan Gohman [Tue, 21 May 2019 23:06:34 +0000 (23:06 +0000)]
[WebAssembly] Add the signature for the new llround builtin function

r360889 added new llround builtin functions. This patch adds their
signatures for the WebAssembly backend.

It also adds wasm32 support to utils/update_llc_test_checks.py, since
that's the script other targets are using for their testcases for this
feature.

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

llvm-svn: 361327

5 years ago[libFuzzer] Ignore exit status of wait in merge-sigusr.test.
Matt Morehouse [Tue, 21 May 2019 22:48:40 +0000 (22:48 +0000)]
[libFuzzer] Ignore exit status of wait in merge-sigusr.test.

If process $PID has already exited, wait will give a non-zero exit
status.

llvm-svn: 361326

5 years agoRename identifiers to spell out analyze; NFC.
Aaron Ballman [Tue, 21 May 2019 22:43:48 +0000 (22:43 +0000)]
Rename identifiers to spell out analyze; NFC.

llvm-svn: 361325

5 years ago[ORC] Guarantee unique JITDylib names in lli, add usage notes to createJITDylib.
Lang Hames [Tue, 21 May 2019 22:07:53 +0000 (22:07 +0000)]
[ORC] Guarantee unique JITDylib names in lli, add usage notes to createJITDylib.

JITDylibs should have unique names. This patch adds code to lli to respect this
invariant (by refering to the exist JITDylib if a -jd <name> option is specified
more than once). It also adds usage notes to the doxygen comment for
createJITDylib method in ExecutionSession and LLJIT.

http://llvm.org/PR41937

llvm-svn: 361322

5 years ago[FileSystem] Fix regression in FileSystem::Resolve
Jonas Devlieghere [Tue, 21 May 2019 21:56:37 +0000 (21:56 +0000)]
[FileSystem] Fix regression in FileSystem::Resolve

When I moved the resolve code from FileSpec to the FileSystem class, I
introduced a regression. If you compare the two implementations, you'll
notice that if the path doesn't exist, we should only reverse the
effects of makeAbsolute, not the effects of tilde expansion.

As a result, the logic to create the ~/.lldb directory broke, because we
would resolve the path before creating it. Because the directory didn't
exist yet, we'd call create_directories on the unresolved path, which
failed.

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

llvm-svn: 361321

5 years ago[NFC][AMDGPU] Autogenerate llvm.amdgcn.s.barrier.ll test
Roman Lebedev [Tue, 21 May 2019 21:49:14 +0000 (21:49 +0000)]
[NFC][AMDGPU] Autogenerate llvm.amdgcn.s.barrier.ll test

llvm-svn: 361320

5 years ago[NFC][X86] Autogenerate ragreedy-hoist-spill.ll test
Roman Lebedev [Tue, 21 May 2019 21:49:10 +0000 (21:49 +0000)]
[NFC][X86] Autogenerate ragreedy-hoist-spill.ll test

llvm-svn: 361319

5 years ago[NFC][Thumb2] Autogenerate thumb2-ldr_pre.ll test
Roman Lebedev [Tue, 21 May 2019 21:49:05 +0000 (21:49 +0000)]
[NFC][Thumb2] Autogenerate thumb2-ldr_pre.ll test

llvm-svn: 361318

5 years ago[InstCombine] add more tests for shuffle folding; NFC
Sanjay Patel [Tue, 21 May 2019 21:45:24 +0000 (21:45 +0000)]
[InstCombine] add more tests for shuffle folding; NFC

As discussed in D62024, we want to limit any potential IR
transforms of shuffles to cases where we know the SDAG
conversion would result in equivalent patterns for these
IR variants.

llvm-svn: 361317

5 years ago[CommandInterpreter] Fix SkipAppInitFiles setter
Jonas Devlieghere [Tue, 21 May 2019 21:33:06 +0000 (21:33 +0000)]
[CommandInterpreter] Fix SkipAppInitFiles setter

The SkipAppInitFiles setter was ignoring its import argument.

llvm-svn: 361316

5 years ago[X86] Add large integer comparison tests for PR41971; NFC
Nikita Popov [Tue, 21 May 2019 21:27:08 +0000 (21:27 +0000)]
[X86] Add large integer comparison tests for PR41971; NFC

In these cases we would prefer a direct comparison over going through
a vector type.

llvm-svn: 361315

5 years ago[Driver] Verify GCCInstallation is valid
Nick Desaulniers [Tue, 21 May 2019 21:21:35 +0000 (21:21 +0000)]
[Driver] Verify GCCInstallation is valid

Summary:
Values returned by GCCInstallation.getParentLibPath() and
GCCInstallation.getTriple() are not valid unless
GCCInstallation.isValid() returns true. This has previously been
ignored, and the former two values were used without checking whether
GCCInstallation is valid. This led to the bad path "/../bin" being added
to the list of program paths.

author: danielmentz "Daniel Mentz <danielmentz@google.com>"

Reviewers: #clang, tstellar, srhines

Reviewed By: srhines

Subscribers: danielmentz, ormris, nickdesaulniers, srhines, cfe-commits

Tags: #clang

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

llvm-svn: 361314

5 years ago[libFuzzer] Reduce flakiness of merge-sigusr.test.
Matt Morehouse [Tue, 21 May 2019 21:15:51 +0000 (21:15 +0000)]
[libFuzzer] Reduce flakiness of merge-sigusr.test.

Double the number of files to merge, and use wait instead of sleep.

llvm-svn: 361313

5 years agoLet -static-pie win if it is specified along with -pie or -static.
Siva Chandra [Tue, 21 May 2019 21:09:05 +0000 (21:09 +0000)]
Let -static-pie win if it is specified along with -pie or -static.

Also, disallow specifying -no-pie/-nopie along with -static-pie.

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

llvm-svn: 361312

5 years ago[NFC][InstCombine] Add unary fneg tests to operand-complexity.ll.
Cameron McInally [Tue, 21 May 2019 21:07:46 +0000 (21:07 +0000)]
[NFC][InstCombine] Add unary fneg tests to operand-complexity.ll.

llvm-svn: 361311

5 years ago[Test] Fix conflicting test names.
Jonas Devlieghere [Tue, 21 May 2019 20:55:00 +0000 (20:55 +0000)]
[Test] Fix conflicting test names.

Two tests having the same name creates a race condition when moving the
trace files.

llvm-svn: 361310

5 years ago[OpenMP] Add implementation to two OMPT API routines
Jonathan Peyton [Tue, 21 May 2019 20:51:05 +0000 (20:51 +0000)]
[OpenMP] Add implementation to two OMPT API routines

This change adds implementation to ompt_finalize_tool() and
ompt_get_task_memory().

Patch by Hansang Bae

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

llvm-svn: 361309

5 years ago[NFC][InstCombine] Add unary FNeg tests to X86/x86-avx512.ll
Cameron McInally [Tue, 21 May 2019 20:31:09 +0000 (20:31 +0000)]
[NFC][InstCombine] Add unary FNeg tests to X86/x86-avx512.ll

llvm-svn: 361308

5 years agobuild: enable CMake policy 0077
Saleem Abdulrasool [Tue, 21 May 2019 20:28:32 +0000 (20:28 +0000)]
build: enable CMake policy 0077

Enable CMake policy 77. This alters the behavior of option. The old behavior
would remove the value of the option from the cache and create a new one. The
new behavior does not create the variable if it is defined already. This ensures
that subsequent reconfigures will behave identically. This seems better than the
setting of OLD - the desire is to ensure that it is set to OLD or NEW.

llvm-svn: 361307

5 years agoMove csr-save-restore-order.ll to the right place
Yi-Hong Lyu [Tue, 21 May 2019 20:28:31 +0000 (20:28 +0000)]
Move csr-save-restore-order.ll to the right place

llvm-svn: 361306

5 years ago[asan] clang-format parent patch
Vitaly Buka [Tue, 21 May 2019 20:24:42 +0000 (20:24 +0000)]
[asan] clang-format parent patch

llvm-svn: 361305

5 years ago[asan] Replace assignments with internal_memcpy ErrorDescription
Vitaly Buka [Tue, 21 May 2019 20:23:10 +0000 (20:23 +0000)]
[asan] Replace assignments with internal_memcpy ErrorDescription

For consistency with nearby code and to avoid interceptors during reports.

llvm-svn: 361304

5 years ago[NFC][X86][AArch64] Add tests for sinking of add/sub by constant through add/sub
Roman Lebedev [Tue, 21 May 2019 20:14:54 +0000 (20:14 +0000)]
[NFC][X86][AArch64] Add tests for sinking of add/sub by constant through add/sub

Looks we can transform all 8 variants of the pattern:
https://rise4fun.com/Alive/auH

This comes up as an issue on the path towards
https://bugs.llvm.org/show_bug.cgi?id=41952

llvm-svn: 361303

5 years agoRemove unicode character from test
Leonard Chan [Tue, 21 May 2019 20:12:00 +0000 (20:12 +0000)]
Remove unicode character from test

llvm-svn: 361302

5 years agoFix test failures after r361278 on non-Darwin platforms and when
Richard Smith [Tue, 21 May 2019 20:10:52 +0000 (20:10 +0000)]
Fix test failures after r361278 on non-Darwin platforms and when
CLANG_DEFAULT_STDLIB is defined to libstdc++.

llvm-svn: 361301

5 years ago[c++20] P0780R2: Support pack-expansion of init-captures.
Richard Smith [Tue, 21 May 2019 20:10:50 +0000 (20:10 +0000)]
[c++20] P0780R2: Support pack-expansion of init-captures.

This permits an init-capture to introduce a new pack:

  template<typename ...T> auto x = [...a = T()] { /* a is a pack */ };

To support this, the mechanism for allowing ParmVarDecls to be packs has
been extended to support arbitrary local VarDecls.

llvm-svn: 361300

5 years ago[PowerPC][NFC] Add a tests for Reordering CSR reloads in epilogue to follow the same...
Yi-Hong Lyu [Tue, 21 May 2019 19:42:57 +0000 (19:42 +0000)]
[PowerPC][NFC] Add a tests for Reordering CSR reloads in epilogue to follow the same order as CSR saves in the prologue

llvm-svn: 361299

5 years ago[OpenMP] Add support for registering requires directives with the runtime
Gheorghe-Teodor Bercea [Tue, 21 May 2019 19:42:01 +0000 (19:42 +0000)]
[OpenMP] Add support for registering requires directives with the runtime

Summary:
This patch adds support for the registration of the requires directives with the runtime.

Each requires directive clause will enable a particular flag to be set.

The set of flags is passed to the runtime to be checked for compatibility with other such flags coming from other object files.

The registration function is called whenever OpenMP is present even if a requires directive is not present. This helps detect cases in which requires directives are used inconsistently.

Reviewers: ABataev, AlexEichenberger, caomhin

Reviewed By: ABataev, AlexEichenberger

Subscribers: jholewinski, guansong, jfb, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 361298

5 years agoFix test to put its outputs into the temp directory.
Richard Smith [Tue, 21 May 2019 19:41:19 +0000 (19:41 +0000)]
Fix test to put its outputs into the temp directory.

llvm-svn: 361297

5 years ago[DebugInfo] Don't emit checksums when compiling a preprocessed CPP
Alexandre Ganea [Tue, 21 May 2019 19:40:28 +0000 (19:40 +0000)]
[DebugInfo] Don't emit checksums when compiling a preprocessed CPP

Fixes PR41215

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

llvm-svn: 361296

5 years agoFix LLDB warnings when compiling with Clang 8.0
Alexandre Ganea [Tue, 21 May 2019 19:35:06 +0000 (19:35 +0000)]
Fix LLDB warnings when compiling with Clang 8.0

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

llvm-svn: 361295

5 years ago[OpenMP][libomptarget] Enable requires flags for target libraries.
Gheorghe-Teodor Bercea [Tue, 21 May 2019 19:35:02 +0000 (19:35 +0000)]
[OpenMP][libomptarget] Enable requires flags for target libraries.

Summary:
Target link variables are currently implemented by creating a copy of the variables on the device side and unified memory never gets exploited.

When the prgram uses the:

```
#pragma omp requires unified_shared_memory
```

directive in conjunction with a declare target link, the linked variable is no longer allocated on the device and the host version is used instead.

This behavior is overridden by performing an explicit mapping.

A Clang side patch is required.

Reviewers: ABataev, AlexEichenberger, grokos, Hahnfeld

Reviewed By: AlexEichenberger, grokos, Hahnfeld

Subscribers: Hahnfeld, jfb, guansong, jdoerfert, openmp-commits

Tags: #openmp

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

llvm-svn: 361294

5 years agoFix register coalescer failure to prune value
Stanislav Mekhanoshin [Tue, 21 May 2019 19:32:41 +0000 (19:32 +0000)]
Fix register coalescer failure to prune value

Register coalescer fails for the test in the patch with the assertion in
JoinVals::ConflictResolution `DefMI != nullptr'. It attempts to join
live intervals for two adjacent instructions and erase the copy:

    %2:vreg_256 = COPY %1
    %3:vreg_256 = COPY killed %1

The LI needs to be adjusted to kill subrange for the erased instruction
and extend the subrange of the original def. That was done for the main
interval only but not for the subrange. As a result subrange had a VNI
pointing to the erased slot resulting in the above failure.

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

llvm-svn: 361293

5 years agoFix for sphinx bot warning
Leonard Chan [Tue, 21 May 2019 19:30:25 +0000 (19:30 +0000)]
Fix for sphinx bot warning

llvm-svn: 361292

5 years ago[cmake] Don't use VERSION_GREATER_EQUAL in cmake versions prior to 3.72.
Don Hinton [Tue, 21 May 2019 19:25:54 +0000 (19:25 +0000)]
[cmake] Don't use VERSION_GREATER_EQUAL in cmake versions prior to 3.72.

llvm-svn: 361291

5 years ago[DeLICM] Use polly::singleton to allow empty result.
Michael Kruse [Tue, 21 May 2019 19:18:26 +0000 (19:18 +0000)]
[DeLICM] Use polly::singleton to allow empty result.

isl_map_from_union_map cannot determine the map's space if the union_map
is empty. polly::singleton was designed for this case. We pass the
expected map space to avoid crashing in isl_map_from_union_map.

This fixes an issue found by the aosp buildbot. Thanks to Eli Friedman
for the reproducer.

llvm-svn: 361290

5 years ago[Intrinsic] Signed Fixed Point Saturation Multiplication Intrinsic
Leonard Chan [Tue, 21 May 2019 19:17:19 +0000 (19:17 +0000)]
[Intrinsic] Signed Fixed Point Saturation Multiplication Intrinsic

Add an intrinsic that takes 2 signed integers with the scale of them provided
as the third argument and performs fixed point multiplication on them. The
result is saturated and clamped between the largest and smallest representable
values of the first 2 operands.

This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.

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

llvm-svn: 361289

5 years ago[X86] Remove an unneeded ZERO_EXTEND creation from LowerINTRINSIC_W_CHAIN. NFC
Craig Topper [Tue, 21 May 2019 19:03:45 +0000 (19:03 +0000)]
[X86] Remove an unneeded ZERO_EXTEND creation from LowerINTRINSIC_W_CHAIN. NFC

We were trying to ZERO_EXTEND from an i8 X86ISD::SETCC to i8 again.

llvm-svn: 361288

5 years ago[SelectionDAG] fold insert subvector of undef into undef
Sanjay Patel [Tue, 21 May 2019 18:53:53 +0000 (18:53 +0000)]
[SelectionDAG] fold insert subvector of undef into undef

DAGCombiner simplifies this more liberally as:
  // If inserting an UNDEF, just return the original vector.
  if (N1.isUndef())
    return N0;

So there's no way to make this visible in output AFAIK, but
doing this at node creation time should be slightly more efficient.

llvm-svn: 361287

5 years ago[cmake] Try to make cmake happy and fix bots.
Don Hinton [Tue, 21 May 2019 18:51:21 +0000 (18:51 +0000)]
[cmake] Try to make cmake happy and fix bots.

llvm-svn: 361286

5 years ago[LibTooling] Address post-commit feedback for r361152
Yitzhak Mandelbaum [Tue, 21 May 2019 18:48:58 +0000 (18:48 +0000)]
[LibTooling] Address post-commit feedback for r361152

Fixes a redundant dependency and moves another to its proper place.

Reviewers: thakis

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 361285

5 years ago[SelectionDAG] remove redundant code; NFCI
Sanjay Patel [Tue, 21 May 2019 18:28:22 +0000 (18:28 +0000)]
[SelectionDAG] remove redundant code; NFCI

getNode() squashes concatenation of undefs via FoldCONCAT_VECTORS():
  // Concat of UNDEFs is UNDEF.
  if (llvm::all_of(Ops, [](SDValue Op) { return Op.isUndef(); }))
    return DAG.getUNDEF(VT);

llvm-svn: 361284

5 years ago[OPENMP]Use the attributes for dso locality when building for device.
Alexey Bataev [Tue, 21 May 2019 18:20:08 +0000 (18:20 +0000)]
[OPENMP]Use the attributes for dso locality when building for device.

Currently, we ignore all dso locality attributes/info when building for
the device and thus all symblos are externally visible and can be
preemted at the runtime. It may lead to incorrect results. We need to
follow the same logic, compiler uses for static/pie builds.

llvm-svn: 361283

5 years ago[cmake] Bug in r361281: make include optional and fix typo which might make a differe...
Don Hinton [Tue, 21 May 2019 18:15:01 +0000 (18:15 +0000)]
[cmake] Bug in r361281: make include optional and fix typo which might make a difference on some systems.

llvm-svn: 361282

5 years ago[MergeICmps] Make sorting strongly stable on the rhs.
Clement Courbet [Tue, 21 May 2019 17:58:42 +0000 (17:58 +0000)]
[MergeICmps] Make sorting strongly stable on the rhs.

Summary:
Because the sort order was not strongly stable on the RHS, whether the
chain could merge would depend on the order of the blocks in the Phi.

EXPENSIVE_CHECKS would shuffle the blocks before sorting, resulting in
non-deterministic merging.

Reviewers: gchatelet

Subscribers: hiraditya, llvm-commits, RKSimon

Tags: #llvm

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

llvm-svn: 361281

5 years ago[cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them.
Don Hinton [Tue, 21 May 2019 17:56:45 +0000 (17:56 +0000)]
[cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them.

Summary:
clang and newer versions of ninja use high-resolutions timestamps, but
older versions of libtool on Darwin don't, so the archive will often
get an older timestamp than the last object that was added or updated.
To fix this, we add a custom command to touch the archive after it's
been built so that ninja won't rebuild it unnecessarily the next time
it's run.

Reviewed By: beanz

Tags: #llvm

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

llvm-svn: 361280

5 years ago[Bugpoint] fix use-after-move. NFC
Nick Desaulniers [Tue, 21 May 2019 17:55:26 +0000 (17:55 +0000)]
[Bugpoint] fix use-after-move. NFC

Summary:
This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
6".

Note that author also states:
"Note that the loop doesn't actually execute at all."

This is not true, but the author can be forgiven; there's two distinct
variables with very similar identifiers:

MiscompiledFunctions
MisCompFunctions

Reviewers: echristo, srhines, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 361279

5 years ago[clang][Darwin] Refactor header search path logic into the driver
Louis Dionne [Tue, 21 May 2019 17:48:04 +0000 (17:48 +0000)]
[clang][Darwin] Refactor header search path logic into the driver

Summary:
This commit moves the logic for determining system, resource and C++
header search paths from CC1 to the driver. This refactor has already
been made for several platforms, but Darwin had been left behind.

This refactor tries to implement the previous search path logic with
perfect accuracy. In particular, the order of all include paths inside
CC1 and all paths that were skipped because nonexistent are conserved
after the refactor. This change was also tested against a code base
of significant size and revealed no problems.

Reviewers: jfb, arphaman

Subscribers: nemanjai, javed.absar, kbarton, christof, jkorous, dexonsmith, jsji, cfe-commits

Tags: #clang

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

llvm-svn: 361278

5 years agoRemove `SymbolFileDWARF *` when there is already `DWARFUnit *`
Jan Kratochvil [Tue, 21 May 2019 17:38:56 +0000 (17:38 +0000)]
Remove `SymbolFileDWARF *` when there is already `DWARFUnit *`

In D61502#1503247 @clayborg suggested that SymbolFileDWARF *dwarf2Data is
really redundant in all the calls with also having DWARFUnit *cu. So remove it.

One `SymbolFileDWARF *` nullptr check
(DWARFDebugInfoEntry::GetDIENamesAndRanges) could be removed, other two nullptr
checks (DWARFDebugInfoEntry::GetName and DWARFDebugInfoEntry::AppendTypeName)
need to stay in place (now for `DWARFUnit *`).

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

llvm-svn: 361277

5 years ago[Dsymutil] Remove redundant argument (NFC)
Jonas Devlieghere [Tue, 21 May 2019 17:31:51 +0000 (17:31 +0000)]
[Dsymutil] Remove redundant argument (NFC)

The dwarf streamer already holds a copy of the link options, so there's
no need to pass them as an argument.

llvm-svn: 361276

5 years ago[CMake] One more stab at fixing BUILD_SHARED_LIBS
Chris Bieneman [Tue, 21 May 2019 17:30:59 +0000 (17:30 +0000)]
[CMake] One more stab at fixing BUILD_SHARED_LIBS

If clang's libraries are build SHARED, we need to grab their `PRIVATE_LINK_LIBRARIES` properties and add those to clang_shared's interface.

llvm-svn: 361275

5 years agoDo not use the incorrect attribute spelling list index when translating a no_sanitize...
Aaron Ballman [Tue, 21 May 2019 17:24:49 +0000 (17:24 +0000)]
Do not use the incorrect attribute spelling list index when translating a no_sanitize_foo attribute into a no_sanitize("foo") attribute.

This fixes a crash when AST pretty printing declarations marked with no_sanitize_memory.

llvm-svn: 361274

5 years agoRevert "[WebAssembly] Add __start_/_stop_ symbols for data sections"
Sam Clegg [Tue, 21 May 2019 17:16:33 +0000 (17:16 +0000)]
Revert "[WebAssembly] Add __start_/_stop_ symbols for data sections"

This reverts commit 7804dbddccba412087a15cab8db4412939700952.

This change broke a bunch of tests of the WebAssembly waterfall.
Will hopefully reland with increased test coverage.

llvm-svn: 361273

5 years ago[docs] Add new document on building distributions
Chris Bieneman [Tue, 21 May 2019 16:29:31 +0000 (16:29 +0000)]
[docs] Add new document on building distributions

Summary:
This document is an attempt to provide a guide for best practices for using the LLVM build system to generate distributable LLVM-based tools.

Most of the document is geared toward distributions of LLVM-based toolchains, but much of it also applies to distributing other LLVM-based tools and libraries.

Reviewers: tstellar, phosek, jroelofs, hans, sylvestre.ledru

Reviewed By: tstellar

Subscribers: smeenai, dschuff, arphaman, winksaville, llvm-commits

Tags: #llvm

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

llvm-svn: 361272