Commit Graph

315627 Commits

Author SHA1 Message Date
Anton Afanasyev 6d08b8dbae Revert "[MIR] Add simple PRE pass to MachineCSE"
This reverts commit 9c20156de3.
It breaks stage 2 of clang-ppc64be-linux-multistage.

llvm-svn: 359875
2019-05-03 12:36:22 +00:00
Kadir Cetinkaya 50c3e8cb40 [clangd] Also perform merging for symbol definitions
Summary:
clangd currently prefers declarations from codegen files. This patch
implements that behavior for definition locations. If we have definiton
locations both coming from AST and index, clangd will perform a merging to show
the codegen file if that's the case.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 359874
2019-05-03 12:11:14 +00:00
Simon Pilgrim 42d2b604b5 [SelectionDAG] Use INT_MIN as (1 << 31) is UB for signed integers. NFCI.
llvm-svn: 359873
2019-05-03 11:32:00 +00:00
Simon Pilgrim bfd00a6440 [SelectionDAG] computeKnownBits - remove some duplicate/shadow variables. NFCI.
llvm-svn: 359872
2019-05-03 11:11:03 +00:00
Simon Pilgrim a359ef192b [X86] LowerMULH - remove unused Lo/Hi vector indices. NFCI.
Leftover from before we had the extract128BitVector helpers.

llvm-svn: 359871
2019-05-03 10:32:07 +00:00
Anton Afanasyev 9c20156de3 [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

Reviewers: RKSimon

Subscribers: hfinkel, llvm-commits

Tags: #llvm

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

llvm-svn: 359870
2019-05-03 10:30:59 +00:00
Simon Pilgrim 88f9117168 Reduce variable scope to just the if() block its actually used in. NFCI.
llvm-svn: 359869
2019-05-03 10:13:41 +00:00
Raphael Isemann 1756630dfa C.128 override, virtual keyword handling
Summary:
According to [C128] "Virtual functions should specify exactly one
of `virtual`, `override`, or `final`", I've added override where a
virtual function is overriden but the explicit `override` keyword
was missing. Whenever both `virtual` and `override` were specified,
I removed `virtual`. As C.128 puts it:

> [...] writing more than one of these three is both redundant and
> a potential source of errors.

I anticipate a discussion about whether or not to add `override` to
destructors but I went for it because of an example in [ISOCPP1000].
Let me repeat the comment for you here:

Consider this code:

```
    struct Base {
      virtual ~Base(){}
    };

    struct SubClass : Base {
      ~SubClass() {
        std::cout << "It works!\n";
      }
    };

    int main() {
      std::unique_ptr<Base> ptr = std::make_unique<SubClass>();
    }
```

If for some odd reason somebody removes the `virtual` keyword from the
`Base` struct, the code will no longer print `It works!`. So adding
`override` to destructors actively protects us from accidentally
breaking our code at runtime.

[C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final
[ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-476951555

Reviewers: teemperor, JDevlieghere, davide, shafik

Reviewed By: teemperor

Subscribers: kwk, arphaman, kadircet, lldb-commits

Tags: #lldb

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

llvm-svn: 359868
2019-05-03 10:03:28 +00:00
Pavel Labath d214898f1f Split TestVLA into two and XFAIL one part
The part which checks whether vla_expr shows up in the variable list
does not pass on non-darwin platforms. Add the appropriate decorator.

llvm-svn: 359867
2019-05-03 08:06:28 +00:00
Ilya Biryukov d020f270d6 [clangd] Minor code style cleanups in Protocol.h. NFC
- Remove a parameter name that was misspelled (OS used for non-stream
  parameter)
- Declare operator == (TextEdit, TextEdit) outside the struct, for
  consistency with other user-declared ops in our code.
- Fix naming style of a parameter.

llvm-svn: 359866
2019-05-03 08:03:21 +00:00
Martin Storsjo b1f3910283 Avoid duplicate function aliases on MinGW after SVN r359835
On MinGW, the same alias mechanism as for ELF, using
__attribute__((__alias__())), is used.

llvm-svn: 359865
2019-05-03 07:43:23 +00:00
Akira Hatanaka 8cd01e69d8 [Sema][ObjC] Disable -Wunused-parameter for ObjC methods
The warning isn't very useful when the function is an ObjC method.

rdar://problem/41561853

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

llvm-svn: 359864
2019-05-03 07:19:46 +00:00
Craig Topper d724360695 [X86] Add more one checks to masked compare patterns that were missed in r358358.
This covers the patterns we use for widening 128/256 comparisons to 512-bit when
AVX512VL isn't supported.

llvm-svn: 359863
2019-05-03 07:14:05 +00:00
Pavel Labath 759ab93e04 Revert "Initialization: move InstructionEmulation to full initialization"
This change is bogus. lldb-server definitely uses instruction emulation
on some architectures.

llvm-svn: 359862
2019-05-03 07:11:43 +00:00
Igor Kudrin d2c82e8ad0 [docs] Add support for Markdown documentation when creating man pages
rL358749 added a documentation page in the Markdown format. Currently,
such pages are ignored in the configuration script for manual pages.
This patch fixes that.

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

llvm-svn: 359860
2019-05-03 05:11:48 +00:00
Leonard Chan ef2dc25a96 Revert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"
This reverts commit fc40cbd9d8.

llvm-svn: 359859
2019-05-03 03:28:06 +00:00
Nico Weber ecc969caf9 Revert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage declaration"
See cfe-commits thread for r359814.

llvm-svn: 359858
2019-05-03 03:16:07 +00:00
Quentin Colombet c9256cc6ba [IRTranslator] Use the alloc size instead of the store size when translating allocas
We use to incorrectly use the store size instead of the alloc size when
creating the stack slot for allocas.
On aarch64 this can be demonstrated by allocating weirdly sized types.

For instance, in the added test case, we use an alloca for i19. We used
to allocate a slot of size 24-bit (19 rounded up to the next byte),
whereas we really want to use a full 32-bit slot for this type.

llvm-svn: 359856
2019-05-03 01:23:56 +00:00
Eli Friedman 7238353848 [AArch64][MC] Reject "add x0, x1, w2, lsl #1" etc.
Looks like just a minor oversight in the parsing code.

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

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

llvm-svn: 359855
2019-05-03 00:59:52 +00:00
David Blaikie 5e32805050 SemaOverload: Complete candidates before emitting the error, to ensure diagnostics emitted (or suppressed) during completion don't interfere with the overload notes
Because diagnostics and their notes are not connected at the API level,
if the error message for an overload is emitted, then the overload
candidates are completed - if a diagnostic is emitted during that work,
the notes related to overload candidates would be attached to the latter
diagnostic, not the original error. Sort of worse, if the latter
diagnostic was disabled, the notes are disabled.

Reviewers: rsmith

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

llvm-svn: 359854
2019-05-03 00:44:50 +00:00
Fangrui Song d45df09435 [ELF] Place SHT_NOTE sections with the same alignment into one PT_NOTE
Summary:
While the generic ABI requires notes to be 8-byte aligned in ELF64, many
vendor-specific notes (from Linux, NetBSD, Solaris, etc) use 4-byte
alignment.

In a PT_NOTE segment, if 4-byte aligned notes are followed by an 8-byte
aligned note, the possible 4-byte padding may make consumers fail to
parse the 8-byte aligned note. See PR41000 for a recent report about
.note.gnu.property (NT_GNU_PROPERTY_TYPE_0).
(Note, for NT_GNU_PROPERTY_TYPE_0, the consumers should probably migrate
to PT_GNU_PROPERTY, but the alignment issue affects other notes as well.)

To fix the issue, don't mix notes with different alignments in one
PT_NOTE. If compilers emit 4-byte aligned notes before 8-byte aligned
notes, we'll create at most 2 segments.

sh_size%sh_addralign=0 is actually implied by the rule for linking
unrecognized sections (in generic ABI), so we don't have to check that.
Notes that match in name, type and attribute flags are concatenated into
a single output section. The compilers have to ensure
sh_size%sh_addralign=0 to make concatenated notes parsable.

An alternative approach is to create a PT_NOTE for each SHT_NOTE, but
we'll have to incur the sizeof(Elf64_Phdr)=56 overhead every time a new
note section is introduced.

Reviewers: ruiu, jakehehrlich, phosek, jhenderson, pcc, espindola

Subscribers: emaste, arichardson, krytarowski, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 359853
2019-05-03 00:35:49 +00:00
Eric Christopher 86e2f169bb Tidy up a comment, fix a typo, remove a comment that's obsolete.
llvm-svn: 359852
2019-05-03 00:15:23 +00:00
Fangrui Song 3947968e7f [crtbegin] Fix an off-by-1 bug in __do_fini
Differential Revision: https://reviews.llvm.org/D61367

llvm-svn: 359850
2019-05-03 00:11:53 +00:00
Eli Friedman 0b61d220c9 [AArch64][Windows] Compute function length correctly in unwind tables.
The primary fix here is to WinException.cpp: we need to exclude jump
tables when computing the length of a function, or else we fail to
correctly compute the length. (We can only compute the number of bytes
consumed by certain assembler directives after the entire file is
parsed. ".p2align" is one of those directives, and is used by jump table
generation.)

The secondary fix, to MCWin64EH, is to make sure we don't silently
miscompile if we hit a similar situation in the future.

It's possible we could extend ARM64EmitUnwindInfo so it allows function
bodies that contain assembler directives, but that's a lot more
complicated; see the FIXME in MCWin64EH.cpp.

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

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

llvm-svn: 359849
2019-05-03 00:10:45 +00:00
Jonas Devlieghere 973d66eefc [Reproducers] Improve reproducer help
Extend the documentation for the reproducer command.

llvm-svn: 359848
2019-05-03 00:10:31 +00:00
Jason Molenda c9f44cd4b6 RegisterContextLLDB::GetFullUnwindPlanForFrame has four verbose
logging messages that are written the same, making it difficult to
know for certain which code path was taken based on a logfile.  Add
some words to make each unique.

Right now the ordering for finding a FullUnwindPlan (ignoring
fallback unwind plan logic) is

1. If this is a _sigtramp like function, try eh_frame which is
   hand written on darwin systems to account for finding the
   saved register context correctly.

2. Ask the DynamicLoader if eh_frame should be preferred for
   this frame.  Some binaries on the system may have hand-written
   eh_frame and the DynamicLoader is the source for this.  (primarily
   this is for hand-written assembly in the objc runtime, and we tell
   lldb to trust that for functions in libobjc.dylib.)

3. if 0th frame, use GetUnwindPlanAtNonCallSite plan.

4. GetUnwindPlanAtCallSite {for 0th or any other}

5. GetUnwindPlanAtNonCallSite {now for non-0th frames, only if not from a compiler? hm.}

6. GetUnwindPlanArchitectureDefaultAtFunctionEntry if we're on the first instruction

7. Architectural default unwind plan ABI::CreateDefaultUnwindPlan


I'm moving #6 -- DefaultAtFunctionEntry -- up to between #3 and #4,
where we're already doing things specific to the zeroth frame.  If
we're on the zeroth frame and the GetUnwindPlanAtNonCallSite plan
has failed for some reason, and we're on the first instruction, we
should definitely use DefaultAtFunctionEntry instead of any other
unwind plan.  If we're trying to step out of some rando function
on the system that we couldn't assembly instruction inspect, this
is sufficient for us to step out of it.

llvm-svn: 359847
2019-05-02 23:49:56 +00:00
Adrian Prantl a0ac5afb0a Fix tests on non-Darwin platforms.
llvm-svn: 359846
2019-05-02 23:49:55 +00:00
Alina Sbirlea 0363c3b8bb [MemorySSA] Check that block is reachable when adding phis.
Summary:
Originally the insertDef method was only used when building MemorySSA, and was limiting the number of Phi nodes that it created.
Now it's used for updates as well, and it can create additional Phis needed for correctness.
Make sure no Phis are created in unreachable blocks (condition met during MSSA build), otherwise the renamePass will find a null DTNode.

Resolves PR41640.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

llvm-svn: 359845
2019-05-02 23:41:58 +00:00
Richard Smith f7d3048e5b Fix -Wunsequenced false-positives in code controlled by a branch on
__builtin_constant_p.

If the operand of __builtin_constant_p is not constant and has
side-effects, then code controlled by a branch on it is unreachable and
we should not emit runtime behavior warnings in such code.

llvm-svn: 359844
2019-05-02 23:21:28 +00:00
Jason Molenda 3af3900ee7 Upstreaming an apple local patch by Frederic Riss.
lldb has an expression that runs in the inferior process to collect
the isa values and hash of the class names for classes in the
system's shared cache.  In recent OSes, swift classes are in this
table and the function the jitted expression calls returns demangled
names.  We need to compute the hashes based on the mangled names.
So for these names, return a hash value of 0 which indicates that
lldb should read the class name directly out of the runtime tables
and compute the hash itself.

When this patch is absent, the lldb+swift testsuite has many failures
on a recent macOS system; there isn't a direct non-swift way to
test for this being correct.

<rdar://problem/47935062>

llvm-svn: 359843
2019-05-02 23:14:26 +00:00
Alina Sbirlea 151ab4844a [MemorySSA] Refactor removing multiple trivial phis [NFC].
Summary: Create a method to clean up multiple potentially trivial phis, since we will need this often.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

llvm-svn: 359842
2019-05-02 23:12:49 +00:00
Adrian Prantl 1db0f0ca98 Hide runtime support values such as clang's __vla_expr from frame variable
by respecting the "artificial" attribute on variables. Function
arguments that are artificial and useful to end-users are being
whitelisted by the language runtime.

<rdar://problem/45322477>

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

llvm-svn: 359841
2019-05-02 23:07:23 +00:00
Craig Topper bf29238e1a [X86] Remove LEA16r references from X86FixupLEAs. NFCI
As far as I know, we never emit LEA16r

llvm-svn: 359840
2019-05-02 22:46:23 +00:00
Artem Belevich 4cbb235026 [CUDA] Do not pass deprecated option fo fatbinary
CUDA 10.1 tools deprecated some command line options.
fatbinary no longer needs --cuda.

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

llvm-svn: 359838
2019-05-02 22:37:19 +00:00
Craig Topper e1e38d4248 [X86] Correct the register class for specific mask register constraints in getRegForInlineAsmConstraint when the VT is a scalar type
The default impementation in the base class for TargetLowering::getRegForInlineAsmConstraint doesn't work for mask registers when the VT is a scalar type integer types since the only legal mask types are vXi1. So we end up just getting whatever the first register class that contains the register. Currently this appears to be VK1, but its really dependent on the order tablegen outputs the register classes.

Some code in the caller ends up looking up the type for this register class and find v1i1 then generates a copyfromreg from the physical k-register with the v1i1 type. Then it generates an any_extend from v1i1 to the scalar VT which isn't legal. This bad any_extend sticks around until isel where it selects a MOVZX32rr8 with a v1i1 input or maybe a i8 input. Not sure but eventually we pick up a copy from VK1 to GR8 in MachineIR which isn't supported. This leads to a failure in physical register copying.

This patch uses the scalar type to find a VK class of the right size. In the attached test case this will be VK16. This causes a bitcast from vk16 to i16 to be generated instead of an any_extend. This will be properly iseled to a VK16 to GR32 copy and a GR32->GR16 extract_subreg.

Fixes PR41678

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

llvm-svn: 359837
2019-05-02 22:26:40 +00:00
Craig Topper e8a1cde886 [SelectionDAG] Add asserts to verify the vectorness of input and output types of TRUNCATE/ZERO_EXTEND/ANY_EXTEND/SIGN_EXTEND agree
As a result of the underlying cause of PR41678 we created an ANY_EXTEND node with a scalar result type and v1i1 input type. Ideally we would have asserted for this instead of letting it go through to instruction selection and generate bad machine IR

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

llvm-svn: 359836
2019-05-02 22:26:26 +00:00
Reid Kleckner 3961507ba1 Fix check-builtins on Windows after alias changes
llvm-svn: 359835
2019-05-02 22:11:55 +00:00
Evandro Menezes 111df108e6 [AArch64] Update for Exynos
Fix the forwarding of multiplication results for Exynos M4.

llvm-svn: 359834
2019-05-02 22:01:39 +00:00
Craig Topper 47d8865a38 [X86] Remove string literal from an if. NFC
This if used to be an assert that got refactored into an if, but left the string literal behind.

Fixes PR41718

llvm-svn: 359833
2019-05-02 21:57:18 +00:00
Saleem Abdulrasool ec2801a176 Initialization: move InstructionEmulation to full initialization
The debug server does not need to use the instruction emulation.  This helps
reduce the size of the final lldb-server binary by another ~100K (~1% savings).

llvm-svn: 359832
2019-05-02 21:49:29 +00:00
Jordan Rupprecht 8ab9d5a8ed Revert [ThinLTO] Fix X86/strong_non_prevailing.ll after llvm-nm 'r' change
This reverts r359314 (git commit 5015aa854d)

llvm-svn: 359831
2019-05-02 21:48:04 +00:00
Jordan Rupprecht 51a1418768 Revert [llvm-nm] Fix handling of symbol types + [llvm-nm] Generalize symbol types
This reverts r359311 and r359312 (git commit 0bf06a8f59 and 5f184f1780)

llvm-svn: 359830
2019-05-02 21:42:46 +00:00
Nico Weber 81862f82ee lld-link: Add /force:multipleres extension to make dupe resource diag non-fatal
As a side benefit, lld-link now reports more than one duplicate resource
entry before exiting with an error even if the new flag is not passed.

llvm-svn: 359829
2019-05-02 21:21:55 +00:00
Petr Hosek 6e9cfee63a [gn] Include the missing BUILD.gn file for libcxxabi includes
This was omitted in r359805.

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

llvm-svn: 359828
2019-05-02 21:20:08 +00:00
Casey Carter b574e11217 [libc++][test] Remove non-portable assumption that thread's constructor allocates with ::new
Drive-by:
* Fix potential race between check and update of `throw_one` in `operator new`
* Fix latent bug in `operator delete`, which shouldn't decrement `outstanding_new` when passed a null pointer
* Specifically catch the expected `bad_alloc` in `main` instead of `...`

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

llvm-svn: 359827
2019-05-02 21:19:41 +00:00
Leonard Chan fc40cbd9d8 [Attribute/Diagnostics] Print macro if definition is an attribute declaration
If an address_space attribute is defined in a macro, print the macro instead
when diagnosing a warning or error for incompatible pointers with different
address_spaces.

We allow this for all attributes (not just address_space), and for multiple
attributes declared in the same macro.

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

llvm-svn: 359826
2019-05-02 20:38:14 +00:00
Petr Hosek 206bc17ea0 [gn] Update the clangd test lit site configuration
This reflects changes made in r359763.

llvm-svn: 359825
2019-05-02 20:34:54 +00:00
Jan Korous f90458b389 [clangd][xpc] Cannonicalize value of CLANGD_BUILD_XPC before caching
llvm-svn: 359824
2019-05-02 20:32:56 +00:00
Amy Huang 301a5bbd59 Change the metadata for heapallocsite calls when the type is cast.
llvm-svn: 359823
2019-05-02 20:07:35 +00:00
Alexey Bataev 8ccb8f8647 [OPENMP][NVPTX]Improve code by using parallel level counter.
Summary:
Previously for the different purposes we need to get the active/common
parallel level and with full runtime we iterated over all the records to
calculate this level. Instead, we can used the warp-based parallel level
counters used in no-runtime mode.

Reviewers: grokos, gtbercea, kkwli0

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

Tags: #openmp

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

llvm-svn: 359822
2019-05-02 20:05:01 +00:00