Commit Graph

323511 Commits

Author SHA1 Message Date
Kristina Brooks 3a4d5ed232 [modulemap] exclude a non-module friendly header
Exclude Attributor.h from LLVM_Transforms to avoid
a link failure when building modular LLVM. 

llvm-svn: 368064
2019-08-06 17:16:56 +00:00
Daniel Sanders d9934d4939 [globalisel] Allow SrcOp to convert an APInt and render it as an immediate operand (MO.isImm() == true)
Summary:
This is tested by D61289 but has been pulled into a separate patch at
a reviewers request.

Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, arsenm, rovka

Reviewed By: arsenm

Subscribers: javed.absar, hiraditya, wdng, kristof.beyls, Petar.Avramovic, llvm-commits

Tags: #llvm

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

llvm-svn: 368063
2019-08-06 17:16:27 +00:00
Ilya Biryukov bfbf6b6cab [Syntax] Do not add a node for 'eof' into the tree
Summary:
While useful as a sentinel value when iterating over tokens, having
'eof' in the tree, seems to do more harm than good.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

llvm-svn: 368062
2019-08-06 17:07:58 +00:00
Roman Lebedev 213817327f [X86] Move CPU features for Barcelona/K10 out of line
Summary:
Cleans X86.td's Barcelona entry to be more like the others,
by moving the features out of the `Proc<>`, thus potentially
making it possible to inherit from them.
Split off from D63628

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 368061
2019-08-06 17:04:02 +00:00
Roman Lebedev 94b741e348 [TableGen] FieldInit: improve assertion message
Summary:
When fiddling with sched profiles, especially creating new ones, it's amazingly easy
to end up with malformed .td that crashes tablegen, without explanation of the bug.
This changes the most common assertion i have encountered to dump enough information
to be able to fix the .td

Split of from D63628

Reviewers: RKSimon, craig.topper, nhaehnle

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 368060
2019-08-06 17:03:50 +00:00
Roman Lebedev 0f95710976 [InstCombine] Shift amount reassociation: shl-trunc-shl pattern
Summary:
Currently `reassociateShiftAmtsOfTwoSameDirectionShifts()` only handles
two shifts one after another. If the shifts are `shl`, we still can
easily perform the fold, with no extra legality checks:
https://rise4fun.com/Alive/OQbM

If we have right-shift however, we won't be able to make it
any simpler than it already is.

After this the only thing missing here is constant-folding: (`NewShAmt >= bitwidth(X)`)
* If it's a logical shift, then constant-fold to `0` (not `undef`)
* If it's a `ashr`, then a splat of original signbit
https://rise4fun.com/Alive/E1K
https://rise4fun.com/Alive/i0V

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368059
2019-08-06 17:03:40 +00:00
Shaurya Gupta 8fbb6ce847 Fixed toHalfOpenFileRange assertion fail
Summary:
- Added new function that gets Expansion range with both ends in the same file.
- Fixes the crash at https://github.com/clangd/clangd/issues/113

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

Tags: #clang

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

llvm-svn: 368058
2019-08-06 17:01:12 +00:00
Fangrui Song c55c0598f9 [ELF][PPC] Don't relax ifunc toc-indirect accesses to toc-relative
Fixes PR42759.

```
// If ifunc is taken address in -fPIC code, it may have a toc entry
.section .toc,"aw",@progbits
  .quad ifunc

// ifunc may be defined as STT_GNU_IFUNC in another object file
.type ifunc, %gnu_indirect_function
```

If ifunc is non-preemptable (e.g. when linking an executable), the toc
entry will be relocated by R_PPC64_IRELATIVE.

R_*_IRELATIVE represents the symbolic value of a
non-preemptable ifunc (not associated with a canonical PLT) in a writable location. It has an unknown value at
link time, so we cannot apply toc-indirect to toc-relative relaxation.

Reviewed By: luporl, sfertile

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

llvm-svn: 368057
2019-08-06 16:57:54 +00:00
Cameron McInally 9c52f66f48 [NFC][EarlyCSE] Pre-commit unary FNeg tests.
llvm-svn: 368056
2019-08-06 16:41:30 +00:00
Diego Caballero 8bac17709e Re-land D65760/r367944
Fixed most vexing parse ambiguation.

llvm-svn: 368055
2019-08-06 16:24:17 +00:00
Max Moroz 6c619aadc4 [compiler-rt] Rename FuzzedDataProvider.h to .hpp and other minor changes.
Summary:
.hpp makes more sense for this header as it's C++ only, plus it
contains the actual implementation.

Reviewers: Dor1s

Reviewed By: Dor1s

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

Tags: #llvm, #sanitizers

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

llvm-svn: 368054
2019-08-06 16:02:39 +00:00
Jonas Devlieghere cb6f2646fd [Path] Fix bug in make_absolute logic
This fixes a bug for making path with a //net style root absolute. I
discovered the bug while writing a test case for the VFS, which uses
these paths because they're both legal absolute paths on Windows and
Unix.

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

llvm-svn: 368053
2019-08-06 15:46:45 +00:00
Ilya Biryukov 4b03364d72 [AST] Traverse attributes inside DEF_TRAVERSE_DECL macro
Summary:
Instead of traversing inside the TraverseDecl() function.
Previously the attributes were traversed after Travese(Some)Decl
returns.

Logically attributes are properties of particular Decls and should be
traversed alongside other "child" nodes.

None of the tests relied on this behavior, hopefully this is an indication
that the change is relatively safe.

This change started with a discussion on cfe-dev, for details see:
https://lists.llvm.org/pipermail/cfe-dev/2019-July/062899.html

Reviewers: rsmith, gribozavr

Reviewed By: gribozavr

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 368052
2019-08-06 15:46:12 +00:00
Louis Dionne 8442252c49 [libc++] Use the monorepo in the macos-trunk CI script
llvm-svn: 368051
2019-08-06 15:28:34 +00:00
Hubert Tong 51b0032ff7 [CMake] Add mapping for IBM XL -qnoeh and -qnortti
Summary:
This patch maps in the `-qnoeh` and `-qnortti` options for building with
IBM XL compilers.

Reviewers: daltenty, xingxue, jasonliu

Reviewed By: daltenty

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368050
2019-08-06 15:08:13 +00:00
Sander de Smalen ad7e95df5a [AArch64] NFC: Generalize emitFrameOffset to support more than byte offsets.
Refactor emitFrameOffset to accept a StackOffset struct as its offset argument.
This method currently only supports byte offsets (MVT::i8) but will be extended
in a later patch to support scalable offsets (MVT::nxv1i8) as well.

Reviewers: thegameg, rovka, t.p.northover, efriedma, greened

Reviewed By: efriedma

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

llvm-svn: 368049
2019-08-06 15:06:31 +00:00
Hubert Tong fc34a536d0 [XCOFF][MC] report_fatal_error before dereferencing NULL
This patch replaces a TODO comment with a call to `report_fatal_error`.
The path that reaches the added call to `report_fatal_error` manifestly
dereferences a null pointer.

llvm-svn: 368048
2019-08-06 15:05:20 +00:00
George Rimar c92b951567 [test/Object] - Cleanup the Object\obj2yaml.test a bit.
This makes 2 changes:

1) Removes unwind-section.elf-x86-64 object and the corresponding test case,
because SHT_X86_64_UNWIND is already tested here:
https://github.com/llvm-mirror/llvm/blob/master/test/tools/obj2yaml/section-type.yaml

2) Removes/partially moves "No such file or directory" test, because we already have a similar test here:
https://github.com/llvm-mirror/llvm/blob/master/test/tools/obj2yaml/invalid_input_file.test

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

llvm-svn: 368044
2019-08-06 14:34:39 +00:00
Simon Pilgrim dae5ddad9d [TargetLowering] SimplifyMultipleUseDemandedBits - return UNDEF for undemanded ops
If we demand no bits/elts from an Op, just return UNDEF

llvm-svn: 368043
2019-08-06 14:30:42 +00:00
Tim Renouf 5a0794327a [StructurizeCFG] Enable -structurizecfg-relaxed-uniform-regions by default
D62198 introduced an option to relax the checks for
hasOnlyUniformBranches. This commit turns the option on by default, for
better code generation in some cases in AMDGPU.

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

Change-Id: I9cbff002a1e74d3b7eb96b4192dc8129936d537d
llvm-svn: 368042
2019-08-06 14:30:19 +00:00
Peter Smith 7f320d4bf0 [ELF][ARM] Fix /DISCARD/ of section with .ARM.exidx section
The combineEhSections runs, by design, before processSectionCommands so
that input exception sections like .ARM.exidx and .eh_frame are not assigned
to OutputSections. Unfortunately if /DISCARD/ removes InputSections that
have associated .ARM.exidx sections without discarding the .ARM.exidx
synthetic section then we will end up crashing when trying to sort the
InputSections in ascending address order.

We fix this by filtering out the sections that have been discarded prior
to processing the InputSections in finalizeContents().

fixes pr42890

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

llvm-svn: 368041
2019-08-06 14:13:38 +00:00
Fangrui Song e49c417ed1 [ELF] Make binding (weak or non-weak) logic consistent for Undefined and SharedSymbol
This is a case missed by D64136. If %t1.o has a weak reference on foo,
and %t2.so has a non-weak reference on foo:

```
0. ld.lld %t1.o %t2.so          # ok; STB_WEAK; accepted since D64136
1. ld.lld %t2.so %t1.o          # undefined symbol: foo; STB_GLOBAL
2. gold %t1.o %t2.so            # ok; STB_WEAK
3. gold %t2.so %t1.o            # undefined reference to 'foo'; STB_GLOBAL
4. ld.bfd %t1.o %t2.so          # undefined reference to `foo'; STB_WEAK
5. ld.bfd %t2.so %t1.o          # undefined reference to `foo'; STB_WEAK
```

It can be argued that in both cases, the binding of the undefined foo
should be set to STB_WEAK, because the binding should not be affected by
referenced from shared objects.

--allow-shlib-undefined doesn't suppress errors (3,4,5), but -shared or
--noinhibit-exec allows ld.bfd/gold to produce a binary:

```
3. gold -shared %t2.so %t1.o    # ok; STB_GLOBAL
4. ld.bfd -shared %t2.so %t1.o  # ok; STB_WEAK
5. ld.bfd -shared %t1.o %t1.o   # ok; STB_WEAK
```

If %t2.so has DT_NEEDED entries, ld.bfd will load them (lld/gold don't
have the behavior). If one of the DSO defines foo and it is in the
link-time search path (e.g. DT_NEEDED entry is an absolute path, via
-rpath=, via -rpath-link=, etc),
`ld.bfd %t1.o %t2.so` and `ld.bfd %t1.o %t2.so` will not error.

In this patch, we make Undefined and SharedSymbol share the same binding
computing logic. Case 1 will be allowed:

```
0. ld.lld %t1.o %t2.so          # ok; STB_WEAK; accepted since D64136
1. ld.lld %t2.so %t1.o          # ok; STB_WEAK; changed by this patch
```

In the future, we can explore the option that turns both (0,1) into
errors if --no-allow-shlib-undefined (default when linking an
executable) is in action.

Reviewed By: ruiu

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

llvm-svn: 368038
2019-08-06 14:03:45 +00:00
Dmitri Gribenko 81dc15e883 Revert "Fixed failing test cases"
This reverts commit r368030, which depends on r368021 that I reverted.

llvm-svn: 368036
2019-08-06 13:50:28 +00:00
Dmitri Gribenko fc21bb661f Revert "[yaml2obj] Move core yaml2obj code into lib and include for use in unit tests"
This reverts commit r368021, it broke tests.

llvm-svn: 368035
2019-08-06 13:39:50 +00:00
Dmitri Gribenko bd1721e534 Revert "gn build: Merge r368021"
This reverts commit r368025, which depends on r368021, which needs to be
reverted.

llvm-svn: 368034
2019-08-06 13:39:27 +00:00
Igor Kudrin 0be738895c Update LLDB to follow changes in llvm::DWARFDebugNames::NameIndex (4/5)
Differential Revision: https://reviews.llvm.org/D65640

llvm-svn: 368033
2019-08-06 13:38:27 +00:00
Igor Kudrin 5978c9249b [MachO] Update LLD to use 64-bit offsets with DataExtractor (3/5)
Differential Revision: https://reviews.llvm.org/D65639

llvm-svn: 368032
2019-08-06 13:37:34 +00:00
Tim Northover b5abc425d2 AArch64: bail instead of asserting on unexpected type in G_CONSTANT 0.
llvm-svn: 368031
2019-08-06 13:34:08 +00:00
Alex Brachet 9eee425479 Fixed failing test cases
llvm-svn: 368030
2019-08-06 13:29:55 +00:00
Mike Spertus 49068a054b Improve MSVC visualizations so the parser shows where we are in the code
Also provide a visualizer for lambda introducers

llvm-svn: 368029
2019-08-06 13:29:35 +00:00
Sanjay Patel efc24d9d6f [InstCombine] add tests for binop with FMF with select operands; NFC
Baseline coverage for D65658.

llvm-svn: 368028
2019-08-06 13:19:13 +00:00
Nico Weber b2ec7a0da6 gn build: Merge r368024
llvm-svn: 368027
2019-08-06 13:12:26 +00:00
Simon Pilgrim cf62047d29 [X86][SSE] Call SimplifyMultipleUseDemandedBits on PACKSS/PACKUS arguments.
This mainly helps to replace unused arguments with UNDEF in the case where they have multiple users.

llvm-svn: 368026
2019-08-06 13:10:42 +00:00
Nico Weber 87951c89d7 gn build: Merge r368021
llvm-svn: 368025
2019-08-06 13:08:54 +00:00
Sander de Smalen 612b038966 [AArch64] NFC: Add generic StackOffset to describe scalable offsets.
To support spilling/filling of scalable vectors we need a more generic
representation of a stack offset than simply 'int'.

For this we introduce the StackOffset struct, which comprises multiple
offsets sized by their respective MVTs. Byte-offsets will thus be a simple
tuple such as { offset, MVT::i8 }. Adding two byte-offsets will result in a
byte offset { offsetA + offsetB, MVT::i8 }. When two offsets have different
types, we can canonicalise them to use the same MVT, as long as their
runtime sizes are guaranteed to have the same size-ratio as they would have
at compile-time.

When we have both scalable- and fixed-size objects on the stack, we can 
create an offset that is: 

  ({ offset_fixed, MVT::i8 } + { offset_scalable, MVT::nxv1i8 })

The struct also contains a getForFrameOffset() method that is specific to
AArch64 and decomposes the frame-offset to be used directly in instructions
that operate on the stack or index into the stack.

Note: This patch adds StackOffset as an AArch64-only concept, but we would
like to make this a generic concept/struct that is supported by all 
interfaces that take or return stack offsets (currently as 'int'). Since
that would be a bigger change that is currently pending on D32530 landing,
we thought it makes sense to first show/prove the concept in the AArch64
target before proposing to roll this out further.

Reviewers: thegameg, rovka, t.p.northover, efriedma, greened

Reviewed By: rovka, greened

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

llvm-svn: 368024
2019-08-06 13:06:40 +00:00
Simon Atanasyan 2fbf58c6e6 [llvm/test/Object] Remove redundant test case. NFC
Remove redundant `yaml2obj-elf-file-headers-with-e_flags.yaml` test
case. The same functionality is checked by the `Mips/elf-flags.yaml`.

llvm-svn: 368023
2019-08-06 12:41:43 +00:00
Simon Pilgrim 01d267dc4f [X86] SimplifyMultipleUseDemandedBits - target shuffles might not be identity
If we don't demand any non-undef shuffle elements then the assert will fail as all shuffle inputs would still be flagged as 'identity' safe.

Exposed by an incoming patch.

llvm-svn: 368022
2019-08-06 12:41:29 +00:00
Alex Brachet 3cfeaa4d2c [yaml2obj] Move core yaml2obj code into lib and include for use in unit tests
Reviewers: jhenderson, rupprecht, MaskRay, grimar, labath

Reviewed By: rupprecht

Subscribers: seiya, mgorny, sbc100, hiraditya, aheejin, jakehehrlich, llvm-commits

Tags: #llvm

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

llvm-svn: 368021
2019-08-06 12:15:18 +00:00
Balazs Keri 4e79097dc7 [CrossTU] Handle case when no USR could be generated during Decl search.
Summary:
When searching for a declaration to be loaded the "lookup name" for every
other Decl is computed. If the USR can not be determined here should be
not an assert, instead skip this Decl.

Reviewers: martong

Reviewed By: martong

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

Tags: #clang

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

llvm-svn: 368020
2019-08-06 12:10:16 +00:00
Ilya Biryukov 56bdb0c508 [clangd] Compute scopes eagerly in IncludeFixer
Summary:
Computing lazily leads to crashes. In particular, computing scopes may
produce diagnostics (from inside template instantiations) and we
currently do it when processing another diagnostic, which leads to
crashes.

Moreover, we remember and access 'Scope*' when computing scopes. This
might lead to invalid memory access if the Scope is deleted by the time
we run the delayed computation. We did not actually construct an example
when this happens, though.

From the VCS and review history, it seems the optimization was
introduced in the initial version without a mention of any performance
benchmarks justifying the performance gains. This led me to a
conclusion that the optimization was premature, so removing it to avoid
crashes seems like the right trade-off at that point.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

llvm-svn: 368019
2019-08-06 11:37:50 +00:00
Igor Kudrin 2836cf0b72 Try to unbreak buildbots after r368014
llvm-svn: 368018
2019-08-06 11:12:13 +00:00
Simon Pilgrim c6735aecfa [X86][SSE] Enable min/max partial reduction
As mentioned on D65047 / rL366933 the plan is to enable partial reduction handling wherever possible.

llvm-svn: 368016
2019-08-06 11:00:34 +00:00
Simon Pilgrim 23cd0da9e9 [X86][SSE] Add tests for min/max partial reduction
As mentioned on D65047 / rL366933 the plan is to enable partial reduction handling wherever possible.

llvm-svn: 368015
2019-08-06 10:52:44 +00:00
Igor Kudrin f26a70a5e7 Switch LLVM to use 64-bit offsets (2/5)
This updates all libraries and tools in LLVM Core to use 64-bit offsets
which directly or indirectly come to DataExtractor.

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

llvm-svn: 368014
2019-08-06 10:49:40 +00:00
Igor Kudrin f5f35c5cd1 Support 64-bit offsets in utility classes (1/5)
Using 64-bit offsets is required to fully implement 64-bit DWARF.
As these classes are used in many different libraries they should
temporarily support both 32- and 64-bit offsets.

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

llvm-svn: 368013
2019-08-06 10:47:20 +00:00
Ulrich Weigand 7b24dd741c [Strict FP] Allow custom operation actions
This patch changes the DAG legalizer to respect the operation actions
set by the target for strict floating-point operations. (Currently, the
legalizer will usually fall back to mutate to the non-strict action
(which is assumed to be legal), and only skip mutation if the strict
operation is marked legal.)

With this patch, if whenever a strict operation is marked as Legal or
Custom, it is passed to the target as usual. Only if it is marked as
Expand will the legalizer attempt to mutate to the non-strict operation.
Note that this will now fail if the non-strict operation is itself
marked as Custom -- the target will have to provide a Custom definition
for the strict operation then as well.

Reviewed By: hfinkel

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

llvm-svn: 368012
2019-08-06 10:43:13 +00:00
Fangrui Song cb4327d7db Change two unnecessary uses of llvm::size(C) to C.size()
llvm-svn: 368011
2019-08-06 10:24:36 +00:00
Pavel Labath 1177bc597d ObjectFileELF: permit thread-local sections with overlapping file addresses
Summary:
In an attempt to make file-address-based lookups more predictable, in D55998
we started ignoring sections which would result in file address
overlaps. It turns out this was too aggressive because thread-local
sections typically will have file addresses which apear to overlap
regular data/code. This does not cause a problem at runtime because
thread-local sections are loaded into memory using special logic, but it
can cause problems for lldb when trying to lookup objects by their file
address.

This patch changes ObjectFileELF to permit thread-local sections to
overlap regular ones by essentially giving them a separate address
space. It also makes them more symmetrical to regular sections by
creating container sections from PT_TLS segments.

Simultaneously, the patch changes the regular file address lookup logic
to ignore sections with the thread-specific bit set. I believe this is
what the users looking up file addresses would typically expect, as
looking up thread-local data generally requires more complex logic (e.g.
DWARF has a special opcode for that).

Reviewers: clayborg, jingham, MaskRay

Subscribers: emaste, aprantl, arichardson, lldb-commits

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

llvm-svn: 368010
2019-08-06 10:04:27 +00:00
Gabor Marton f89c8f20e1 Add User docs for ASTImporter
Summary:
This document includes the description of the ASTImporter from the user/client
perspective.
A subsequent patch will describe the development internals.

Reviewers: a_sidorin, shafik, gamesh411, balazske, a.sidorin

Subscribers: rnkovacs, dkrupp, arphaman, Szelethus, cfe-commits

Tags: #clang

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

llvm-svn: 368009
2019-08-06 09:52:21 +00:00
Cullen Rhodes ced419f4d7 [SelectionDAG] Extend base addressing modes supported by MGATHER/MSCATTER
Summary:
Before this patch MGATHER/MSCATTER is capable of representing all
common addressing modes, but only when illegal types are used.
This patch adds an IndexType property so more representations
are available when using legal types only.

Original modes:
 vector of bases
 base + vector of signed scaled offsets

New modes:
 base + vector of signed unscaled offsets
 base + vector of unsigned scaled offsets
 base + vector of unsigned unscaled offsets

The current behaviour of addressing modes for gather/scatter remains
unchanged.

Patch by Paul Walker.

Reviewed By: craig.topper

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

llvm-svn: 368008
2019-08-06 09:46:13 +00:00