platform/upstream/llvm.git
4 years ago[NFC] Use new canCreatePoison to make code intent more clear in PoisonChecking
Philip Reames [Wed, 15 Apr 2020 19:34:48 +0000 (12:34 -0700)]
[NFC] Use new canCreatePoison to make code intent more clear in PoisonChecking

4 years ago[LLVM][SupportTests] Fix Windows build breakage
Michael Spencer [Wed, 15 Apr 2020 21:46:29 +0000 (14:46 -0700)]
[LLVM][SupportTests] Fix Windows build breakage

`MemoryBuffer::getOpenFile` take an OS file handle, not an int.

4 years ago[builtins] Fix unprototypes function declaration
Ayke van Laethem [Wed, 15 Apr 2020 13:32:58 +0000 (15:32 +0200)]
[builtins] Fix unprototypes function declaration

The following declarations were missing a prototype:

    FE_ROUND_MODE __fe_getround();
    int __fe_raise_inexact();

Discovered while fixing a bug in Clang related to unprototyped function
calls (see the previous commit).

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

4 years ago[AVR] Use the correct address space for non-prototyped function calls
Ayke van Laethem [Tue, 14 Apr 2020 16:13:41 +0000 (18:13 +0200)]
[AVR] Use the correct address space for non-prototyped function calls

Some function declarations like this:

    void foo();

do not have a type declaration, for that you'd use:

    void foo(void);

Clang internally bitcasts the variadic function declaration to a
function pointer, but doesn't use the correct address space on AVR. This
commit fixes that.

This fix is necessary to let Clang compile compiler-rt for AVR.

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

4 years ago[nfc] [lldb] Introduce DWARF callbacks (fixed-up)
Jan Kratochvil [Wed, 15 Apr 2020 21:39:40 +0000 (23:39 +0200)]
[nfc] [lldb] Introduce DWARF callbacks (fixed-up)

As requested by @labath in https://reviews.llvm.org/D73206#1949516
providing DWARF index callbacks refactorization.

It is a re-landing of the patch with a regression fix the previous
commit had.

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

4 years ago[NFC] correct "thier" to "their"
Josh Stone [Wed, 15 Apr 2020 21:38:43 +0000 (14:38 -0700)]
[NFC] correct "thier" to "their"

4 years ago[docs] Fix an RST error introduced in e823068306e.
Lang Hames [Wed, 15 Apr 2020 18:44:17 +0000 (11:44 -0700)]
[docs] Fix an RST error introduced in e823068306e.

This should fix the 'Explicit markup ends without a blank line' error seen on
http://lab.llvm.org:8011/builders/llvm-sphinx-docs.

Thanks to Daniel Sanders for spotting this.

4 years agoPR45561: Return a literal string rather than an error string to avoid returning refer...
David Blaikie [Wed, 15 Apr 2020 21:26:31 +0000 (14:26 -0700)]
PR45561: Return a literal string rather than an error string to avoid returning reference to local

Changing the underlying YAML support to allow returning a literal
string, rather than a StringRef, would probably be a bigger refactor so
I didn't do that.

4 years agoRemove extra ‘;’. NFC.
Michael Liao [Wed, 15 Apr 2020 21:19:48 +0000 (17:19 -0400)]
Remove extra ‘;’. NFC.

4 years agoRevert "[lit] Keep original cfg file case around."
Nico Weber [Wed, 15 Apr 2020 21:17:18 +0000 (17:17 -0400)]
Revert "[lit] Keep original cfg file case around."

This reverts commit bc3f54de1827e58655c34477d09211cbc42589bd.

The patch breaks in the following two scenarios:

1. When manually passing an absolute path to llvm-lit with a lower-case
   drive letter: `python bin\llvm-lit.py -sv c:\llvm-project\clang\test\PCH`

2. When the PWD has a lower-case drive letter, like after running
   `cd c:\` with a lower-case "c:" (cmd's default is upper-case, but
   it takes case-ness from what's passed to `cd` apparently).

4 years ago[Clang] Expose RequiresNullTerminator in FileManager.
Michael Spencer [Thu, 9 Apr 2020 03:29:39 +0000 (20:29 -0700)]
[Clang] Expose RequiresNullTerminator in FileManager.

This is needed to fix the reason
0a2be46cfdb698fe (Modules: Invalidate out-of-date PCMs as they're
discovered) and 5b44a4b07fc1d ([modules] Do not cache invalid state for
modules that we attempted to load.) were reverted.

These patches changed Clang to use `isVolatile` when loading modules.
This had the side effect of not using mmap when loading modules, and
thus greatly increased memory usage.

The reason it wasn't using mmap is because `MemoryBuffer` plays some
games with file size when you request null termination, and it has to
disable these when `isVolatile` is set as the size may change by the
time it's mmapped. Clang by default passes
`RequiresNullTerminator = true`, and `shouldUseMmap` ignored if
`RequiresNullTerminator` was even requested.

This patch adds `RequiresNullTerminator` to the `FileManager` interface
so Clang can use it when loading modules, and changes `shouldUseMmap` to
only take volatility into account if `RequiresNullTerminator` is true.
This is fine as both `mmap` and a `read` loop are vulnerable to
modifying the file while reading, but are immune to the rename Clang
does when replacing a module file.

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

4 years ago[AMDGPU] Move DWARF proposal to separate file
Tony [Tue, 14 Apr 2020 04:55:43 +0000 (00:55 -0400)]
[AMDGPU] Move DWARF proposal to separate file

- Move DWARF proposal for heterogeneous debugging to a separate file.
- Add references.

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

4 years ago[MLIR] Improve support for 0-dimensional Affine Maps.
Jeremy Bruestle [Wed, 15 Apr 2020 18:12:47 +0000 (11:12 -0700)]
[MLIR] Improve support for 0-dimensional Affine Maps.

Summary:
Modified AffineMap::get to remove support for the overload which allowed
an ArrayRef of AffineExpr but no context (and gathered the context from a
presumed first entry, resulting in bugs when there were 0 results).

Instead, we support only a ArrayRef and a context, and a version which
takes a single AffineExpr.

Additionally, removed some now needless case logic which previously
special cased which call to AffineMap::get to use.

Reviewers: flaub, bondhugula, rriddle!, nicolasvasilache, ftynse, ulysseB, mravishankar, antiagainst, aartbik

Subscribers: mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, bader, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years ago[Attributor] KindToAbstractAttributeMap: use SmallDenseMap
Roman Lebedev [Wed, 15 Apr 2020 21:12:45 +0000 (00:12 +0300)]
[Attributor] KindToAbstractAttributeMap: use SmallDenseMap

Summary:
While this is less efficient to allocate huge `SmallDenseMap` for each `IRPosition` in `AAMap`,
in the larger picture this is much better, since we'd eventually either fill each `IRPosition`,
with each possible attribute, or at least quert for it, which would allocate it anyway.
So we are better off pre-allocating.

Old:
```
   0.3460 ( 40.7%)   0.0183 ( 33.9%)   0.3643 ( 40.3%)   0.3644 ( 40.3%)  Deduce and propagate attributes (CGSCC pass)
   0.1135 ( 13.4%)   0.0080 ( 14.7%)   0.1215 ( 13.4%)   0.1215 ( 13.4%)  Deduce and propagate attributes
```
```
total runtime: 19.48s.
bytes allocated in total (ignoring deallocations): 575.02MB (29.51MB/s)
calls to allocation functions: 908876 (46644/s)
temporary memory allocations: 276654 (14198/s)
peak heap memory consumption: 26.68MB
peak RSS (including heaptrack overhead): 944.78MB
total memory leaked: 8.85MB
```
New:
```
   0.3223 ( 38.1%)   0.0299 ( 53.6%)   0.3522 ( 39.1%)   0.3522 ( 39.1%)  Deduce and propagate attributes (CGSCC pass)
   0.1150 ( 13.6%)   0.0037 (  6.7%)   0.1188 ( 13.2%)   0.1188 ( 13.2%)  Deduce and propagate attributes
```
```
total runtime: 19.06s.
bytes allocated in total (ignoring deallocations): 363.21MB (19.06MB/s)
calls to allocation functions: 679660 (35658/s)
temporary memory allocations: 83472 (4379/s)
peak heap memory consumption: 27.00MB
peak RSS (including heaptrack overhead): 931.66MB
total memory leaked: 8.85MB
```

Diff:
```
total runtime: -0.42s.
bytes allocated in total (ignoring deallocations): -211.81MB (498.38MB/s)
calls to allocation functions: -229216 (539331/s)
temporary memory allocations: -193182 (454545/s)
peak heap memory consumption: 321.54KB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: uenoku, llvm-commits

Tags: #llvm

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

4 years ago[MustExecute] checkForAllContext(): use pre-increment
Roman Lebedev [Wed, 15 Apr 2020 21:12:17 +0000 (00:12 +0300)]
[MustExecute] checkForAllContext(): use pre-increment

Summary:
You'd think there is no difference, but this halves (yikes!) compiler memory usage
on `test-suite/MultiSource/Applications/SPASS/top.c` test,
because `MustBeExecutedIterator operator++()` is, well, post-increment,
it must create a duplicate of existing `MustBeExecutedIterator`,
which involves duplicating `VisitedSetTy Visited` which is `DenseSet`..

Old
```
   0.3573 ( 42.9%)   0.0264 ( 33.7%)   0.3837 ( 42.1%)   0.3837 ( 42.1%)  Deduce and propagate attributes (CGSCC pass)
   0.1011 ( 12.1%)   0.0199 ( 25.4%)   0.1210 ( 13.3%)   0.1210 ( 13.3%)  Deduce and propagate attributes
```
```
total runtime: 20.04s.
bytes allocated in total (ignoring deallocations): 1.09GB (54.63MB/s)
calls to allocation functions: 1142410 (57020/s)
temporary memory allocations: 500538 (24983/s)
peak heap memory consumption: 26.68MB
peak RSS (including heaptrack overhead): 944.85MB
total memory leaked: 8.85MB
```
New:
```
   0.3309 ( 39.8%)   0.0164 ( 33.3%)   0.3473 ( 39.5%)   0.3473 ( 39.5%)  Deduce and propagate attributes (CGSCC pass)
   0.1152 ( 13.9%)   0.0076 ( 15.5%)   0.1229 ( 14.0%)   0.1229 ( 14.0%)  Deduce and propagate attributes
```
```
total runtime: 19.49s.
bytes allocated in total (ignoring deallocations): 575.07MB (29.51MB/s)
calls to allocation functions: 909059 (46651/s)
temporary memory allocations: 276923 (14211/s)
peak heap memory consumption: 26.68MB
peak RSS (including heaptrack overhead): 942.90MB
total memory leaked: 8.85MB
```
Diff:
```
total runtime: -0.55s.
bytes allocated in total (ignoring deallocations): -519.41MB (946.11MB/s)
calls to allocation functions: -233351 (425047/s)
temporary memory allocations: -223615 (407313/s)
peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[llvm][CodeGen] Rename SVE gather prefetch intrinsics. [NFC]
Francesco Petrogalli [Wed, 15 Apr 2020 20:46:51 +0000 (21:46 +0100)]
[llvm][CodeGen] Rename SVE gather prefetch intrinsics. [NFC]

Summary:
The renaming is necessary to make the naming scheme uniform with other
gather/scatter load/stores SVE intrinsics.

The naming of variables and functions have been adapted to make it
explicit whether we are dealing with a scalar offset (which is
unscaled) or an index (which is scaled according to the data type of
the lanes of the vector).

Reviewers: andwar, sdesmalen, rengolin

Reviewed By: andwar

Subscribers: tschuett, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Docs] Split testing in running and debugging
Jonas Devlieghere [Wed, 15 Apr 2020 20:04:18 +0000 (13:04 -0700)]
[lldb/Docs] Split testing in running and debugging

Separate running the tests from debugging the test. This is preparatory
for a new section coming soon.

4 years ago[PowerPC] Clear the set of symbols that need to be updated in MCTargetStreamer
Nemanja Ivanovic [Wed, 15 Apr 2020 20:40:51 +0000 (15:40 -0500)]
[PowerPC] Clear the set of symbols that need to be updated in MCTargetStreamer

We have added code to correct the .localentry values on assignments. However, we
never clear the set so presumably it will still contain the (now dangling)
MCSymbol pointers across a call to finish() and reset() in the streamer.

This is based on my speculation that it is the reason we are getting
segmentation faults mentioned in https://bugs.llvm.org/show_bug.cgi?id=45366

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

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

4 years ago[NFC] Correcting minor typo.
Nate Voorhies [Wed, 15 Apr 2020 19:28:06 +0000 (12:28 -0700)]
[NFC] Correcting minor typo.

Summary: Hande -> Handle

Reviewers: xazax.hun

Reviewed By: xazax.hun

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

4 years agoAttempt to fix build with MSVC.
Richard Smith [Wed, 15 Apr 2020 20:26:22 +0000 (13:26 -0700)]
Attempt to fix build with MSVC.

MSVC appears to instantiate the virtual members of FoldingSet when
instantiating the class definition, thereby requiring the element type
to be defined so that its hash function is known.

This is intended to be a temporary fix; ideally, FoldingSet should not
require this.

4 years agoImprove diagnostic when constant-evaluating a std::initializer_list with
Richard Smith [Wed, 15 Apr 2020 20:23:56 +0000 (13:23 -0700)]
Improve diagnostic when constant-evaluating a std::initializer_list with
an unexpected form.

4 years ago[CallSite removal][SimpleLoopUnswitch] Use CallBase instead of CallSite. NFC
Craig Topper [Wed, 15 Apr 2020 19:49:20 +0000 (12:49 -0700)]
[CallSite removal][SimpleLoopUnswitch] Use CallBase instead of CallSite. NFC

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

4 years agoFix DataFlowSanitizer implementation of strchr() so that strchr(..., '\0') returns...
Sam Kerner [Wed, 15 Apr 2020 20:07:28 +0000 (13:07 -0700)]
Fix DataFlowSanitizer implementation of strchr() so that strchr(..., '\0') returns a pointer to '\0'.

Summary:

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

Reviewers: pcc, morehouse

Reviewed By: morehouse

Subscribers: morehouse, #sanitizers

Tags: #sanitizers

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

4 years ago[pstl] Added missing double-underscore prefixes to some types
Ismail Pazarbasi [Mon, 13 Apr 2020 13:21:38 +0000 (15:21 +0200)]
[pstl] Added missing double-underscore prefixes to some types

Summary:
Some of the `move_` types were used with leading double-underscores, but
they were declared without `__` prefix.

This patch adds double-underscores to all `move_` types, and their uses.

Reviewers: MikeDvorskiy, ldionne, EricWF, rodgert, #libc

Reviewed By: MikeDvorskiy, ldionne, #libc

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[SelectionDAG] Fix usage of Align constructing MachineMemOperands.
Eli Friedman [Tue, 7 Apr 2020 21:05:29 +0000 (14:05 -0700)]
[SelectionDAG] Fix usage of Align constructing MachineMemOperands.

The "Align" passed into getMachineMemOperand etc. is the alignment of
the MachinePointerInfo, not the alignment of the memory operation.
(getAlign() on a MachineMemOperand automatically reduces the alignment
to account for this.)

We were passing on wrong (overconservative) alignment in a bunch of
places. Fix a bunch of these, mostly in legalization.  And while I'm
here, switch to the new Align APIs.

The test changes are all scheduling changes: the biggest effect of
preserving large alignments is that it improves alias analysis, so the
scheduler has more freedom.

(I was originally just trying to do a minor cleanup in
SelectionDAGBuilder, but I accidentally went deeper down the rabbit
hole.)

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

4 years agoMove BinaryOperators.FPOptions to trailing storage
Melanie Blower [Fri, 10 Apr 2020 20:34:46 +0000 (13:34 -0700)]
Move BinaryOperators.FPOptions to trailing storage

Reviewers: rjmccall

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

4 years ago[ASTMatchers] Fix isDerivedFrom for recursive templates
Jan Korous [Wed, 15 Apr 2020 19:47:24 +0000 (12:47 -0700)]
[ASTMatchers] Fix isDerivedFrom for recursive templates

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

4 years ago[CallSite removal][SampleProfile] Use CallBase instead of CallSite. NFC
Craig Topper [Wed, 15 Apr 2020 19:10:10 +0000 (12:10 -0700)]
[CallSite removal][SampleProfile] Use CallBase instead of CallSite. NFC

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

4 years ago[clangd] Fix a crash for accessing a null field decl returned by findExplicitReferences.
Haojian Wu [Tue, 14 Apr 2020 22:16:10 +0000 (00:16 +0200)]
[clangd] Fix a crash for accessing a null field decl returned by findExplicitReferences.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[libc++] Remove the ability to run using the internal Lit shell
Louis Dionne [Mon, 13 Apr 2020 21:27:04 +0000 (17:27 -0400)]
[libc++] Remove the ability to run using the internal Lit shell

The new format requires using an external shell, and as we transition
and we can simplify config.py as we transition to the new format. Also,
frankly, I'd be quite surprised if that setting was still working anyway
because we have several .sh.cpp tests that likely don't work in Lit's
internal shell.

4 years agoEnable finding bitcode in wasm objects
Sam Clegg [Wed, 15 Apr 2020 18:35:35 +0000 (11:35 -0700)]
Enable finding bitcode in wasm objects

This commit fixes using functions in `IRObjectFile` to load bitcode from
wasm objects by recognizing the file magic for wasm and also inheriting
the default implementation of classifying sections as bitcode.

Patch By: alexcrichton

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

4 years ago[LICM] Try to merge debug locations when sinking.
Davide Italiano [Wed, 15 Apr 2020 19:28:34 +0000 (12:28 -0700)]
[LICM] Try to merge debug locations when sinking.

The current strategy LICM uses when sinking for debuginfo is
that of picking the debug location of one of the uses.
This causes stepping to be wrong sometimes, see, e.g. PR45523.

This patch introduces a generalization of getMergedLocation(),
that operates on a vector of locations instead of two, and try
to merge all them together, and use the new API in LICM.

<rdar://problem/61750950>

4 years ago[AArch64][NFC]Autogenerated checks.
Pavel Iliin [Wed, 15 Apr 2020 18:01:24 +0000 (19:01 +0100)]
[AArch64][NFC]Autogenerated checks.

4 years agoRework how UuidAttr, CXXUuidofExpr, and GUID template arguments and constants are...
Richard Smith [Sun, 12 Apr 2020 05:15:29 +0000 (22:15 -0700)]
Rework how UuidAttr, CXXUuidofExpr, and GUID template arguments and constants are represented.

Summary:
Previously, we treated CXXUuidofExpr as quite a special case: it was the
only kind of expression that could be a canonical template argument, it
could be a constant lvalue base object, and so on. In addition, we
represented the UUID value as a string, whose source form we did not
preserve faithfully, and that we partially parsed in multiple different
places.

With this patch, we create an MSGuidDecl object to represent the
implicit object of type 'struct _GUID' created by a UuidAttr. Each
UuidAttr holds a pointer to its 'struct _GUID' and its original
(as-written) UUID string. A non-value-dependent CXXUuidofExpr behaves
like a DeclRefExpr denoting that MSGuidDecl object. We cache an APValue
representation of the GUID on the MSGuidDecl and use it from constant
evaluation where needed.

This allows removing a lot of the special-case logic to handle these
expressions. Unfortunately, many parts of Clang assume there are only
a couple of interesting kinds of ValueDecl, so the total amount of
special-case logic is not really reduced very much.

This fixes a few bugs and issues:
 * PR38490: we now support reading from GUID objects returned from
   __uuidof during constant evaluation.
 * Our Itanium mangling for a non-instantiation-dependent template
   argument involving __uuidof no longer depends on which CXXUuidofExpr
   template argument we happened to see first.
 * We now predeclare ::_GUID, and permit use of __uuidof without
   any header inclusion, better matching MSVC's behavior. We do not
   predefine ::__s_GUID, though; that seems like a step too far.
 * Our IR representation for GUID constants now uses the correct IR type
   wherever possible. We will still fall back to using the
      {i32, i16, i16, [8 x i8]}
   layout if a definition of struct _GUID is not available. This is not
   ideal: in principle the two layouts could have different padding.

Reviewers: rnk, jdoerfert

Subscribers: arphaman, cfe-commits, aeubanks

Tags: #clang

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

4 years ago[X86] Make v32i16/v64i8 legal types without avx512bw. Use custom splitting instead.
Craig Topper [Wed, 15 Apr 2020 19:03:39 +0000 (12:03 -0700)]
[X86] Make v32i16/v64i8 legal types without avx512bw. Use custom splitting instead.

This moves v32i16/v64i8 to a model consistent with how we
treat integer types with avx1.

This does change the ABI for types vXi16/vXi8 vectors larger than
512 bits to pass in multiple zmms instead of multiple ymms. We'd
already hacked some code to make v64i8/v32i16 pass in zmm.

Cost model is still a bit of a mess. In some place I tried to
match existing behavior. But really we need to account for
splitting and concating costs. Cost model for shuffles is
especially pessimistic.

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

4 years ago[libc++] Add a new target check-cxx-deps to build dependencies of the test suite
Louis Dionne [Wed, 15 Apr 2020 19:05:14 +0000 (15:05 -0400)]
[libc++] Add a new target check-cxx-deps to build dependencies of the test suite

When running the tests through `lit` directly instead of through `check-cxx`,
it is required to manually build the `cxx` (and often `cxx_experimental`)
targets. Instead of having to do that manually, this commit adds a new
target `check-cxx-deps` that does that for you.

4 years ago[MLIR] Introduce utility to hoist affine if/else conditions
Uday Bondhugula [Fri, 10 Apr 2020 11:42:49 +0000 (17:12 +0530)]
[MLIR] Introduce utility to hoist affine if/else conditions

This revision introduces a utility to unswitch affine.for/parallel loops
by hoisting affine.if operations past surrounding affine.for/parallel.
The hoisting works for both perfect/imperfect nests and in the presence
of else blocks. The hoisting is currently to as outermost a level as
possible.  Uses a test pass to test the utility.
Add convenience method Operation::getParentWithTrait<Trait>.

Depends on D77487.

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

4 years ago[ELF][test] Add --match-full-lines to map-file.s to check leading and trailing spaces
Fangrui Song [Wed, 15 Apr 2020 18:42:50 +0000 (11:42 -0700)]
[ELF][test] Add --match-full-lines to map-file.s to check leading and trailing spaces

Since we are going to touch so many lines, do some other cleanups.
Delete Inputs/map-file3.s and Inputs/map-file4.s which are tiny.

4 years agoRemove false positive in AvoidNonConstGlobalVariables.
Kim Viggedal [Wed, 15 Apr 2020 18:47:11 +0000 (14:47 -0400)]
Remove false positive in AvoidNonConstGlobalVariables.

Addresses post-commit review feedback from https://reviews.llvm.org/D70265

4 years ago[NFC] Silence compiler warning [-Wmissing-braces].
Huihui Zhang [Wed, 15 Apr 2020 18:43:17 +0000 (11:43 -0700)]
[NFC] Silence compiler warning [-Wmissing-braces].

clang/unittests/AST/ASTImporterFixtures.h:70:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    ArgVector(), ArgVector{"-fdelayed-template-parsing"},
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {

4 years agoAMDGPU/GlobalISel: Work around a selector crash
Matt Arsenault [Wed, 15 Apr 2020 18:37:31 +0000 (14:37 -0400)]
AMDGPU/GlobalISel: Work around a selector crash

Ideally types without a corresponding register class wouldn't reach
here, but we're currently missing some (in particular a 192-bit class
is missing).

4 years ago[X86] Add generic cpu target for the slow division tests
Simon Pilgrim [Wed, 15 Apr 2020 18:05:42 +0000 (19:05 +0100)]
[X86] Add generic cpu target for the slow division tests

Baseline for any change due to D75567

4 years agoUse maximum compression when packaging release tarballs.
Dimitry Andric [Wed, 15 Apr 2020 18:30:15 +0000 (20:30 +0200)]
Use maximum compression when packaging release tarballs.

Summary:
Since a full run of test-release.sh takes many hours (at least on my
poor systems), we might as well spend some extra time compressing the
tarball, in return for a quite a bit of gains for uploading and
downloading it.

As an example, the 10.0.0-rc4 .tar.xz tarball shrinks from 465MiB to
306MiB, about 52% smaller.

Reviewers: hans, tstellar, rovka

Reviewed By: hans

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoTurn off core dumps before starting the main body of test-release.sh.
Dimitry Andric [Wed, 15 Apr 2020 18:29:20 +0000 (20:29 +0200)]
Turn off core dumps before starting the main body of test-release.sh.

Summary:
Some of the regression tests, such as those for the various sanitizers,
use huge shadow memory maps (showing up in top as 20 TiB).  If any of
those ever crashes, your test system's disk will be filled up until
everything falls over.  Set the ulimit for core dumps to 0 to prevent
this problem.

Reviewers: hans, tstellar, rovka

Reviewed By: hans

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[libc++] Adjust XFAIL markup for modules tests on single-threaded systems
Louis Dionne [Wed, 15 Apr 2020 18:17:40 +0000 (14:17 -0400)]
[libc++] Adjust XFAIL markup for modules tests on single-threaded systems

When building these tests without modules in the whole test suite,
the __config_site macro definitions are not included anymore in the
%{compile_flags}. This causes the _LIBCPP_HAS_NO_THREADS define not
to be picked up, and the test to XPASS on single-threaded systems.

This is a stop-gap measure to fix the build bots, however the proper
solution would be to always pass the __config_site defines as compiler
macros, whether we build with modules or not.

4 years agoAdd FileCheck colons missed in D76210
Jon Roelofs [Mon, 13 Apr 2020 16:36:45 +0000 (10:36 -0600)]
Add FileCheck colons missed in D76210

https://reviews.llvm.org/D76210#inline-715185

4 years ago[lit] Keep original cfg file case around.
Nico Weber [Tue, 14 Apr 2020 00:12:51 +0000 (20:12 -0400)]
[lit] Keep original cfg file case around.

There's been some back and forth if the cfg paths in the
config_map should be normcase()d. The argument for is that
it allows using all-lower spelling in cmd on Windows, the
argument against that doing so is lossy.

Before the relative-paths-in-generated-lit.site.cfg.py work,
there was no downside to calling normcase(), but with it
we need a hack to recover the original case.

This time, normcase() the hashtable key, but store the original
cased key in addition to the value. This fixes both cons, at the
cost of a few bytes more memory.

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

4 years ago[Format] Work around current vim bugs in clang-format.py
Sam McCall [Wed, 15 Apr 2020 13:12:30 +0000 (15:12 +0200)]
[Format] Work around current vim bugs in clang-format.py

Summary:
Do line/col to byte conversions on the python side rather than relying on vim.
Its calculations are off when text annotations are present:
- https://github.com/vim/vim/issues/5930
- https://github.com/vim/vim/issues/3718 (fixed, but vim 8.1 is still common)

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[CodeGen] only add nobuiltin to inline builtins if we'll emit them
George Burgess IV [Wed, 15 Apr 2020 18:05:22 +0000 (11:05 -0700)]
[CodeGen] only add nobuiltin to inline builtins if we'll emit them

There are some inline builtin definitions that we can't emit
(isTriviallyRecursive & callers go into why). Marking these
nobuiltin is only useful if we actually emit the body, so don't mark
these as such unless we _do_ plan on emitting that.

This suboptimality was encountered in Linux (see some discussion on
D71082, and https://github.com/ClangBuiltLinux/linux/issues/979).

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

4 years agoRemove an apparently unneeded normcase() call.
Nico Weber [Wed, 15 Apr 2020 18:02:01 +0000 (14:02 -0400)]
Remove an apparently unneeded normcase() call.

I believe this call is unneeded after https://reviews.llvm.org/D34855.

Reviewed as part of https://reviews.llvm.org/D78169

4 years ago[MC] Use subclass data for MCExpr to reduce memory usage
Nikita Popov [Fri, 10 Apr 2020 20:06:12 +0000 (22:06 +0200)]
[MC] Use subclass data for MCExpr to reduce memory usage

MCExpr has a bunch of free space that is currently going to waste.
Repurpose it as 24 bits of subclass data, which is enough to reduce
the size of all subclasses by 8 bytes. This gives us some respectable
savings for debuginfo builds. Here are the max-rss reductions for the
fat LTO link step:

    kc.link               238MiB   231MiB   (-2.82%)
    sqlite3.link          258MiB   250MiB   (-3.27%)
    consumer-typeset.link 152MiB   148MiB   (-2.51%)
    bullet.link           197MiB   192MiB   (-2.30%)
    tramp3d-v4.link       578MiB   567MiB   (-1.92%)
    pairlocalalign.link    92MiB    90MiB   (-1.98%)
    clamscan.link         230MiB   223MiB   (-2.81%)
    lencod.link           242MiB   235MiB   (-2.67%)
    SPASS.link            235MiB   230MiB   (-2.23%)
    7zip-benchmark.link   450MiB   435MiB   (-3.25%)

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

4 years ago[X86] Various improvements to our vector splitting helpers for lowering. NFC
Craig Topper [Wed, 15 Apr 2020 17:04:18 +0000 (10:04 -0700)]
[X86] Various improvements to our vector splitting helpers for lowering. NFC

-Consistently name the functions as split*
-Add a helper for doing the two extractSubvector calls and determining the size of the split
-Use getSplitDestVTs to get the result type for the split node.
-Move the binary and unary helper to one place in the file near the extractSubvector functions. Left the VSETCC one near LowerVSETCC since that's its only caller.
-Remove the 256/512 wrappers that just had asserts. I don't think they provided a lot of value and now with the routines called split* the call sites are more obvious what they do.
-Make the unary routine support different source and dest types to support D76212.
-Add some weaker asserts into the helpers to make up for losing the very specific asserts from the 256/512 wrappers.

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

4 years ago[lldb/Scripts] Add script to replay multiple reproducers
Jonas Devlieghere [Wed, 15 Apr 2020 17:24:34 +0000 (10:24 -0700)]
[lldb/Scripts] Add script to replay multiple reproducers

Script to replay reproducers in parallel using the command line driver.
This is used for active replay (stage 1 as described in the RFC on
lldb-dev [1]).

[1] http://lists.llvm.org/pipermail/lldb-dev/2020-April/016100.html

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

4 years agoWrite ignored output to stdout, so this test runs on read-only filesystems.
Sterling Augustine [Wed, 15 Apr 2020 17:42:52 +0000 (10:42 -0700)]
Write ignored output to stdout, so this test runs on read-only filesystems.

4 years agoTry to fix clang-tidy/infrastructure/config-files.cpp on Win after cb1ee34e9d32fc.
Nico Weber [Wed, 15 Apr 2020 17:37:22 +0000 (13:37 -0400)]
Try to fix clang-tidy/infrastructure/config-files.cpp on Win after cb1ee34e9d32fc.

See also r267736.

4 years ago[GlobalISel] Enable artifact combiner to combine starting from a G_MERGE_VALUES.
Amara Emerson [Sat, 11 Apr 2020 05:39:49 +0000 (22:39 -0700)]
[GlobalISel] Enable artifact combiner to combine starting from a G_MERGE_VALUES.

We generally only combine starting from users to defs in the artifact combiner,
but this doesn't catch cases where at the point of combining a G_UNMERGE we don't
yet have the opposite G_MERGE on input yet since we haven't legalized that far.

This change adds the users of a G_MERGE to the artifact combiner worklist if one
of the uses is a G_UNMERGE or G_TRUNC.

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

4 years ago[CallSite removal][PruneEH] Use CallBase instead of CallSite. NFC
Craig Topper [Wed, 15 Apr 2020 05:04:35 +0000 (22:04 -0700)]
[CallSite removal][PruneEH] Use CallBase instead of CallSite. NFC

Reviewers: mtrofin, dblaikie

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Remove the need for the %{build_module} substitution
Louis Dionne [Wed, 15 Apr 2020 16:58:00 +0000 (12:58 -0400)]
[libc++] Remove the need for the %{build_module} substitution

Instead of using .sh.cpp tests for the modules tests, use .compile.pass.cpp
and add the -fmodules additional flag.

4 years agoRevert "[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast"
Dominik Montada [Wed, 15 Apr 2020 16:47:39 +0000 (18:47 +0200)]
Revert "[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast"

This reverts commit bddac41b9f1ae80b56dace7d55cd81a07147ff3d.

4 years ago[libc++] NFC: Remove the %{compile} substitution, which is not used anymore
Louis Dionne [Wed, 15 Apr 2020 16:26:55 +0000 (12:26 -0400)]
[libc++] NFC: Remove the %{compile} substitution, which is not used anymore

4 years ago[libc++] Split up tests for <stdint.h> on AIX and make them AIX-independent
Louis Dionne [Wed, 15 Apr 2020 16:23:11 +0000 (12:23 -0400)]
[libc++] Split up tests for <stdint.h> on AIX and make them AIX-independent

Avoid using <sys/types.h> in those tests so that we can run them on
non-AIX systems (otherwise this test is basically dead-code on all
the build bots I'm aware of). Also, split up the test to allow using
.compile.pass.cpp tests instead of .sh.cpp tests, since that is the
last test referencing the %{compile} substitution explicitly.

4 years ago[mlir] [EDSC] Add interface for yield-for loops.
Pierre Oechsel [Wed, 15 Apr 2020 16:31:22 +0000 (18:31 +0200)]
[mlir] [EDSC] Add interface for yield-for loops.

Summary:
ModelBuilder was missing an api to easily generate yield-for-loops.
This diffs implements an interface allowing to write:
```
%2:2 = loop.for %i = %start to %end step %step iter_args(%arg0 = %init0, %arg1 = %init1) -> (f32, f32) {
  %sum = addf %arg0, %arg1 : f32
  loop.yield %arg1, %sum : f32, f32
}
%3 = addf %2#0, %2#1 : f32
```

as

```
auto results =
    LoopNestBuilder(&i, start, end, step, {&arg0, &arg1},  {init0, init1})([&] {
      auto sum = arg0 + arg1;
      loop_yield(ArrayRef<ValueHandle>{arg1, sum});
    });

// Add the two values accumulated by the yield-for-loop:
ValueHandle(results[0]) + ValueHandle(results[1]);
```

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

4 years ago[libc++] Move some .sh.cpp tests to .compile.pass.cpp
Louis Dionne [Wed, 15 Apr 2020 16:08:05 +0000 (12:08 -0400)]
[libc++] Move some .sh.cpp tests to .compile.pass.cpp

As a fly-by fix, improve/fix the comments explaining the tests. This is
a step towards removing references to the %{compile} substitution.

4 years ago[libc++] Move aligned allocation tests to .verify.cpp
Louis Dionne [Wed, 15 Apr 2020 16:00:52 +0000 (12:00 -0400)]
[libc++] Move aligned allocation tests to .verify.cpp

Instead of being ShTests that use clang-verify (and without the proper
REQUIRES annotation), create .verify.cpp tests instead with the right
REQUIRES annotation.

4 years agoRemove a function that has been dead since r313889.
Nico Weber [Wed, 15 Apr 2020 16:01:58 +0000 (12:01 -0400)]
Remove a function that has been dead since r313889.

4 years ago[ASTImporter] Add support for importing fixed point literals
Vince Bridgers [Mon, 6 Apr 2020 13:22:35 +0000 (08:22 -0500)]
[ASTImporter] Add support for importing fixed point literals

Summary:
This patch adds support for importing fixed point literals, following
up to https://reviews.llvm.org/D46915 specifically for importing AST.

Reviewers: martong, leonardchan, ebevhan, a.sidorin, shafik

Reviewed By: martong

Subscribers: balazske, rnkovacs, teemperor, cfe-commits

Tags: #clang

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

4 years ago[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast
Dominik Montada [Wed, 15 Apr 2020 08:06:13 +0000 (10:06 +0200)]
[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast

Summary:
The combine for unmerge(cast(merge)) is only valid for vectors, but was
missing a corresponding check. Add a check that the operands are vectors
to avoid an invalid combine.

Without this check, the combiner would emit incorrect code for scalars
and pointers because the artifact cast (trunc/ext) only affects bits at
the end of the type, while this combine assumes that the casted bits
appear between meaningful bits.

This also uncovered a segmentation fault in the AMDGPU
InstructionSelector. The tests triggering this bug have been moved to
their own file and a check for the segmentation fault has been added.

Reviewers: arsenm, dsanders, aemerson, paquette, aditya_nandakumar

Reviewed By: arsenm

Subscribers: tpr, jvesely, wdng, nhaehnle, rovka, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[TimeProfiler] Fix some style issues. NFC
Fangrui Song [Tue, 14 Apr 2020 20:42:00 +0000 (13:42 -0700)]
[TimeProfiler] Fix some style issues. NFC

Reviewed By: broadwaylamb, russell.gallop

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

4 years ago[ELF] Refactor the way we handle -plugin-opt= (GCC collect2 or clang LTO related...
Fangrui Song [Tue, 14 Apr 2020 21:17:29 +0000 (14:17 -0700)]
[ELF] Refactor the way we handle -plugin-opt= (GCC collect2 or clang LTO related options)

GCC collect2 passes several options to the linker even if LTO is not used
(note, lld does not support GCC LTO). The lto-wrapper may be a relative
path (especially during development, when gcc is in a build directory), e.g.

  -plugin-opt=relative/path/to/lto-wrapper

We need to ignore such options, which are currently interpreted by
cl::ParseCommandLineOptions() and will fail with `error: --plugin-opt: ld.lld: Unknown command line argument 'relative/path/to/lto-wrapper'`
because the path is apparently not an option registered by an `llvm::cl::opt`.

See lto-plugin-ignore.s for how we interpret various -plugin-opt= options now.

Reviewed By: grimar, tejohnson

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

4 years ago[libc++] Remove workaround for .fail.cpp tests that don't have clang-verify markup
Louis Dionne [Tue, 14 Apr 2020 17:00:53 +0000 (13:00 -0400)]
[libc++] Remove workaround for .fail.cpp tests that don't have clang-verify markup

By renaming .fail.cpp tests that don't need clang-verify to .compile.fail.cpp,
the new test format will not try to compile these tests with clang-verify,
and the old test format will work just the same. However, this allows
removing a workaround that requires parsing each test looking for
clang-verify markup.

After this change, a .fail.cpp test should always have clang-verify markup.
When clang-verify is not supported by the compiler, we will just check that
these tests fail to compile. When clang-verify is supported, these tests
will be compiled with clang-verify whether they have markup or not (so
they should have markup, or they will fail).

This simplifies the test suite and also ensures that all of our .fail.cpp
tests provide clang-verify markup. If it's impossible for a test to have
clang-verify markup, it can be moved to a .compile.fail.cpp test, which
are unconditionally just checked for compilation failure.

4 years ago[GlobalISel] translate freeze to new generic G_FREEZE
Dominik Montada [Thu, 9 Apr 2020 12:33:59 +0000 (14:33 +0200)]
[GlobalISel] translate freeze to new generic G_FREEZE

Summary:
As a follow up to https://reviews.llvm.org/D29014, add translation
support for freeze.

Introduce a new generic instruction G_FREEZE and translate freeze to it.

Reviewers: dsanders, aqjune, arsenm, aditya_nandakumar, t.p.northover, lebedev.ri, paquette, aemerson

Reviewed By: aqjune, arsenm

Subscribers: fhahn, lebedev.ri, wdng, rovka, hiraditya, jfb, volkan, llvm-commits

Tags: #llvm

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

4 years ago[www] Update make_cxx_dr_status for v10; regenerate cxx_dr_status.html
Hubert Tong [Wed, 15 Apr 2020 14:33:35 +0000 (10:33 -0400)]
[www] Update make_cxx_dr_status for v10; regenerate cxx_dr_status.html

Summary: Update `latest_release` to reflect the release of Clang 10.

Reviewed By: rsmith

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

4 years ago[DSE,MSSA] Add use of alloca, to guard against removal in the future.
Florian Hahn [Wed, 15 Apr 2020 14:21:30 +0000 (15:21 +0100)]
[DSE,MSSA] Add use of alloca, to guard against removal in the future.

Currently the alloca does not escape and all stores and the memset can
be removed. Adding a use of the alloca ensures not all stores are
eliminated.

4 years ago[AST] Fix recovery-expr crash on invalid aligned attr.
Haojian Wu [Sun, 12 Apr 2020 21:06:00 +0000 (23:06 +0200)]
[AST] Fix recovery-expr crash on invalid aligned attr.

Summary:
crash stack:

```
lang: tools/clang/include/clang/AST/AttrImpl.inc:1490: unsigned int clang::AlignedAttr::getAlignment(clang::ASTContext &) const: Assertion `!isAlignmentDependent()' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ./bin/clang -cc1 -std=c++1y -ast-dump -frecovery-ast -fcxx-exceptions /tmp/t4.cpp
1.      /tmp/t4.cpp:3:31: current parser token ';'
 #0 0x0000000002530cff llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13
 #1 0x000000000252ee30 llvm::sys::RunSignalHandlers() llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x000000000253126c SignalHandler(int) llvm-project/llvm/lib/Support/Unix/Signals.inc:396:3
 #3 0x00007f86964d0520 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x13520)
 #4 0x00007f8695f9ff61 raise /build/glibc-oCLvUT/glibc-2.29/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f8695f8b535 abort /build/glibc-oCLvUT/glibc-2.29/stdlib/abort.c:81:7
 #6 0x00007f8695f8b40f _nl_load_domain /build/glibc-oCLvUT/glibc-2.29/intl/loadmsgcat.c:1177:9
 #7 0x00007f8695f98b92 (/lib/x86_64-linux-gnu/libc.so.6+0x32b92)
 #8 0x0000000004503d9f llvm::APInt::getZExtValue() const llvm-project/llvm/include/llvm/ADT/APInt.h:1623:5
 #9 0x0000000004503d9f clang::AlignedAttr::getAlignment(clang::ASTContext&) const llvm-project/build/tools/clang/include/clang/AST/AttrImpl.inc:1492:0
```

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[XCOFF][AIX] Relocation support for SymB
jasonliu [Wed, 15 Apr 2020 14:00:34 +0000 (14:00 +0000)]
[XCOFF][AIX] Relocation support for SymB

This patch intends to provide relocation support for the expression
 contains two unpaired relocatable terms with opposite signs.

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

4 years ago[demangler] PPC and S390: Fix parsing of e-prefixed long double literals
Xing Xue [Wed, 15 Apr 2020 13:59:06 +0000 (09:59 -0400)]
[demangler] PPC and S390: Fix parsing of e-prefixed long double literals

Summary:
This patch is to fix the parsing of long double literals encoded with the e prefix on PowerPC and S390. For both PowerPC and S390, type code e is used for 64-bit long double literals and g is used for 128-bit long double literals. libcxxabi test case test_demangle.pass.cpp fails without the fix.

Authored by: xingxue-ibm

Reviewers: hubert.reinterpretcast, jasonliu, erik.pilkington, uweigand, mclow.li
sts, libc++abi

Reviewed by: hubert.reinterpretcast, erik.pilkington

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

4 years ago[FileCheck] - Refine the comment. NFC.
Georgii Rymar [Wed, 15 Apr 2020 13:55:48 +0000 (16:55 +0300)]
[FileCheck] - Refine the comment. NFC.

It did not mention the `--implicit-check-not` before,
though it should (https://reviews.llvm.org/D78024#inline-715166).

4 years agoUnbreak the build
Benjamin Kramer [Wed, 15 Apr 2020 13:54:47 +0000 (15:54 +0200)]
Unbreak the build

4 years agoPass shufflevector indices as int instead of unsigned.
Benjamin Kramer [Wed, 15 Apr 2020 13:52:26 +0000 (15:52 +0200)]
Pass shufflevector indices as int instead of unsigned.

No functionality change intended.

4 years ago[clang-tidy] Optional inheritance of file configs from parent directories 
Dmitry Polukhin [Wed, 1 Apr 2020 09:08:53 +0000 (02:08 -0700)]
[clang-tidy] Optional inheritance of file configs from parent directories 

Summary:
Without this patch clang-tidy stops finding file configs on the nearest
.clang-tidy file. In some cases it is not very convenient because it
results in common parts duplication into every child .clang-tidy file.
This diff adds optional config inheritance from the parent directories
config files.

Test Plan:

Added test cases in existing config test.

Reviewers: alexfh, gribozavr2, klimek, hokein

Subscribers: njames93, arphaman, xazax.hun, aheejin, cfe-commits

Tags: #clang, #clang-tools-extra

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

4 years ago[CodeGen][ARM] Error when writing to specific reserved registers in inline asm
Victor Campos [Wed, 25 Mar 2020 10:52:43 +0000 (10:52 +0000)]
[CodeGen][ARM] Error when writing to specific reserved registers in inline asm

Summary:
No error or warning is emitted when specific reserved registers are
written to in inline assembly. Therefore, writes to the program counter
or to the frame pointer, for instance, were permitted, which could have
led to undesirable behaviour.

Example:
  int foo() {
    register int a __asm__("r7"); // r7 = frame-pointer in M-class ARM
    __asm__ __volatile__("mov %0, r1" : "=r"(a) : : );
    return a;
  }

In contrast, GCC issues an error in the same scenario.

This patch detects writes to specific reserved registers in inline
assembly for ARM and emits an error in such case. The detection works
for output and input operands. Clobber operands are not handled here:
they are already covered at a later point in
AsmPrinter::emitInlineAsm(const MachineInstr *MI). The registers
covered are: program counter, frame pointer and base pointer.

This is ARM only. Therefore the implementation of other targets'
counterparts remain open to do.

Reviewers: efriedma

Reviewed By: efriedma

Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] prevent infinite loop with sub/abs of constant expression
Sanjay Patel [Wed, 15 Apr 2020 13:11:44 +0000 (09:11 -0400)]
[InstCombine] prevent infinite loop with sub/abs of constant expression

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

4 years agoclang/AMDGPU: Assume denormals are enabled for the default target.
Matt Arsenault [Mon, 13 Apr 2020 13:15:48 +0000 (09:15 -0400)]
clang/AMDGPU: Assume denormals are enabled for the default target.

Since the default logic was based on having fast denormal/fma
features, and the default target has no features, we assumed flushing
by default. This fixes incorrectly assuming flushing in builds for
"generic" IR libraries.

The handling for no specified --cuda-gpu-arch in HIP is kind of
broken. Somewhere else forces a default target of gfx803, which does
not enable denormal handling by default. We don't see this default
switching here, so you'll end up with a different denormal mode
depending on whether you explicitly requested gfx803, or used it by
default.

4 years agoRevert "[nfc] [lldb] Introduce DWARF callbacks"
Jan Kratochvil [Wed, 15 Apr 2020 13:12:59 +0000 (15:12 +0200)]
Revert "[nfc] [lldb] Introduce DWARF callbacks"

This reverts commit bd47c470d13b1c57ecf37c1faf0324833d3a4542.

It broke Green Dragon, reason is unknown to me so far:
  http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/15323/consoleFull

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

4 years agoAMDGPU/GlobalISel: Add some artifact combiner tests
Matt Arsenault [Wed, 15 Apr 2020 13:02:07 +0000 (09:02 -0400)]
AMDGPU/GlobalISel: Add some artifact combiner tests

4 years ago[FileCheck] Better diagnostic for format conflict
Thomas Preud'homme [Sat, 4 Apr 2020 00:02:45 +0000 (01:02 +0100)]
[FileCheck] Better diagnostic for format conflict

Summary:
Improve error message in case of conflict between several implicit
format to mention the operand that conflict.

Reviewers: jhenderson, jdenny, probinson, grimar, arichardson, rnk

Reviewed By: jdenny

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[nfc] clang-format TargetTransformInfo.cpp
Simon Moll [Wed, 15 Apr 2020 12:43:26 +0000 (14:43 +0200)]
[nfc] clang-format TargetTransformInfo.cpp

4 years agoUpgrade users of 'new ShuffleVectorInst' to pass indices as an int array
Benjamin Kramer [Wed, 15 Apr 2020 12:29:09 +0000 (14:29 +0200)]
Upgrade users of 'new ShuffleVectorInst' to pass indices as an int array

No functionality change intended.

4 years ago[flang] Add return statement to Logical opeator=.
David Truby [Wed, 15 Apr 2020 11:55:42 +0000 (12:55 +0100)]
[flang] Add return statement to Logical opeator=.

This removes the current undefined behavior where the function has a return type
but no return statement.

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

4 years ago[nfc] clang-format TargetTransformInfoImpl.h
Simon Moll [Wed, 15 Apr 2020 12:01:31 +0000 (14:01 +0200)]
[nfc] clang-format TargetTransformInfoImpl.h

4 years ago[nfc] clang-format TargetTransformInfo.h
Simon Moll [Wed, 15 Apr 2020 12:00:07 +0000 (14:00 +0200)]
[nfc] clang-format TargetTransformInfo.h

4 years ago[Statepoint] Add getters to StatepointOpers.
Denis Antrushin [Tue, 14 Apr 2020 15:30:51 +0000 (18:30 +0300)]
[Statepoint] Add getters to StatepointOpers.

To simplify future work on statepoint representation, hide
direct access to statepoint field indices and provide getters
for them. Add getters for couple more statepoint fields.

This also fixes two bugs in MachineVerifier for statepoint:
First, the `break` statement was falling out of `if` statement
scope, thus disabling following checks.
Second, it was incorrectly accessing some fields like CallingConv -
StatepointOpers gives index to their value directly, not to
preceeding field type encoding.

Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D78119

4 years ago[dexp] NFC: Change positional argument format
Kirill Bobyrev [Wed, 15 Apr 2020 11:27:30 +0000 (13:27 +0200)]
[dexp] NFC: Change positional argument format

Summary:
Before:

  USAGE: dexp [options] --index-path Path to the index

After:

  USAGE: dexp [options] <INDEX FILE>

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years ago[VPlan] Branches are not widened by VPWidenRecipe, assert (NFC).
Florian Hahn [Tue, 14 Apr 2020 08:36:16 +0000 (09:36 +0100)]
[VPlan] Branches are not widened by VPWidenRecipe, assert (NFC).

4 years ago[SystemZ] Bugfix in adjustSubwordCmp()
Jonas Paulsson [Wed, 15 Apr 2020 09:29:55 +0000 (11:29 +0200)]
[SystemZ] Bugfix in adjustSubwordCmp()

adjustSubwordCmp() should not optimize a load of an i1 value. This is
achieved by checking that the size and store-size of the MemoryVT are the
same.

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

Review: Ulrich Weigand

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

4 years ago[CostModel][X86] Regenerate load_store.ll costs tests
Simon Pilgrim [Wed, 15 Apr 2020 10:54:22 +0000 (11:54 +0100)]
[CostModel][X86] Regenerate load_store.ll costs tests
Add SSE + AVX512 targets
Add some illegal type store tests

4 years agoUpgrade calls to CreateShuffleVector to use the preferred form of passing an array...
Benjamin Kramer [Wed, 15 Apr 2020 10:41:54 +0000 (12:41 +0200)]
Upgrade calls to CreateShuffleVector to use the preferred form of passing an array of ints

No functionality change intended.

4 years ago[VPlan] Move widening check for non-memory/non-calls to function (NFC).
Florian Hahn [Wed, 15 Apr 2020 10:41:13 +0000 (11:41 +0100)]
[VPlan] Move widening check for non-memory/non-calls to function (NFC).

After introducing VPWidenSelectRecipe, the duplicated logic can be
shared.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[lldb] Fix -Wparentheses in ThreadPlanStack.cpp
Pavel Labath [Wed, 15 Apr 2020 10:40:12 +0000 (12:40 +0200)]
[lldb] Fix -Wparentheses in ThreadPlanStack.cpp

4 years agoFix DWARFDataExtractor::getRelocatedValue near EOF
Pavel Labath [Tue, 14 Apr 2020 15:06:04 +0000 (17:06 +0200)]
Fix DWARFDataExtractor::getRelocatedValue near EOF

Summary:
If we have an (invalid) relocation which relocates bytes which partially
lie outside the range of the relocated section, the getRelocatedValue
would return confusing results. It would first read zero (because that's
what the underlying DataExtractor api does for out-of-bounds reads), and
then relocate that zero anyway.

A more appropriate behavior is to return zero straight away. This is
what this patch does.

Reviewers: dblaikie, jhenderson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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