Commit Graph

324698 Commits

Author SHA1 Message Date
Erich Keane f04d246d7d Fix test where diagnostics changed in P1668 implementation
llvm-svn: 369284
2019-08-19 18:08:52 +00:00
Craig Topper 93c2787193 [CGP] Remove ModifiedDT from the makeBitReverse loop
I don't think anything in this loop modifies the control flow and we don't restart any iteration after setting the flag.

This code was added in http://reviews.llvm.org/D16893 but looking at the test case added there the code that caused the dominator tree to change was merging blocks with their predecessor not the bitreverse optimization.

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

llvm-svn: 369283
2019-08-19 18:02:24 +00:00
Erich Keane ab00f237ac Update cxx_status.html with P1668 status.
llvm-svn: 369282
2019-08-19 17:57:27 +00:00
Erich Keane 62b072d413 Implement P1668R1
Allow inline assembly statements in unexecuted branches of constexpr
functions.

llvm-svn: 369281
2019-08-19 17:39:59 +00:00
Louis Dionne 296757c07c [libc++] Add XFAIL for is_base_of test on AppleClang 11
llvm-svn: 369280
2019-08-19 17:29:42 +00:00
Andrea Di Biagio ecbaba672e [X86] Added extensive scheduling model tests for all the CMPXCHG variants. NFC
Addresses a review comment in D66424

llvm-svn: 369279
2019-08-19 17:07:26 +00:00
Stefan Stipanovic 8682281063 [Attributor] -attributor-verify has false positives. Temporarily remove
it, until resolved.

llvm-svn: 369277
2019-08-19 16:39:32 +00:00
Sam Clegg e8e914e640 [lld][WebAssembly] Honor --no-export-dynamic even with -shared
Differential Revision: https://reviews.llvm.org/D66359

llvm-svn: 369276
2019-08-19 16:34:51 +00:00
Johan Vikstrom f497da3041 [clangd] Added highlighting for tokens that are macro arguments.
Summary:
Adds semantic highlighting for tokens that are a macro argument.
Example:
```
D_V(SomeVar);
```
The "SomeVar" inside the macro is highlighted as a variable now.

Tokens that are in a macro body expansion are ignored in this patch for three reasons.
* The spelling loc is inside the macro "definition" meaning it would highlight inside the macro definition (could probably easily be fixed by using getExpansionLoc instead of getSpellingLoc?)
* If wanting to highlight the macro definition this could create duplicate tokens. And if the tokens are of different types there would be conflicts (tokens in the same range but with different types). Say a macro defines some name and both a variable declaration and a function use this, there would be two tokens in the macro definition but one with Kind "Variable" and the other with Kind "Function".
* Thirdly, macro body expansions could come from a file that is not the main file (easily fixed, just check that the Loc is in the main file and not even a problem if we wanted to highlight the actual macro "invocation")

Reviewers: hokein, sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369275
2019-08-19 16:27:49 +00:00
Jonas Devlieghere 8880ac648c [dotest] Add --dwarf-version to override the tested DWARF version.
On the matrix bot on GreenDragon [1] we want to run the test suite
against different DWARF versions. The idea here is not to replace
targeted tests for certain DWARF features, but rather to provide an easy
way to support this configuration.

[1] http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/

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

llvm-svn: 369272
2019-08-19 16:04:21 +00:00
Fangrui Song ec4540d8a6 [ELF] Simplify processRelocAux and allow a corner-case error
After D66007/r369262, if the control flow reaches `if (sym.isUndefined())`, we know:

* The relocation is not a link-time constant => symbol is preemptable => Undefined or SharedSymbol
* Not an undef weak.
* -no-pie.
* The symbol type is neither STT_OBJECT nor STT_FUNC.

ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o can satisfy
these conditions. Delete the isUndefined() test so that we error
`symbol '...' has no type`, because we don't know the type to make the
decision to create copy relocation/canonical PLT.

llvm-svn: 369271
2019-08-19 15:52:29 +00:00
Zoe Carver 471bbb6e72 [libc++] reverts commit a5f5aad568.
The commit being reverted caused segfaults when building
with libc++ and GCC (and possibly other configurations).

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

llvm-svn: 369270
2019-08-19 15:47:16 +00:00
Pavel Labath 08c77b97c0 Filesystem/Windows: fix inconsistency in readNativeFileSlice API
Summary:
The windows version implementation of readNativeFileSlice, was trying to
match the POSIX behavior of not treating EOF as an error, but it was
only handling the case of reading from a pipe. Attempting to read past
the end of a regular file returns a slightly different error code, which
needs to be handled too. This patch adds ERROR_HANDLE_EOF to the list of
error codes to be treated as an end of file, and adds some unit tests
for the API.

This issue was found while attempting to land D66224, which caused a bunch of
lldb tests to start failing on windows.

Reviewers: rnk, aganea

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 369269
2019-08-19 15:40:49 +00:00
Roman Lebedev edfaee0811 [TargetLowering] x s% C == 0 fold: vector divisor with INT_MIN handling
Summary:
The general fold is only valid for positive divisors.
Which effectively means, it is invalid for `INT_MIN` divisors,
and we currently bailout if we see them.

But that is too strict, we can just fix-up the results.
For that, let's do a second computation 'in parallel':
```
Name: srem -> and
Pre: isPowerOf2(C)
%o = srem i8 %X, C
%r = icmp eq %o, 0
  =>
%n = and i8 %X, C-1
%r = icmp eq %n, 0
```
https://rise4fun.com/Alive/Sup

And then just blend results: if the divisor was `INT_MIN`,
pick the value we got via bit-test,
else pick the value from general fold.

There's interesting observation - `ISD::ROTR` is set to
`LegalizeAction::Expand` before AVX512, so we should not
treat `INT_MIN` divisor as even; and as it can be seen
while `@test_srem_odd_even_one` improves on all run-lines,
`@test_srem_odd_even_INT_MIN` only improves for AVX512.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 369268
2019-08-19 15:01:42 +00:00
Raphael Isemann 6632ad5851 [lldb][NFC] Stop using GetNumberOfMatches in CompletionRequest test
This function is just a wrapper for GetNumberOfResults and will
be removed soon. This patch just changes all calls to GetNumberOfResults
where possible (which is currently just the unit test).

llvm-svn: 369267
2019-08-19 14:52:48 +00:00
Serge Guelton a023d6b7de [nfc] Silent gcc warning
llvm-svn: 369266
2019-08-19 14:40:33 +00:00
George Rimar 42336682b2 [llvm-objdump] - Restore lost comment.
It was removed by mistake in r369263 (D66417).

llvm-svn: 369265
2019-08-19 14:35:08 +00:00
Amaury Sechet 8130154115 Automatically generate AVX512 test cases. NFC
llvm-svn: 369264
2019-08-19 14:34:08 +00:00
George Rimar 9d5e8a476f [Object/COFF.h] - Stop returning std::error_code in a few methods. NFCI.
There are 4 methods that return std::error_code now,
though they do not have to because they are always succeed.
I refactored them.

This allows to simplify the code in tools a bit.

llvm-svn: 369263
2019-08-19 14:32:23 +00:00
Fangrui Song ac0e6c6502 [ELF] Move (copy relocation/canonical PLT) before error checking
In processRelocAux(), we handle errors before copy relocation/canonical PLT.
This makes error checking a bit complex because we have to check for
conditions that will be allowed by copy relocation/canonical PLT.

Instead, move copy relocation/canonical PLT before error checking. This
simplifies the previous clumsy error checking code

`config->shared || (config->pie && expr == R_ABS && type != target->symbolicRel)`

to the simple `config->isPic`. Some diagnostics can be reported in
different ways. The code motion changes diagnostics for some contrived
test cases:

* copy-rel-pie-error.s -> copy-rel-pie2.s:
  It was rejected before but accepted now. ld.bfd also accepts the case.
* copy-errors.s: "cannot preempt symbol" changes to "symbol 'bar' has no type"
* got32{,x}-i386.s: the suggestion changes from "-fPIC or -Wl,-z,notext" to "-fPIE"
* x86-64-dyn-rel-error5.s: one diagnostic changes for -pie case

Reviewed By: peter.smith

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

llvm-svn: 369262
2019-08-19 14:30:12 +00:00
Jinsong Ji 0776da5236 [PeepholeOptimizer] Don't assume bitcast def always has input
Summary:
If we have a MI marked with bitcast bits, but without input operands,
PeepholeOptimizer might crash with assert.

eg:
If we apply the changes in PPCInstrVSX.td as in this patch:

[(set v4i32:$XT, (bitconvert (v16i8 immAllOnesV)))]>;

We will get assert in PeepholeOptimizer.

```
llvm-lit llvm-project/llvm/test/CodeGen/PowerPC/build-vector-tests.ll -v

llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:417: const
llvm::MachineOperand &llvm::MachineInstr::getOperand(unsigned int)
const: Assertion `i < getNumOperands() && "getOperand() out of range!"'
failed.
```

The fix is to abort if we found out of bound access.

Reviewers: qcolombet, MatzeB, hfinkel, arsenm

Reviewed By: qcolombet

Subscribers: wdng, arsenm, steven.zhang, wuzish, nemanjai, hiraditya, kbarton, MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 369261
2019-08-19 14:19:04 +00:00
Fangrui Song c8a1dfc484 [ELF][Hexagon] Improve error message for unknown relocations
Like rLLD354040

Previously, for unknown relocation types, in -no-pie/-pie mode, we got something like:

    foo.o: unrecognized relocation ...

In -shared mode:

    error: can't create dynamic relocation ... against symbol: yyy in readonly segment

Delete the default case from Hexagon::getRelExpr and add the error there. We will get consistent error message like `error: unknown relocation (1024) against symbol foo`

Reviewed By: sidneym

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

llvm-svn: 369260
2019-08-19 14:07:14 +00:00
Aaron Ballman b6ab533b93 Don't keep stale pointers to LoopInfos.
CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.

Patch by Bevin Hansson.

llvm-svn: 369259
2019-08-19 13:37:41 +00:00
Sid Manning a0a4c6b722 [lld][Hexagon] Add GOTREL relocations.
Add GOTREL relocation support. (S + A - GOT)

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

llvm-svn: 369258
2019-08-19 13:32:32 +00:00
Alex Bradbury 1c1f8f215d [RISCV] Don't force absolute FK_Data_X fixups to relocs
The current behavior of shouldForceRelocation forces relocations for the
majority of fixups when relaxation is enabled. This makes sense for
fixups which incorporate symbols but is unnecessary for simple data
fixups where the fixup target is already resolved to an absolute value.

Differential Revision: https://reviews.llvm.org/D63404
Patch by Edward Jones.

llvm-svn: 369257
2019-08-19 13:23:02 +00:00
David Stenberg 88df53e6ea [DebugInfo] Allow bundled calls in the MIR's call site info
Summary:
Extend the MIR parser and writer so that the call site information can
refer to calls that are bundled.

Reviewers: aprantl, asowda, NikolaPrica, djtodoro, ivanbaev, vsk

Reviewed By: aprantl

Subscribers: arsenm, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

llvm-svn: 369256
2019-08-19 12:41:22 +00:00
Sanjay Patel 0f9b5f86f1 [SLP] add test that requires shuffle of scalars; NFC
llvm-svn: 369255
2019-08-19 12:41:09 +00:00
Fangrui Song 6520ba3e94 [llvm-readobj] unwrapOrError: remove unnecessary llvm_unreachable after r369194
llvm-svn: 369254
2019-08-19 12:18:18 +00:00
Sven van Haastregt b21a3654f0 [OpenCL] Add generic type handling for builtin functions
Generic types are an abstraction of type sets.  It mimics the way
functions are defined in the OpenCL specification.  For example,
floatN can abstract all the vector sizes of the float type.

This allows to
 * stick more closely to the specification, which uses generic types;
 * factorize definitions of functions with numerous prototypes in the
   tablegen file; and
 * reduce the memory impact of functions with many overloads.

Patch by Pierre Gondois and Sven van Haastregt.

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

llvm-svn: 369253
2019-08-19 11:56:03 +00:00
Raphael Isemann 0684132107 [lldb][NFC] Use CompletionRequest in Variable::AutoComplete
llvm-svn: 369252
2019-08-19 11:49:43 +00:00
Anastasia Stulova eb801abd58 [OpenCL] Fix addr space deduction for pointers/references to arrays.
Rewrite the logic for detecting if we are deducing addr space of
a pointee type to take into account special logic for arrays. For
pointers/references to arrays we can have any number of parentheses
expressions as well as nested pointers.

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

llvm-svn: 369251
2019-08-19 11:43:16 +00:00
Sanjay Patel b38bac3699 [SLP] reduce duplicated code; NFC
llvm-svn: 369250
2019-08-19 11:39:56 +00:00
Raphael Isemann fb443746a8 [lldb][NFC] Add a few more completion tests to increase test coverage
These tests are mostly trying to reach the different completion functions
in CommandCompletions.cpp (::ArchitectureNames, ::DiskFiles, ::Modules).

llvm-svn: 369249
2019-08-19 10:46:38 +00:00
Fangrui Song d9a071c54b [MC] Simplify ELFObjectWriter::recordRelocation. NFC
llvm-svn: 369248
2019-08-19 10:05:59 +00:00
Jeremy Morse 176bbd5cde [DebugInfo] Make postra sinking of DBG_VALUEs subregister-safe
Currently the machine instruction sinker identifies DBG_VALUE insts that
also need to sink by comparing register numbers. Unfortunately this isn't
safe, because (after register allocation) a DBG_VALUE may read a register
that aliases what's being sunk. To fix this, identify the DBG_VALUEs that
need to sink by recording & examining their register units. Register units
gives us the following guarantee:

  "Two registers overlap if and only if they have a common register unit"
  [MCRegisterInfo.h]

Thus we can always identify aliasing DBG_VALUEs if the set of register
units read by the DBG_VALUE, and the register units of the instruction
being sunk, intersect. (MachineSink already uses classes like
"LiveRegUnits" for determining sinking validity anyway).

The test added checks for super and subregister DBG_VALUE reads of a sunk
copy being sunk as well.

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

llvm-svn: 369247
2019-08-19 09:53:07 +00:00
Peter Smith 2cafd872fb [ELF][ARM] Add a test that maxes out the thunk convergence limit
Add a test that takes the maximum amount of passes permitted to converge.
This will make sure that any symbol defined in a linker script gets the
correct value and that any other convergence limit involving symbol address
doesn't restrict Thunk convergence.

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

llvm-svn: 369246
2019-08-19 09:46:52 +00:00
Sam Tebbs f312c1ecf4 [ARM] Add support for MVE vaddv
This patch adds vecreduce_add and the relevant instruction selection for
vaddv.

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

llvm-svn: 369245
2019-08-19 09:38:28 +00:00
David Green 2bfc13fde1 [ARM] MVE sext costs
This adds some sext costs for MVE, taken from the length of assembly sequences
that we currently generate.

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

llvm-svn: 369244
2019-08-19 09:13:22 +00:00
Jeremy Morse b58ba8aae7 [DebugInfo] Test for variable range un-coalescing
LiveDebugVariables can coalesce ranges of variable locations across
multiple basic blocks. However when it recreates DBG_VALUE instructions,
it has to recreate one DBG_VALUE per block, otherwise it doesn't
represent the pre-regalloc layout and variable assignments can go missing.

This feature works -- however while mucking around with LiveDebugVariables,
I commented the relevant code it out and no tests failed. Thus, here's a
test that checks LiveDebugVariables preserves DBG_VALUEs across block
boundaries.

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

llvm-svn: 369243
2019-08-19 09:02:18 +00:00
Raphael Isemann b8639f5c0f [lldb][NFC] Remove StringList::AutoComplete
We don't need this very specific function in StringList that
we only call once in LLDB.

llvm-svn: 369242
2019-08-19 08:15:46 +00:00
David L. Jones cedd0d9a6e Revert [Attributor] Fix: Make sure we set the changed flag
This reverts r369159 (git commit cbaf1fdea2)

r369160 caused a test to fail under UBSAN. See thread on llvm-commits.

llvm-svn: 369241
2019-08-19 08:00:08 +00:00
Raphael Isemann 81094aad61 [lldb][NFC] Use GetMaxStringLength in CommandObjectApropos::DoExecute
llvm-svn: 369240
2019-08-19 07:59:44 +00:00
Fangrui Song b127771f7d [MC] Delete unnecessary diagnostic: "No relocation available to represent this relative expression"
Replace

- error: No relocation available to represent this relative expression

with

+ error: symbol 'undef' can not be undefined in a subtraction expression

or

+ error: Cannot represent a difference across sections

Keep !IsPcRel as an assertion after the two diagnostic checks are done.

llvm-svn: 369239
2019-08-19 07:59:35 +00:00
Johan Vikstrom 17587b36d1 [clangd] Added special HighlightingKind for function parameters.
Summary: This means that function parameters are no longer highlighted as variable.other.cpp but instead as variable.parameter.cpp which is the more "correct" TextMate scope for them.

Reviewers: hokein, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369238
2019-08-19 07:51:39 +00:00
Raphael Isemann 21599876be [lldb][NFC] Address review comments to StringList for-loop support
llvm-svn: 369237
2019-08-19 07:22:19 +00:00
David L. Jones b1752f670f Revert [Attributor] Fix: Do not partially resolve returned calls.
This reverts r369160 (git commit f72d9b1c97)

r369160 caused some tests to fail under UBSAN. See thread on llvm-commits.

llvm-svn: 369236
2019-08-19 07:16:24 +00:00
Jan Kratochvil 0697bcd127 [lldb] Remove unused inheritance in RegularExpression
D66174 left inherited llvm::Regex which is now a member variable there.

Approved as a part of: https://reviews.llvm.org/D66392#1634575

llvm-svn: 369235
2019-08-19 07:06:56 +00:00
Seiya Nuta 1e335611ad Revert r369230 and r369231
Looks these commits break CI builds:

- http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-gn/builds/4159

This commit reverts r369230 and r369231 (git coommit: 4a198a7 and dee9546).

llvm-svn: 369234
2019-08-19 06:45:48 +00:00
Fangrui Song 38426c114f [MC] Don't emit .symver redirected symbols to the symbol table
GNU as keeps the original symbol in the symbol table for defined @ and
@@, but suppresses it in other cases (@@@ or undefined). The original
symbol is usually undesired:
In a shared object, the original symbol can be localized with a version
script, but it is hard to remove/localize in an archive:

1) a post-processing step removes the undesired original symbol
2) consumers (executable) of the archive are built with the
   version script

Moreover, it can cause linker issues like binutils PR/18703 if the
original symbol name and the base name of the versioned symbol is the
same (both ld.bfd and gold have some code to work around defined @ and
@@). In lld, if it sees f and f@v1:

  --version-script =(printf 'v1 {};') => f and f@v1
  --version-script =(printf 'v1 { f; };') => f@v1 and f@@v1

It can be argued that @@@ added on 2000-11-13 corrected the @ and @@ mistake.

This patch catches some more multiple version errors (defined @ and @@),
and consistently suppress the original symbol. This addresses all the
problems listed above.

If the user wants other aliases to the versioned symbol, they can copy
the original symbol to other symbol names with .set directive, e.g.

    .symver f, f@v1  # emit f@v1 but not f into .symtab
    .set f_impl, f   # emit f_impl into .symtab

llvm-svn: 369233
2019-08-19 06:17:30 +00:00
Craig Topper ebb7ddc633 [X86] Teach lower1BitShuffle to match right shifts with upper zero elements on types that don't natively support KSHIFT.
We can support these by widening to a supported type,
then shifting all the way to the left and then
back to the right to ensure that we shift in zeroes.

llvm-svn: 369232
2019-08-19 05:45:39 +00:00