2 years ago[COFF] Dump string table size for COFF file headers
Reid Kleckner [Wed, 6 May 2020 22:36:18 +0000 (15:36 -0700)]
[COFF] Dump string table size for COFF file headers

I couldn't find this info in any other dumper, so it might as well be

2 years ago[NFC] Improve doc string to mention that paths in diff are used as-is
Christopher Tetreault [Wed, 6 May 2020 22:19:51 +0000 (15:19 -0700)]
[NFC] Improve doc string to mention that paths in diff are used as-is

Add --relative to the suggested git-diff one liner. If the user does not
pass this argument, then git will produce a diff with the path relative
to the repository root. If the user's working directory is not the
repository root, then clang-format will complain that the file is not
found. The --relative argument makes git produce a diff with the files
relative to the working directory.

Add note to doc string to warn users about the fact that filenames
embedded in the diff are used as-is with no attempts to "do what they
mean, not what they say"

Reviewers: djasper, alexfh, efriedma, klimek, thakis

Reviewed By: efriedma

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[flang][NFC] Replace "align" with "alignment"
Tim Keith [Wed, 6 May 2020 22:00:14 +0000 (15:00 -0700)]
[flang][NFC] Replace "align" with "alignment"

In the places it is used as a noun, replace "align" with "alignment".

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

2 years ago[flang] Response to Steve Scalpone's suggestion to improve a message
Pete Steinfeld [Wed, 6 May 2020 19:23:05 +0000 (12:23 -0700)]
[flang] Response to Steve Scalpone's suggestion to improve a message

Summary: I updated the code that produces the message and the associated test.

Reviewers: sscalpone, DavidTruby, kiranchandramohan

Subscribers: llvm-commits

Tags: #llvm

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

2 years ago[X86] Remove support for Y0 constraint as an alias for Yz in inline assembly.
Craig Topper [Wed, 6 May 2020 21:53:10 +0000 (14:53 -0700)]
[X86] Remove support for Y0 constraint as an alias for Yz in inline assembly.

Neither gcc or icc support this. Split out from D79472. I want
to remove more, but it looks like icc does support some things
gcc doesn't and I need to double check our internal test suites.

2 years ago[lldb/Test] Run dotest.py with the Python LLDB was built with.
Jonas Devlieghere [Wed, 6 May 2020 21:33:34 +0000 (14:33 -0700)]
[lldb/Test] Run dotest.py with the Python LLDB was built with.

The Python used to run lit can be different from the Python LLDB was
build with. One scenario where this happens is when LLVM can find the
Python 3 interpreter, but not the Python 3 libraries, in which case LLDB
build and links against Python 3. Without this change, you end up with
an ModuleNotFoundError because of the mismatch.

Instead of looking at the Python interpreter that's used to run lit,
lldbtest should use the interpreter that matches the Python version LLDB
was build against.

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

2 years ago[LoopUnrollAndJam] Changed safety checks to consider more than 2-levels
Whitney Tsang [Wed, 6 May 2020 21:42:47 +0000 (21:42 +0000)]
[LoopUnrollAndJam] Changed safety checks to consider more than 2-levels
loop nest.

Summary: As discussed in https://reviews.llvm.org/D73129.

Before unroll and jam:

After unroll and jam (currently):

After unroll and jam (Ideal):

This is the first patch to change unroll and jam to work in the ideal
This patch change the safety checks needed to make sure is safe to
unroll and jam in the ideal way.

Reviewer: dmgreen, jdoerfert, Meinersbur, kbarton, bmahjour, etiotto
Reviewed By: Meinersbur
Subscribers: fhahn, hiraditya, zzheng, llvm-commits, anhtuyen, prithayan
Differential Revision: https://reviews.llvm.org/D76132

2 years ago[CUDA] Enable existing builtins for PTX7.0 as well.
Artem Belevich [Wed, 6 May 2020 19:26:55 +0000 (12:26 -0700)]
[CUDA] Enable existing builtins for PTX7.0 as well.

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

2 years ago[X86] Remove incomplete support for 'Y' has an inline assembly constraint by itself.
Craig Topper [Wed, 6 May 2020 21:20:45 +0000 (14:20 -0700)]
[X86] Remove incomplete support for 'Y' has an inline assembly constraint by itself.

Y is the start of several 2 letter constraints, but we also had
partial support to recognize it by itself. But it doesn't look
like it can get through clang as a single letter so the backend
support for this was effectively dead.

2 years ago[libc] Reorganize and clarify a few points around benchmarking
Eric Christopher [Tue, 5 May 2020 21:02:10 +0000 (14:02 -0700)]
[libc] Reorganize and clarify a few points around benchmarking

A few documentation clarifications and moving one part of the
docs around to be closer to the first mention of display so that
it's easier to spot based on some user feedback.

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

2 years agoMove the Xcode SDK path caching to HostInfo
Adrian Prantl [Mon, 4 May 2020 20:52:10 +0000 (13:52 -0700)]
Move the Xcode SDK path caching to HostInfo

When debugging a remote platform, the platform you get from
GetPlatformForArchitecture doesn't inherit from PlatformDarwin.
HostInfoMacOSX seems like the right place to have a global store of
local paths.

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

2 years agoWhen pragma FENV_ACCESS is ignored do not modify Sema.CurFPFeatures
Melanie Blower [Wed, 6 May 2020 18:45:55 +0000 (11:45 -0700)]
When pragma FENV_ACCESS is ignored do not modify Sema.CurFPFeatures
Bug reported by @uabelho against reviews.llvm.org/D72841

Reviewers: rjmccall

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

2 years agoAdd an explicit API to read the Xcode SDK DWARF attribute from compile units
Adrian Prantl [Fri, 1 May 2020 22:50:53 +0000 (15:50 -0700)]
Add an explicit API to read the Xcode SDK DWARF attribute from compile units

When debugging from a SymbolMap the creation of CompileUnits for the
individual object files is so lazy that RegisterXcodeSDK() is not
invoked at all before the Swift TypeSystem wants to read it. This
patch fixes this by introducing an explicit
SymbolFile::ParseXcodeSDK() call that can be invoked deterministically
before the result is required.



2 years agoRevert "[libc++] [test] Generate static_test_env on the fly"
Sergej Jaskiewicz [Wed, 6 May 2020 20:11:24 +0000 (23:11 +0300)]
Revert "[libc++] [test] Generate static_test_env on the fly"

This reverts commit 52cc8bac7780dbfb90dcc8cfe24696618eeaa06e.

As the discussion in https://reviews.llvm.org/D78200 continues, I will
revert this until we figure out what to do.

2 years ago[CodeGen][ObjC] Don't try to retain a __unsafe_unretained ARC pointer
Akira Hatanaka [Wed, 6 May 2020 19:28:36 +0000 (12:28 -0700)]
[CodeGen][ObjC] Don't try to retain a __unsafe_unretained ARC pointer
passed to __builtin_os_log_format to extend its lifetime to the end of
its enclosing block

Extend only lifetimes of pointers returned by function calls or message
sends instead. In the long term, we should lifetime-extend pointers in
more complex expressions and non-ARC objects (e.g., C++ temporaries)


2 years ago[lld][WebAssembly] Honor --allow-undefined for data symbols too
Sam Clegg [Fri, 1 May 2020 17:00:53 +0000 (10:00 -0700)]
[lld][WebAssembly] Honor --allow-undefined for data symbols too

This was originally the way this worked before before

In retrospect it seems inconsistent that `--allow-undefined` doesn't
work for all symbols.  See:

I'm also planning a followup change which implement the full
`--unresolved-symbols=..` flags supported by ELF linkers (both ld and
ld.lld) since it seems more standard.

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

2 years ago[flang] Response to Steve Scalpone's suggestion to improve a message
Pete Steinfeld [Wed, 6 May 2020 19:23:05 +0000 (12:23 -0700)]
[flang] Response to Steve Scalpone's suggestion to improve a message

Summary: I updated the code that produces the message and the associated test.

Reviewers: sscalpone, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

2 years agoRevert "[Debug][CodeView] Emit fully qualified names for globals"
Alexandre Ganea [Wed, 6 May 2020 19:23:00 +0000 (15:23 -0400)]
Revert "[Debug][CodeView] Emit fully qualified names for globals"

This reverts commit 06591b6d191ad3582d21a801cbaf56b36714cae7.

2 years ago[LLD][COFF] Move debug info for thread-local variables into PDB global stream
Alexandre Ganea [Wed, 6 May 2020 19:20:24 +0000 (15:20 -0400)]
[LLD][COFF] Move debug info for thread-local variables into PDB global stream

Before this patch, the debug record S_GTHREAD32 which represents global thread_local symbols, was emitted by LLD into the respective module stream. This makes Visual Studio unable to display thread_local symbols in the debugger.

After this patch, S_GTHREAD32 is moved into the globals stream. This matches MSVC behavior.

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

2 years ago[flang][NFC] Add accessors to equivalence and common blocks
Tim Keith [Wed, 6 May 2020 19:20:07 +0000 (12:20 -0700)]
[flang][NFC] Add accessors to equivalence and common blocks

Add a way to get mutable equivalence sets to Scope so that they can
have sizes and offsets assigned to them.

Change CommonBlockDetails to have mutable symbols so that they can have
sizes and offets assigned to them. This also allows the removal of some

Add MutableSymbolRef and MutableSymbolVector as mutable analogs to
SymbolRef and SymbolVector. Replace uses of equivalent types with those

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

2 years ago[SystemZ] Fix/optimize vec_load_len and related intrinsics
Ulrich Weigand [Wed, 6 May 2020 18:42:46 +0000 (20:42 +0200)]
[SystemZ] Fix/optimize vec_load_len and related intrinsics

When using vec_load/store_len_r with an immediate length operand
of 16 or larger, LLVM will currently emit an VLRL/VSTRL instruction
with that immediate.  This creates a valid encoding (which should be
supported by the assembler), but always traps at runtime.  This patch
fixes this by not creating VLRL/VSTRL in those cases.

This would result in loading the length into a register and
calling VLRLR/VSTRLR instead.  However, these operations with
a length of 15 or larger are in fact simply equivalent to a
full vector load or store.  And in fact the same holds true for
vec_load/store_len as well.

Therefore, add a DAGCombine rule to replace those operations with
plain vector loads or stores if the length is known at compile
time and equal or larger to 15.

2 years agoclang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens
Daan De Meyer [Sun, 26 Apr 2020 12:04:45 +0000 (14:04 +0200)]
clang-format: Add ControlStatementsExceptForEachMacros option to SpaceBeforeParens

Summary: systemd recently added a clang-format file. One issue I
encountered in using clang-format on systemd is that systemd does
not add a space before the parens of their foreach macros but
clang-format always adds a space. This does not seem to be
configurable in clang-format. This revision adds the
ControlStatementsExceptForEachMacros option to SpaceBeforeParens
which puts a space before all control statement parens except
ForEach macros. This drastically reduces the amount of changes
when running clang-format on systemd's source code.

Reviewers: MyDeveloperDay, krasimir, mitchell-stellar

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

2 years ago[SelectionDAG] Fix assertion failure with big shift amounts
LemonBoy [Wed, 6 May 2020 18:39:23 +0000 (11:39 -0700)]
[SelectionDAG] Fix assertion failure with big shift amounts

Calling getShiftAmountTy with LegalTypes set may return a type that's too narrow to hold the shift amount for integer type it's applied to.

Fixes the regression introduced by D79096

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

2 years ago[MLIR][NFC] Rename op trait PolyhedralScope -> AffineScope
Uday Bondhugula [Wed, 6 May 2020 07:02:06 +0000 (12:32 +0530)]
[MLIR][NFC] Rename op trait PolyhedralScope -> AffineScope

Rename op trait PolyhedralScope -> AffineScope for consistency.

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

2 years ago[flang] Handle EQUIVALENCE and COMMON in size and offset computations
Tim Keith [Wed, 6 May 2020 18:43:06 +0000 (11:43 -0700)]
[flang] Handle EQUIVALENCE and COMMON in size and offset computations

Objects in common blocks have offsets relative to the start of the
common block, independent of the enclosing scope, so they are processed
first. Add alignment to CommonBlockDetails to record the required
alignment of the common block.

For equivalence sets, each object depends on the one that is forced to
occur first in memory. The rest are recorded in the dependents_ map and
have offsets assigned after the other symbols are done.

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

2 years ago[mlir] OperationFolder: fix crash in creation of single-result-ops with in-place...
Alex Zinenko [Wed, 6 May 2020 15:39:23 +0000 (17:39 +0200)]
[mlir] OperationFolder: fix crash in creation of single-result-ops with in-place folds

When the folding is performed in place, the `::fold` function does not populate
its `results` argument to indicate that. (In the folding hook for single-result
operations, the result of the original operation is expected to be returned,
but it is then ignored by the wrapper.) `OperationFolder::create` would
erronously rely on the _operation_ having zero results instead of on the
_folding_ producing zero new results to populate the list of results with those
of the original operation. This would lead to a crash for single-result ops
with in-place folds where the first result is accessed uncondtionally because
the list of results was not properly populated. Use the list of values produced
by the folding instead.

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

2 years ago[x86] add test of shift+cast+concat for PR45794; NFC
Sanjay Patel [Wed, 6 May 2020 18:14:40 +0000 (14:14 -0400)]
[x86] add test of shift+cast+concat for PR45794; NFC

Depends on D79360 / rG2f1fe1864d25 for the transform.

2 years ago[amdgpu] Fix check of VCC.
Michael Liao [Wed, 6 May 2020 06:23:34 +0000 (02:23 -0400)]
[amdgpu] Fix check of VCC.

Summary: - Need to include checking on the new 16-bit subregs.

Reviewers: rampitec

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

2 years ago[X86][AVX] Add PR45808 test case for badly promoted comparison mask arithmetic
Simon Pilgrim [Wed, 6 May 2020 18:05:42 +0000 (19:05 +0100)]
[X86][AVX] Add PR45808 test case for badly promoted comparison mask arithmetic

2 years agoRevert "Mark values as trivially dead when their only use is a start or end lifetime...
zoecarver [Wed, 6 May 2020 18:07:22 +0000 (11:07 -0700)]
Revert "Mark values as trivially dead when their only use is a start or end lifetime intrinsic."

This reverts commit 95aa28cc8fcbcb43a047779814a5be0abe54863b.

2 years agoMark values as trivially dead when their only use is a start or end lifetime intrinsic.
zoecarver [Wed, 6 May 2020 17:52:03 +0000 (10:52 -0700)]
Mark values as trivially dead when their only use is a start or end lifetime intrinsic.

If the only use of a value is a start or end lifetime intrinsic then mark the intrinsic as trivially dead. This should allow for that value to then be removed as well.

Currently, this only works for allocas, globals, and arguments.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[libc] Fix how math results are compared with MPFR results.
Siva Chandra Reddy [Thu, 30 Apr 2020 17:02:09 +0000 (10:02 -0700)]
[libc] Fix how math results are compared with MPFR results.

Math results are compared with MPFR results by checking if they are
within a tolerance level of the MPFR result. The tolerance level is set
using additional bits of precision of the fractional part of a floating
point value. Hence, the actual value of the tolerance depends on not
only the additional bits, but also on the exponent part of the floating
point number.

Previously, the exponent part was not considered in evaluating the
tolerance value. While it was OK for small values less than 1 (hence
sinf, cosf, sincosf tests were OK), it breaks for large values which
functions like exp and friends produce. This change uses the exponent
value also to evaluate the tolerance value. LLVM libc produced results
can now be compared with MPFR produced results for large values also.

Reviewers: abrachet

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

2 years agoFix ShapeBase.td
Sean Silva [Wed, 6 May 2020 17:37:07 +0000 (10:37 -0700)]
Fix ShapeBase.td

- Add license header.
- Remove TODO about extracting ShapeBase.td

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

2 years ago[X86] getShuffleScalarElt - add CONCAT_VECTORS/INSERT_VECTOR_ELT support.
Simon Pilgrim [Wed, 6 May 2020 17:13:17 +0000 (18:13 +0100)]
[X86] getShuffleScalarElt - add CONCAT_VECTORS/INSERT_VECTOR_ELT support.

This helped fix some i686 vXi64 broadcast folds that were becoming v2Xi32 broadcasts because we didn't match the broadcast until after SimplifyDemandedBits worked out we only used the bottom 32-bits in PMUL(U)DQ and type legalization had split the original i64 load.

A couple of regressions occurred which required some fixups - adding concat_vectors(broadcast_load,broadcast_load) splat support and recognising (unnecessary) unary shuffles of already broadcasted vectors.

This came about as part of the work investigating vector load combining from shuffles for PR42550.

2 years ago[X86] getShuffleScalarElt - consistently use SDValue. NFC.
Simon Pilgrim [Wed, 6 May 2020 15:02:48 +0000 (16:02 +0100)]
[X86] getShuffleScalarElt - consistently use SDValue. NFC.

We never need to call this from anything but ISD::SHUFFLE_VECTOR or target shuffles so shouldn't need to address SDNode directly.

2 years ago[InstCombine] limit bitcast+insertelement transform to x86 MMX type
Sanjay Patel [Wed, 6 May 2020 15:24:59 +0000 (11:24 -0400)]
[InstCombine] limit bitcast+insertelement transform to x86 MMX type

This is unusual for the general case because we are replacing
1 instruction with 2.

Splitting from a potential conflicting transform in D79171

2 years ago[Sema] Allow function attribute patchable_function_entry on aarch64_be
Fangrui Song [Wed, 6 May 2020 15:31:28 +0000 (08:31 -0700)]
[Sema] Allow function attribute patchable_function_entry on aarch64_be

Reviewed By: nickdesaulniers

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

2 years ago[SVE] Fix invalid uses of VectorType::getNumElements() in ValueTracking
Christopher Tetreault [Wed, 6 May 2020 16:53:57 +0000 (09:53 -0700)]
[SVE] Fix invalid uses of VectorType::getNumElements() in ValueTracking

Any function in this module that make use of DemandedElts laregely does
not work with scalable vectors. DemandedElts is used to define which
elements of the vector to look at. At best, for scalable vectors, we can
express the first N elements of the vector. However, in practice, most
code that uses these functions expect to be able to talk about the
entire vector. In principle, this module should be able to be extended
to work with scalable vectors. However, before we can do that, we should
ensure that it does not cause code with scalable vectors to miscompile.
All functions that use a DemandedElts will bail out if the vector is
scalable. Usages of getNumElements() are updated to go through
FixedVectorType pointers.

Reviewers: rengolin, efriedma, sdesmalen, c-rhodes, spatel

Reviewed By: efriedma

Subscribers: david-arm, tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

2 years ago[clangd] Reland 'Handle PresumedLocations in IncludeCollector'
Kadir Cetinkaya [Wed, 6 May 2020 14:20:31 +0000 (16:20 +0200)]
[clangd] Reland 'Handle PresumedLocations in IncludeCollector'

This will enable extraction of correct line locations in preamble patch
for includes.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

2 years agoInstCombine: Fix return after else
Matt Arsenault [Tue, 5 May 2020 15:47:43 +0000 (11:47 -0400)]
InstCombine: Fix return after else

2 years ago[libc++] Make sure the cin/wcin tests run on remote hosts
Louis Dionne [Wed, 6 May 2020 14:42:02 +0000 (10:42 -0400)]
[libc++] Make sure the cin/wcin tests run on remote hosts

When running on remote hosts, we need the whole `echo 123 | %t.exe` command
to run on the remote host. Thus, we need to escape the pipe to make sure
the command is treated as `{ echo 123 | %t.exe } > %t.out` instead of
`{ echo 123 } | %t.exe > %t.out`m where only `echo 123` is run on the
remote host.

2 years ago[libc++] NFC: Do not print the environment on remote hosts
Louis Dionne [Wed, 6 May 2020 14:35:02 +0000 (10:35 -0400)]
[libc++] NFC: Do not print the environment on remote hosts

Running `export` when there is no environment variable to export will
cause the environment on the remote host to be printed. We don't want
that, so don't run any `export` command on the host when there's no env.

2 years agoRevert "[MIR] Fix a bug in MIR printer."
Michael Liao [Wed, 6 May 2020 15:26:33 +0000 (11:26 -0400)]
Revert "[MIR] Fix a bug in MIR printer."

This reverts commit e38018b80d8e60206268740c688236734dea7b86.

2 years ago[AMDGPU] Drop 16 bit subreg suffixes on print
Stanislav Mekhanoshin [Tue, 5 May 2020 17:25:54 +0000 (10:25 -0700)]
[AMDGPU] Drop 16 bit subreg suffixes on print

We do not want to break asm syntax. These suffixes are
quite useful for debugging, so add an option to print
them. Right now it is NFC.

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

2 years ago[AMDGPU] Don't implement GCNHazardRecognizer::PreEmitNoops(SUnit *)
Jay Foad [Wed, 6 May 2020 10:16:57 +0000 (11:16 +0100)]
[AMDGPU] Don't implement GCNHazardRecognizer::PreEmitNoops(SUnit *)

When called from the post-RA scheduler, hazards have already been
handled by getHazardType returning NoopHazard, so PreEmitNoops always
returns zero. Remove it. NFC.

Historical note: PreEmitNoops was added to the hazard recognizer
interface as an optional feature to support dispatch group formation on
the POWER target:
So it seems right that we shouldn't need to implement it.

We do still implement the other overload PreEmitNoops(MachineInstr *)
because that is used by the PostRAHazardRecognizer pass.

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

2 years ago[RISCV][NFC] Add more constant materialization tests
Luís Marques [Wed, 6 May 2020 15:04:37 +0000 (16:04 +0100)]
[RISCV][NFC] Add more constant materialization tests

This patch adds more constant materialization tests, focusing on cases where
we could improve our materialization instruction sequences (particularly for
RV64). Various of these cases will be improved upon in follow-up patches.

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

2 years agoAdd support for #pragma clang fp reassociate(on|off)
Melanie Blower [Mon, 4 May 2020 17:48:12 +0000 (10:48 -0700)]
Add support for #pragma clang fp reassociate(on|off)

Reviewers: rjmccall, erichkeane, sepavloff

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

2 years ago[ARM] VMOVhr load -> vldr
David Green [Wed, 6 May 2020 14:41:32 +0000 (15:41 +0100)]
[ARM] VMOVhr load -> vldr

Much like the similar combine added recently for VMOVrh load, this
adds a fold for VMOVhr load turning it into a vldr.f16 as opposed to a
vldrh and vmov.f16.

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

2 years ago[MIR] Fix a bug in MIR printer.
Michael Liao [Wed, 6 May 2020 06:21:46 +0000 (02:21 -0400)]
[MIR] Fix a bug in MIR printer.

- Need to skip the assignment of `ID`, which is used to index that two
  object arrays.

2 years agoFor PAL, make sure Scratch Buffer Descriptor do not clobber GIT pointer
Ram Nalamothu [Thu, 30 Apr 2020 18:25:24 +0000 (18:25 +0000)]
For PAL, make sure Scratch Buffer Descriptor do not clobber GIT pointer

Since SRSRC has alignment requirements, first find non GIT pointer clobbered
registers for SRSRC and then if those registers clobber preloaded Scratch Wave
Offset register, copy the Scratch Wave Offset register to a free SGPR.

2 years ago[DAGCombiner] sink target-supported FP<->int cast op after concat vectors
Sanjay Patel [Wed, 6 May 2020 14:23:43 +0000 (10:23 -0400)]
[DAGCombiner] sink target-supported FP<->int cast op after concat vectors

Try to combine N short vector cast ops into 1 wide vector cast op:
concat (cast X), (cast Y)... -> cast (concat X, Y...)

This is part of solving PR45794:

As noted in the code comment, this is uglier than I was hoping because
the opcode determines whether we pass the source or destination type
to isOperationLegalOrCustom(). Also IIUC, there's no way to validate
what the other (dest or src) type is. Without the extra legality check
on that, there's an ARM regression test in:
...that will crash trying to lower an unsupported v8f32 to v8i16.

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

2 years ago[X86][SSE] combineX86ShuffleChain - remove unused shuffle(vzext_load(),undef) combine.
Simon Pilgrim [Wed, 6 May 2020 13:52:02 +0000 (14:52 +0100)]
[X86][SSE] combineX86ShuffleChain - remove unused shuffle(vzext_load(),undef) combine.

This should always be caught by the various VZEXT_MOVL handling in combineTargetShuffle and SimplifyDemandedVectorEltsForTargetNode.

2 years agoAMDGPU: Insert kernarg code after allocas
Matt Arsenault [Tue, 5 May 2020 00:41:04 +0000 (20:41 -0400)]
AMDGPU: Insert kernarg code after allocas

This produces more normal looking IR by keeping all the allocas
clustered at the start of the block.

2 years ago[ARM] VMOVrh of VMOVhr
David Green [Wed, 6 May 2020 14:02:54 +0000 (15:02 +0100)]
[ARM] VMOVrh of VMOVhr

A VMOVhr of a VMOVrh can be simply folded to the original HPR value.

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

2 years ago[libc++] Fix broken modules tests on single-threaded systems
Louis Dionne [Wed, 6 May 2020 13:58:26 +0000 (09:58 -0400)]
[libc++] Fix broken modules tests on single-threaded systems

Since c0cd106fcc9f, we add __config_site macro defines to the compiler
command line whether we are building with modules or not. This means
that the modules tests are expected to fail on single-threaded systems
whether we build with modules or not.

2 years ago[VectorCombine] add tests for possible scalarization; NFC
Sanjay Patel [Tue, 5 May 2020 21:40:45 +0000 (17:40 -0400)]
[VectorCombine] add tests for possible scalarization; NFC

2 years agoImplement _ExtInt ABI for all ABIs in Clang, enable type for ABIs
Erich Keane [Wed, 29 Apr 2020 19:48:07 +0000 (12:48 -0700)]
Implement _ExtInt ABI for all ABIs in Clang, enable type for ABIs

This is the result of an audit of all of the ABIs in clang to implement
and enable the type for those targets.

Additionally, this finds an issue with integer-promotion passing for a
few platforms when using _ExtInt of < int, so this also corrects that
resulting in signext/zeroext being on a params of those types in some

Differential Revisions: https://reviews.llvm.org/D79118

2 years ago[ARM] Extract from a VDUP
David Green [Wed, 6 May 2020 12:58:17 +0000 (13:58 +0100)]
[ARM] Extract from a VDUP

If we get into the situation where we are extracting from a VDUP, the
extracted value is just the origin, so long as the types match or we can
bitcast between the two.

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

2 years ago[clangd] Do not offer "Add using" tweak in header files.
Adam Czachorowski [Wed, 6 May 2020 13:46:56 +0000 (15:46 +0200)]
[clangd] Do not offer "Add using" tweak in header files.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

2 years agoCheck type for forward reference definition
Renato Golin [Tue, 5 May 2020 09:03:26 +0000 (10:03 +0100)]
Check type for forward reference definition

The types of forward references are checked that they match with other
uses, but they do not check they match with the definition.

    func @forward_reference_type_check() -> (i8) {
      br ^bb2

      return %1 : i8

      %1 = "bar"() : () -> (f32)
      br ^bb1

Would be parsed and the use site of '%1' would be silently changed to

This commit adds a test for this case, and a check during parsing for
the types to match.

Patch by Matthew Parkinson <mattpark@microsoft.com>

Closes D79317.

2 years ago[ARM] Convert a bitcast VDUP to a VDUP
David Green [Wed, 6 May 2020 13:06:02 +0000 (14:06 +0100)]
[ARM] Convert a bitcast VDUP to a VDUP

The idea, under MVE, is to introduce more bitcasts around VDUP's in an
attempt to get the type correct across basic block boundaries. In order
to do that without other regressions we need a few fixups, of which this
is the first. If the code is a bitcast of a VDUP, we can convert that
straight into a VDUP of the new type, so long as they have the same

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

2 years ago[Debug][CodeView] Emit fully qualified names for globals
Alexandre Ganea [Wed, 6 May 2020 13:11:46 +0000 (09:11 -0400)]
[Debug][CodeView] Emit fully qualified names for globals

Emit S_[L|G][THREAD32|DATA32] records with a fully qualified name (namespace + class scope).

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

2 years ago[Support] Silence warning: comparison of integers of different signs: 'const int...
Alexandre Ganea [Tue, 5 May 2020 20:01:36 +0000 (16:01 -0400)]
[Support] Silence warning: comparison of integers of different signs: 'const int' and 'const unsigned long'

2 years ago[InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4
Alexandre Ganea [Mon, 4 May 2020 22:14:25 +0000 (18:14 -0400)]
[InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4

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

2 years ago[Sema] Silence warnings when targeting x86 with VS2019 16.5.4
Alexandre Ganea [Mon, 4 May 2020 22:12:52 +0000 (18:12 -0400)]
[Sema] Silence warnings when targeting x86 with VS2019 16.5.4

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

2 years ago[mlir] Add a MemRefCastOp canonicalization pattern.
Nicolas Vasilache [Wed, 6 May 2020 13:05:15 +0000 (09:05 -0400)]
[mlir] Add a MemRefCastOp canonicalization pattern.

This revision adds a conservative canonicalization pattern for MemRefCastOp that are typically inserted during ViewOp and SubViewOp canonicalization.
Ideally such canonicalizations would propagate the type to consumers but this is not a local behavior. As a consequence MemRefCastOp are introduced to keep type compatibility but need to be cleaned up later, in the case where more dynamic behavior than necessary is introduced.

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

2 years ago[X86][SSE] Move VZEXT_MOVL removal into SimplifyDemandedVectorEltsForTargetNode
Simon Pilgrim [Wed, 6 May 2020 12:58:46 +0000 (13:58 +0100)]
[X86][SSE] Move VZEXT_MOVL removal into SimplifyDemandedVectorEltsForTargetNode

This patch replaces the VZEXT_MOVL removal from combineShuffle with a more general version based in SimplifyDemandedVectorEltsForTargetNode.

By using computeKnownBits we can always remove the VZEXT_MOVL if the upper elements of the source operand are known to be zero.

This requires us to add the conversion ops to computeKnownBitsForTargetNode as well.

Reviewed By: @craig.topper

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

2 years ago[X86][SSE] getShuffleScalarElt - minor NFC cleanup.
Simon Pilgrim [Tue, 5 May 2020 17:34:45 +0000 (18:34 +0100)]
[X86][SSE] getShuffleScalarElt - minor NFC cleanup.

Use SelectionDAG::MaxRecursionDepth instead of (equal) hard coded constant.


2 years agoReland "[CodeGen] Make logic of CCState::resultsCompatible clearer"
David Spickett [Wed, 6 May 2020 12:19:52 +0000 (13:19 +0100)]
Reland "[CodeGen] Make logic of CCState::resultsCompatible clearer"

This relands commit d782d1f898eaafee49548d5332e84c3ae11ebac4.
With a typo fixed, which was causing the x86 test failure.

2 years ago[lldb][NFC] Remove some redundant comment containing just the file name
Raphael Isemann [Wed, 6 May 2020 11:58:25 +0000 (13:58 +0200)]
[lldb][NFC] Remove some redundant comment containing just the file name

2 years ago[Sema][SVE] Fix handling of initialisers for built-in SVE types
Richard Sandiford [Mon, 2 Mar 2020 18:33:12 +0000 (18:33 +0000)]
[Sema][SVE] Fix handling of initialisers for built-in SVE types

The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.

However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones.  Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.

I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types.  But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.

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

2 years agoRevert "[clangd] Handle PresumedLocations in IncludeCollector"
Kadir Cetinkaya [Wed, 6 May 2020 11:16:50 +0000 (13:16 +0200)]
Revert "[clangd] Handle PresumedLocations in IncludeCollector"

This reverts commit 4f7917c269d65cd3c85eddee19385861c4b8390c as it is
breaking windows build bots.

2 years ago[analyzer] Stability improvement for IteratorModeling
Denys Petrov [Wed, 6 May 2020 11:16:39 +0000 (14:16 +0300)]
[analyzer] Stability improvement for IteratorModeling

Some function path may lead to crash.
Fixed using local variable outside the scope  through a pointer.
Fixed minor misspellings.
Added regression test.

This patch covers a bug https://bugs.llvm.org/show_bug.cgi?id=41485

Reviewed By: baloghadamsoftware

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

2 years ago[AMDGPU][MC][GFX9+] Enabled 21-bit signed offsets for SMEM instructions
Dmitry Preobrazhensky [Wed, 6 May 2020 11:11:02 +0000 (14:11 +0300)]
[AMDGPU][MC][GFX9+] Enabled 21-bit signed offsets for SMEM instructions

Reviewers: arsenm, rampitec

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

2 years ago[clangd] Handle PresumedLocations in IncludeCollector
Kadir Cetinkaya [Thu, 23 Apr 2020 15:48:47 +0000 (17:48 +0200)]
[clangd] Handle PresumedLocations in IncludeCollector

This will enable extraction of correct line locations in preamble patch
for includes.

Reviewers: sammccall

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

Tags: #clang

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

2 years ago[PowerPC] Fix missing GOT indirect variant kind
Stefan Pintilie [Wed, 6 May 2020 10:19:09 +0000 (05:19 -0500)]
[PowerPC] Fix missing GOT indirect variant kind

The function MCSymbolRefExpr::getVariantKindForName was missing the entry for
VK_PPC_GOT_PCREL. This patch adds the missing entry.

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

2 years ago[lldb] Warn the user about starting the --func-regex parameter with an asterisk
Raphael Isemann [Wed, 6 May 2020 10:21:53 +0000 (12:21 +0200)]
[lldb] Warn the user about starting the --func-regex parameter with an asterisk

Sometimes users think that setting a function regex for all function that contain the word 'needle' in their
name looks like this: `*needle*`. However, LLDB only searches the function name and doesn't fully match
it against the regex, so the leading and trailing '*' operators don't do anything and actually just cause the
regex engine to reject the regular expression with "repetition-operator operand invalid".

This patch makes this a bit more obvious to the user by printing a warning that a leading '*' before this
regular expression here doesn't have any purpose (and will cause an error). This doesn't attempt to detect
a case where there is only a trailing '*' as that would involve parsing the regex and it seems the most
common way to end up in this situation is by doing `rbreak *needle*`.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

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

2 years ago[clang-tidy]: Add cert-str34-c alias for bugprone-signed-char-misuse.
Tamás Zolnai [Wed, 6 May 2020 08:45:03 +0000 (10:45 +0200)]
[clang-tidy]: Add cert-str34-c alias for bugprone-signed-char-misuse.

Added `DiagnoseSignedUnsignedCharComparisons` option to
filter out unrelated use cases. The SEI cert catches explicit
integer casts (two use cases), while in the case of
`signed char` \ `unsigned char` comparison, we have implicit

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

2 years ago[Sema] Put existing warning under -Wexcess-initializers
Richard Sandiford [Fri, 1 May 2020 13:26:34 +0000 (14:26 +0100)]
[Sema] Put existing warning under -Wexcess-initializers

I have a follow-on patch that uses an alternative wording for
ext_excess_initializers in some cases.  This patch puts it and
a couple of related warnings under their own -W option in order
to avoid a regression in Misc/warning-flags.c.

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

2 years agoFix misleading comments.
Jay Foad [Wed, 6 May 2020 10:07:45 +0000 (11:07 +0100)]
Fix misleading comments.

2 years ago[clang] Fix a crash on invalid auto.
Haojian Wu [Wed, 6 May 2020 06:56:42 +0000 (08:56 +0200)]
[clang] Fix a crash on invalid auto.

The crash is triggered on accessing a null InitExpr.

For group declaration, e.g. `auto c = a, &d = {a};`, what's happening:

1. each VarDecl is built separately during the parsing stage.
2. perform the semantic analysis (Sema::BuildDeclaratorGroup) to check
whether the type of the two VarDecl is the same, if not mark it as invalid.

in step 1, VarDecl c and d are built, both of them are valid (after D77395),
but d is without the InitExpr attached (under -fno-recovery-ast), crash
happens in step 2 when accessing the source range of d's InitExpr.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[docs] Regenerate DiagnosticsReference.rst
Richard Sandiford [Fri, 1 May 2020 15:14:18 +0000 (16:14 +0100)]
[docs] Regenerate DiagnosticsReference.rst

It looks like it has been a while since the checked-in version of
DiagnosticsReference.rst was regenerated.  I realise there probably
isn't any expectation that the checked-in version is kept up-to-date,
but now that the project is on github and the rst can be viewed directly
from the repo's web interface, it seemed worth having something a bit
more recent.

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

2 years agoQuiet some -Wdocumentation warnings.
Benjamin Kramer [Wed, 6 May 2020 09:22:31 +0000 (11:22 +0200)]
Quiet some -Wdocumentation warnings.

2 years agoRevert "[CodeGen] Make logic of CCState::resultsCompatible clearer"
David Spickett [Wed, 6 May 2020 09:13:20 +0000 (10:13 +0100)]
Revert "[CodeGen] Make logic of CCState::resultsCompatible clearer"

This reverts commit d782d1f898eaafee49548d5332e84c3ae11ebac4
which caused test CodeGen/X86/sibcall.ll to fail.

2 years agoFix error handling after [<index>] in 'frame variable'
Jaroslav Sevcik [Wed, 6 May 2020 08:59:32 +0000 (10:59 +0200)]
Fix error handling after [<index>] in 'frame variable'

This fixes a bug where

frame var a[0]+5

returns the value a[0] without any warning because the current logic simply ignores everything after ']' as long as there is no '.', '-' or '[' in the rest of the string.

The fix simplifies the termination condition of the expression path parsing loop to check if have a non-empty remaining string to parse. Previously, the condition checked if a separator was found. That condition coincided with the remaining string-to-parse condition except for the buggy indexed case where non-empty string was left ("+5" in the example above), but the separator index was 'npos'.

Reviewed By: teemperor, labath

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

2 years ago[llvm-nm/objdump/size] Add tests for dumping symbol tables with invalid sh_size.
Xing GUO [Wed, 6 May 2020 09:00:55 +0000 (17:00 +0800)]
[llvm-nm/objdump/size] Add tests for dumping symbol tables with invalid sh_size.

This change adds tests for llvm-nm, llvm-objdump and llvm-size when dumping symbol tables with invalid sh_size (sh_size % sizeof(Elf_Sym) != 0).

Reviewed By: jhenderson, MaskRay

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

2 years ago[CodeGen] Make logic of CCState::resultsCompatible clearer
David Spickett [Wed, 6 May 2020 08:48:58 +0000 (09:48 +0100)]
[CodeGen] Make logic of CCState::resultsCompatible clearer

2 years ago[libc] Change target name for testing benchmark utils infrastructure.
Paula Toth [Wed, 6 May 2020 08:21:38 +0000 (01:21 -0700)]
[libc] Change target name for testing benchmark utils infrastructure.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: gchatelet, mgorny, tschuett, libc-commits

Tags: #libc-project

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

2 years ago[GlobalISel][InlineAsm] Add support for basic output operand constraints
Konstantin Schwarz [Wed, 8 Apr 2020 18:04:13 +0000 (20:04 +0200)]
[GlobalISel][InlineAsm] Add support for basic output operand constraints

Reviewers: arsenm, dsanders, aemerson, volkan, t.p.northover, paquette

Reviewed By: arsenm

Subscribers: gargaroff, wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

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

2 years agoFix ForRangeCopyCheck not triggering on iterators returning elements by value in...
Dmitri Gribenko [Wed, 6 May 2020 06:50:40 +0000 (08:50 +0200)]
Fix ForRangeCopyCheck not triggering on iterators returning elements by value in C++17.

The AST is different in C++17 in that there is no MaterializeTemporaryExpr for in the AST for a loop variable that is initialized from an iterator that returns its elements by value.

Account for this by checking that the variable is not initialized by an operator* call that returns a value type.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[MLIR][NFC] Fix/update debug messages for analysis utils and affine fusion
Uday Bondhugula [Wed, 6 May 2020 06:17:16 +0000 (11:47 +0530)]
[MLIR][NFC] Fix/update debug messages for analysis utils and affine fusion

Drop trailing period in debug messages. Add an extra line for fusion
debug info.

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

2 years ago[local-bounds] Ignore volatile operations
Vitaly Buka [Wed, 22 Apr 2020 02:22:00 +0000 (19:22 -0700)]
[local-bounds] Ignore volatile operations

-fsanitize=local-bounds is very similar to ``object-size`` and
should also ignore volatile pointers.

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

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

2 years ago[lsan] Fix warnings lit config
Vitaly Buka [Wed, 6 May 2020 05:42:14 +0000 (22:42 -0700)]
[lsan] Fix warnings lit config

2 years ago[dfsan] Remove realloc from done_abilist.txt
Vitaly Buka [Wed, 6 May 2020 05:21:09 +0000 (22:21 -0700)]
[dfsan] Remove realloc from done_abilist.txt

Currently, realloc is marked as "discard" in done_abilist.txt. As discussed in PR#45583, this is probably not the expected behavior; a custom wrapper seems to be required. Since this wrapper has not been implemented yet, realloc should not be in the done_abilist.txt file so that a warning is displayed when it is called.

Reviewers: kcc, pcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers

Tags: #sanitizers

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

2 years ago[X86] Add v32i16/v64i8 into the handling for 512-bit inline assembly constraints.
Craig Topper [Wed, 6 May 2020 04:16:51 +0000 (21:16 -0700)]
[X86] Add v32i16/v64i8 into the handling for 512-bit inline assembly constraints.

2 years ago[libclang] Remove duplicate dependency on LLVMSupport
Jan Korous [Tue, 5 May 2020 22:42:33 +0000 (15:42 -0700)]
[libclang] Remove duplicate dependency on LLVMSupport

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

2 years ago[Attributor][NFC] Cleanup some AAMemoryLocation code
Johannes Doerfert [Tue, 5 May 2020 20:14:36 +0000 (15:14 -0500)]
[Attributor][NFC] Cleanup some AAMemoryLocation code

This is the first step to resolve a TODO in AAMemoryLocation and to fix
a bug we have when handling `byval` arguments of `readnone` call sites.

No functional change intended.

2 years ago[Attributor][NFC] Minor code cleanups to minimize follow up diffs
Johannes Doerfert [Tue, 5 May 2020 16:20:08 +0000 (11:20 -0500)]
[Attributor][NFC] Minor code cleanups to minimize follow up diffs

2 years ago[Attributor][NFC] Avoid dependences on known information
Johannes Doerfert [Tue, 5 May 2020 16:18:03 +0000 (11:18 -0500)]
[Attributor][NFC] Avoid dependences on known information

2 years ago[X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512...
Craig Topper [Wed, 6 May 2020 02:47:39 +0000 (19:47 -0700)]
[X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512 are enabled and type is 256 or 512 bits

gcc supports selecting ymm0/zmm0 for the Yz constraint when used with 256 or 512 bit vector types.

Fixes PR45806

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