platform/upstream/llvm.git
4 years ago[Clang] implement -fno-eliminate-unused-debug-types
Nick Desaulniers [Mon, 10 Aug 2020 21:52:37 +0000 (14:52 -0700)]
[Clang] implement -fno-eliminate-unused-debug-types

Fixes pr/11710.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Resubmit after breaking Windows and OSX builds.

Reviewed By: dblaikie

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

4 years ago[mlir][Linalg] Allow distribution `scf.parallel` loops generated in
MaheshRavishankar [Mon, 10 Aug 2020 21:39:02 +0000 (14:39 -0700)]
[mlir][Linalg] Allow distribution `scf.parallel` loops generated in
Linalg to processors.

This changes adds infrastructure to distribute the loops generated in
Linalg to processors at the time of generation. This addresses use
case where the instantiation of loop is done just to distribute
them. The option to distribute is added to TilingOptions for now and
will allow specifying the distribution as a transformation option,
just like tiling and promotion are specified as options.

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

4 years ago[InstSimplify][test] Remove unused parameter in vscale.ll
Arthur Eubanks [Mon, 10 Aug 2020 20:55:45 +0000 (13:55 -0700)]
[InstSimplify][test] Remove unused parameter in vscale.ll

Reviewed By: huihuiz

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

4 years ago[Diagnostics] Move -Wstring-concatenation to -Wextra
Dávid Bolvanský [Mon, 10 Aug 2020 21:35:55 +0000 (23:35 +0200)]
[Diagnostics] Move -Wstring-concatenation to -Wextra

4 years ago[ARM] Speed up arm-cortex-cpus.c test
Artem Belevich [Sat, 8 Aug 2020 00:18:38 +0000 (17:18 -0700)]
[ARM] Speed up arm-cortex-cpus.c test

Trailing wildcard regex searches greedily continue searching through the whole
input and make the test unnecessarily slow.

Using equivalent plain text partial match speeds up the test execution time from
~35s to ~12s.

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

4 years ago[Diagnostics] Avoid false positives with -Wstring-concatenation
Dávid Bolvanský [Mon, 10 Aug 2020 21:04:20 +0000 (23:04 +0200)]
[Diagnostics] Avoid false positives with -Wstring-concatenation

4 years ago[MLIR] Adding gpu.host_register op and lower it to a runtime call.
Christian Sigg [Mon, 10 Aug 2020 08:13:57 +0000 (10:13 +0200)]
[MLIR] Adding gpu.host_register op and lower it to a runtime call.

Reviewed By: herhut

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

4 years ago[InstSimplify] Add test for expand binop undef issue (NFC)
Nikita Popov [Mon, 10 Aug 2020 20:39:07 +0000 (22:39 +0200)]
[InstSimplify] Add test for expand binop undef issue (NFC)

Add test case from https://reviews.llvm.org/D83360#2146539.

4 years ago[AIX] Try to not use LLVM tools while building runtimes
David Tenty [Mon, 10 Aug 2020 20:07:23 +0000 (16:07 -0400)]
[AIX] Try to not use LLVM tools while building runtimes

Since 64-bit XCOFF and the big AR format is not yet supported in some of these tools, this patch avoids additional setup of these tools. This patch is not intended to prevent picking up the LLVM tools if they happen to be available otherwise.

Reviewed By: hubert.reinterpretcast

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

4 years agoFix "last accessed time" test failing on Windows
Alexandre Ganea [Mon, 10 Aug 2020 20:03:03 +0000 (16:03 -0400)]
Fix "last accessed time" test failing on Windows

Before this patch, the tests in llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test used to fail on my machine, because the "last accessed time" is disabled in the OS by default since Windows XP. One needs to explicitly enable it for the feature to work. Otherwise the last access time is the last write time. Please see: https://superuser.com/questions/251263/the-last-access-date-is-not-changed-even-after-reading-the-file-on-windows-7

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

4 years ago[XCOFF][AIX] Use TE storage mapping class when large code model is enabled
jasonliu [Mon, 10 Aug 2020 19:35:50 +0000 (19:35 +0000)]
[XCOFF][AIX] Use TE storage mapping class when large code model is enabled

Summary:
Use TE SMC instead of TC SMC in large code model mode,
so that large code model TOC entries could get placed after all
the small code model TOC entries, which reduces the chance of TOC overflow.

Reviewed By: Xiangling_L

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

4 years ago[MachineOutliner][AArch64] WA for multiple stack fixup cases in MachineOutliner.
Puyan Lotfi [Mon, 10 Aug 2020 18:45:38 +0000 (14:45 -0400)]
[MachineOutliner][AArch64] WA for multiple stack fixup cases in MachineOutliner.

In cases where MachineOutliner candidates either are:

  * noreturn
  * have calls with no available LR or free regs
  * Don't use SP

we can end up hitting stack fixup code for the caller and the callee for
a FrameID of MachineOutlinerDefault. This triggers the assert:

  `assert(OF.FrameConstructionID != MachineOutlinerDefault &&
          "Can only fix up stack references once");`

in AArch64InstrInfo.cpp. This assert exists for now because a lot of the
fixup code is not tested to handle fixing up more than once and needs
some better checks and enhancements to avoid potentially generating
illegal code.

I've filed a Bugzilla report to track this until these cases are handled
by the AArch64 MachineOutliner: https://bugs.llvm.org/show_bug.cgi?id=46767

This diff detects cases that will cause these multiple stack fixups and
prune the Candidates from `RepeatedSequenceLocs`.

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

4 years ago[SampleFDO] Stop letting findCalleeFunctionSamples return unrelated profiles
Wei Mi [Mon, 10 Aug 2020 19:35:19 +0000 (12:35 -0700)]
[SampleFDO] Stop letting findCalleeFunctionSamples return unrelated profiles
for invoke instructions.

We see a warning of "No debug information found in function foo: Function
profile not used" in a case. The function foo is called by an invoke
instruction. It has no debug information because it has attribute((nodebug))
in the definition. It shouldn't have profile instance in the sample profile
but compiler thinks it does, that turns out to be a compiler bug in
findCalleeFunctionSamples. The bug is exposed when sample-profile-merge-inlinee
is enabled recently.

Currently in findCalleeFunctionSamples, CalleeName is unset and is empty for
invoke instruction. For empty CalleeName, findFunctionSamplesAt will treat
the call as an indirect call and will return any inline instance profile at
the same location as the instruction. That leads to a wrong profile being
returned to function foo.

The patch set CalleeName when the instruction is an invoke.

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

4 years ago[WebAssembly][ConstantFolding] Fold fp-to-int truncation intrinsics
Thomas Lively [Mon, 10 Aug 2020 19:40:05 +0000 (12:40 -0700)]
[WebAssembly][ConstantFolding] Fold fp-to-int truncation intrinsics

Constant fold both the trapping and saturating versions of the
WebAssembly truncation intrinsics. The tests are adapted from the
WebAssembly spec tests for the corresponding instructions.

Requested in PR46982.

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

4 years ago[MSAN RT] Use __sanitizer::mem_is_zero in __msan_test_shadow
Gui Andrade [Mon, 10 Aug 2020 19:03:40 +0000 (19:03 +0000)]
[MSAN RT] Use __sanitizer::mem_is_zero in __msan_test_shadow

The former function is particularly optimized for exactly the
use case we're interested in: an all-zero buffer.

This reduces the overhead of calling this function some 80% or
more. This is particularly for instrumenting code heavy with
string processing functions, like grep. An invocation of grep
with the pattern '[aeiou]k[aeiou]' has its runtime reduced by
~75% with this patch

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

4 years agoFix "CHECK-LABEL: @" typos in llvm/test/CodeGen/AArch64/sve-fixed-length-*.ll
Paul Walker [Mon, 10 Aug 2020 18:42:12 +0000 (19:42 +0100)]
Fix "CHECK-LABEL: @" typos in llvm/test/CodeGen/AArch64/sve-fixed-length-*.ll

4 years agoUnbundle KILL bundles in VirtRegRewriter
Stanislav Mekhanoshin [Fri, 7 Aug 2020 19:56:09 +0000 (12:56 -0700)]
Unbundle KILL bundles in VirtRegRewriter

SplitKit forms invalid COPY subreg bundles without a leading
BUNDLE instruction. That manifests itself in post-RA scheduler
counting instruction and asserting on "Instruction count mismatch".

The bundle shall be undone by VirtRegRewriter::expandCopyBundle(),
but it does not because VirtRegRewriter::handleIdentityCopy() can
turn COPY bundle into a KILL bundle.

Process KILLs as well.

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

4 years ago[flang] Avoid cascading error in subscript triplet
Tim Keith [Mon, 10 Aug 2020 18:44:04 +0000 (11:44 -0700)]
[flang] Avoid cascading error in subscript triplet

If a bound of a subscript triplet is present but fails to analyze
due to an error, return nullopt rather than returning a Triplet with
that bound missing. This is so we can distinguish an absent bound from
an erroneous one and avoid spurious errors.

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

4 years ago[flang] Fix edge case with Hollerith
peter klausler [Fri, 7 Aug 2020 23:44:08 +0000 (16:44 -0700)]
[flang] Fix edge case with Hollerith

To prevent mistokenization of CHARACTER*2HXY as a Hollerith
literal constant while allowing it in DATA A/2*2HXY/, there's
a little state that tracks whether a / has been seen earlier
in the same statement.  But it was being reset on each line,
not statement, so Hollerith in a DATA statement continuation
line was incorrectly tokenized.  Fixed.

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

4 years ago[lldb] tab completion for `platform target-install`
Gongyu Deng [Mon, 10 Aug 2020 18:10:18 +0000 (20:10 +0200)]
[lldb] tab completion for `platform target-install`

1. Applied the common completion `eDiskFileCompletion` to the first argument of
the command `platform target-install`.
2. Added a related test case.

Reviewed By: teemperor

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

4 years agoAMDGPU: Fix assertion in performSHLPtrCombine for 64-bit pointers
Matt Arsenault [Mon, 10 Aug 2020 16:27:52 +0000 (12:27 -0400)]
AMDGPU: Fix assertion in performSHLPtrCombine for 64-bit pointers

4 years agoAMDGPU: Fix visiting physreg dest users when folding immediate copies
Matt Arsenault [Sun, 9 Aug 2020 00:28:48 +0000 (20:28 -0400)]
AMDGPU: Fix visiting physreg dest users when folding immediate copies

This can fold the immediate into the physical destination, but this
should not look for further users of the register. Fixes regression
introduced by 766cb615a3b96025192707f4670cdf171da84034.

4 years agoRe-Re-land: [CodeView] Add full repro to LF_BUILDINFO record
Alexandre Ganea [Mon, 10 Aug 2020 17:36:20 +0000 (13:36 -0400)]
Re-Re-land: [CodeView] Add full repro to LF_BUILDINFO record

This patch adds the missing information to the LF_BUILDINFO record, which allows for rebuilding a .CPP without any external dependency but the .OBJ itself (other than the compiler).

Some external tools that we are using (Recode, Live++) are extracting the information to reproduce a build without any knowledge of the build system. The LF_BUILDINFO stores a full path to the compiler, the PWD (CWD at program startup), a relative or absolute path to the TU, and the full CC1 command line. The command line needs to be freestanding (not depend on any environment variables). In the same way, MSVC doesn't store the provided command-line, but an expanded version (somehow their equivalent of CC1) which is also freestanding.

For more information see PR36198 and D43002.

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

4 years ago[BreakFalseDeps][X86] Move operand loop out of X86's getUndefRegClearance and put...
Craig Topper [Mon, 10 Aug 2020 17:32:29 +0000 (10:32 -0700)]
[BreakFalseDeps][X86] Move operand loop out of X86's getUndefRegClearance and put in the pass.

X86 is the only user of this interface in tree. Previously the
X86 pass would loop over operands looking for one undef operand for
the pass to fix. But there could theoretically be multiple operands
to fix. So it makes more sense for the pass to do the looping and
ask the target if an operand needs to be fixed.

4 years ago[MLIR] Make gpu.launch_func rewrite pattern part of the LLVM lowering pass.
Christian Sigg [Sat, 1 Aug 2020 14:40:21 +0000 (16:40 +0200)]
[MLIR] Make gpu.launch_func rewrite pattern part of the LLVM lowering pass.

Reviewed By: herhut

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

4 years ago[clangd] Have template template arguments target their referenced template decl
Nathan Ridge [Mon, 10 Aug 2020 00:37:43 +0000 (20:37 -0400)]
[clangd] Have template template arguments target their referenced template decl

Fixes https://github.com/clangd/clangd/issues/473

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

4 years ago[WebAssembly] wasm64: fix memory.init operand types
Wouter van Oortmerssen [Fri, 7 Aug 2020 20:24:43 +0000 (13:24 -0700)]
[WebAssembly] wasm64: fix memory.init operand types

I had assumed they would all become in i64, but this is not necessary as long as data segments stay 32-bit, see:
https://github.com/WebAssembly/memory64/blob/master/proposals/memory64/Overview.md

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

4 years ago[ELF] Avoid creating a 2.1GB output file in arm-exidx-range.s
Alex Richardson [Mon, 10 Aug 2020 17:07:40 +0000 (18:07 +0100)]
[ELF] Avoid creating a 2.1GB output file in arm-exidx-range.s

Currently both sections will be placed in the same PT_LOAD and therefore
lld generates a contiguous output file containing both sections.
By using AT(0xffff0000) the .vectors is placed a separate PT_LOAD and the
resulting file is now only a few kilobytes.

Reviewed By: psmith

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

4 years ago[MLIR][TableGen] Fix ambiguous build methods when inferring result types.
Rahul Joshi [Fri, 7 Aug 2020 21:02:19 +0000 (14:02 -0700)]
[MLIR][TableGen] Fix ambiguous build methods when inferring result types.

- Fix ODS framework to suppress build methods that infer result types and are
  ambiguous with collective variants. This applies to operations with a single variadic
  inputs whose result types can be inferred.
- Extended OpBuildGenTest to test these kinds of ops.

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

4 years ago[lldb] Skip TestSimulatorPlatform with out-of-tree debugserver
Jonas Devlieghere [Mon, 10 Aug 2020 17:00:02 +0000 (10:00 -0700)]
[lldb] Skip TestSimulatorPlatform with out-of-tree debugserver

4 years ago[mlir][spirv] Add OpGroupBroadcast
Artur Bialas [Mon, 10 Aug 2020 16:39:27 +0000 (09:39 -0700)]
[mlir][spirv] Add OpGroupBroadcast

OpGroupBroadcast added to SPIRV dialect

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

4 years ago[clangd] Fix crash-bug in preamble indexing when using modules.
Adam Czachorowski [Mon, 25 May 2020 12:43:43 +0000 (14:43 +0200)]
[clangd] Fix crash-bug in preamble indexing when using modules.

Summary:
When preamble contains #undef, indexing code finds the matching #define
and uses that during indexing. However, it would only look for local
definitions. If the macro was defined in a module, MacroInfo
would be nullptr and clangd would crash.

This change makes clangd ignore any #undef without a matching #define
inside the same TU.

The indexing of macros happens for preamble only, so then #undef must be
in the preamble, which is why we need two .h files in a test.

Note that clangd is currently not ready for module support, but this
brings us one step closer.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[lldb] Fix NSArray0 data formatter and add test
Jonas Devlieghere [Mon, 10 Aug 2020 16:38:14 +0000 (09:38 -0700)]
[lldb] Fix NSArray0 data formatter and add test

Fixes PR47089

4 years ago[NFC][MLInliner] remove curly braces for a few sinle-line loops
Mircea Trofin [Mon, 10 Aug 2020 16:32:21 +0000 (09:32 -0700)]
[NFC][MLInliner] remove curly braces for a few sinle-line loops

4 years ago[NFC][MLInliner] Set up the logger outside the development mode advisor
Mircea Trofin [Mon, 10 Aug 2020 16:22:17 +0000 (09:22 -0700)]
[NFC][MLInliner] Set up the logger outside the development mode advisor

This allows us to subsequently configure the logger for the case when we
use a model evaluator and want to log additional outputs.

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

4 years ago[PGO] Delete dead comdat renaming code related to GlobalAlias. NFC
Fangrui Song [Sun, 9 Aug 2020 04:23:03 +0000 (21:23 -0700)]
[PGO] Delete dead comdat renaming code related to GlobalAlias. NFC

A GlobalAlias is an address-taken user of its aliased function.
canRenameComdatFunc has excluded such cases.

Reviewed By: davidxl

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

4 years ago[mlir][vector] Relax transfer_read/transfer_write restriction on memref operand
Thomas Raoux [Mon, 10 Aug 2020 15:54:19 +0000 (08:54 -0700)]
[mlir][vector] Relax transfer_read/transfer_write restriction on memref operand

Relax the verifier for transfer_read/transfer_write operation so that it can
take a memref with a different element type than the vector being read/written.

This is based on the discourse discussion:
https://llvm.discourse.group/t/memref-cast/1514

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

4 years ago[gn build] Port e2d61ae5733
LLVM GN Syncbot [Mon, 10 Aug 2020 15:55:00 +0000 (15:55 +0000)]
[gn build] Port e2d61ae5733

4 years agoCorrectly set CompilingPCH in PrecompilePreambleAction.
Adam Czachorowski [Fri, 7 Aug 2020 15:08:38 +0000 (17:08 +0200)]
Correctly set CompilingPCH in PrecompilePreambleAction.

This fixes a crash bug in clangd when used with modules. ASTWriter would
end up writing references to submodules into the PCH file, but upon
reading the submodules would not exists and
HeaderFileInfoTrait::ReadData would crash.

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

4 years ago[SyntaxTree] Expand support for `NestedNameSpecifier`
Eduardo Caldas [Fri, 7 Aug 2020 18:42:35 +0000 (18:42 +0000)]
[SyntaxTree] Expand support for `NestedNameSpecifier`

Summary:
We want NestedNameSpecifier syntax nodes to be generally supported, not
only for `DeclRefExpr` and `DependentScopedDeclRefExpr`.

To achieve this we:
* Use the `RecursiveASTVisitor`'s API to traverse
`NestedNameSpecifierLoc`s and automatically create its syntax nodes
* Add links from the `NestedNameSpecifierLoc`s to their syntax nodes.

In this way, from any semantic construct that has a `NestedNameSpecifier`,
we implicitly generate its syntax node via RAV and we can easily access
this syntax node via the links we added.

4 years ago[Hexagon] Avoid creating an empty target feature
Krzysztof Parzyszek [Mon, 10 Aug 2020 15:32:38 +0000 (10:32 -0500)]
[Hexagon] Avoid creating an empty target feature

If the CPU string is empty, the target feature map may end up having
an empty string inserted to it. The symptom of the problem is a warning
message:
  '+' is not a recognized feature for this target (ignoring feature)
Also, the target-features attribute in the module will have an empty
string in it.

4 years ago[llvm-symbolizer] Add back --version and add a -v alias
Fangrui Song [Mon, 10 Aug 2020 15:15:33 +0000 (08:15 -0700)]
[llvm-symbolizer] Add back --version and add a -v alias

The switch from llvm::cl to OptTable (D83530) dropped --version, which
is needed by some users.

This patch also adds a -v alias, which is available in GNU addr2line.

The version dumping is similar to llvm-objcopy --version (exotic):

```
llvm-symbolizer
LLVM (http://llvm.org/):
  LLVM version 12.0.0git
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake-avx512
```

Reviewed By: dyung, jhenderson

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

4 years ago[flang] Version information in flang/f18
Camille Coti [Mon, 10 Aug 2020 15:16:35 +0000 (16:16 +0100)]
[flang] Version information in flang/f18

Fixed some version information in flang/f18:

  - fixed the behavior of the -v switch: this flag enables verbosity with used with arguments, but just displays the version when used alone (related to this bug: https://bugs.llvm.org/show_bug.cgi?id=46017)
 - added __FLANG, __FLANG_MAJOR__, __FLANG_MINOR__ and __FLANG_PATCHLEVEL__ (similar to their __F18* counterparts) for compatibility purpose

Reviewed By: sscalpone, AlexisPerry, richard.barton.arm, tskeith

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

4 years ago[lld][WebAssembly] Handle weakly referenced symbols when lazy (archive) version is...
Sam Clegg [Fri, 7 Aug 2020 23:12:33 +0000 (16:12 -0700)]
[lld][WebAssembly] Handle weakly referenced symbols when lazy (archive) version is see first

When a weak reference of a lazy symbol occurs we were not correctly
updating the lazy symbol.  We need to tag the existing lazy symbol
as weak and, in the case of a function symbol, give it a signature.

Without the signature we can't then create the dummy function which
is needed when an weakly undefined function is called.

We had tests for weakly referenced lazy symbols but we were only
tests in the case where the reference was seen before the lazy
symbol.

See: https://github.com/WebAssembly/wasi-libc/pull/214

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

4 years ago[X86][SSE] shuffle(hop,hop) - canonicalize unary hop(x,x) shuffle masks
Simon Pilgrim [Mon, 10 Aug 2020 15:01:00 +0000 (16:01 +0100)]
[X86][SSE] shuffle(hop,hop) - canonicalize unary hop(x,x) shuffle masks

If a shuffle is referring to both the lower and upper half lanes of an unary horizontal op, then canonicalize the mask to only refer to the lower half.

4 years ago[SLP] Regenerate load-merge.ll tests
Simon Pilgrim [Mon, 10 Aug 2020 14:48:23 +0000 (15:48 +0100)]
[SLP] Regenerate load-merge.ll tests

Noticed this NFC change in D57779

4 years ago[PGO][CUDA][HIP] Skip generating profile on the device stub and wrong-side functions.
Michael Liao [Tue, 4 Aug 2020 17:56:36 +0000 (13:56 -0400)]
[PGO][CUDA][HIP] Skip generating profile on the device stub and wrong-side functions.

- Skip generating profile data on `__global__` function in the host
  compilation. It's a host-side stub function only and don't have
  profile instrumentation generated on the real function body. The extra
  profile data results in the malformed instrumentation profile data.
- Skip generating region mapping on functions in the wrong-side, i.e.,
  + For the device compilation, skip host-only functions; and,
  + For the host compilation, skip device-only functions (including
    `__global__` functions.)
- As the device-side profiling is not ready yet, only host-side profile
  code generation is checked.

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

4 years ago[XCOFF] Adjust .rename emission sequence
jasonliu [Mon, 10 Aug 2020 13:46:46 +0000 (13:46 +0000)]
[XCOFF] Adjust .rename emission sequence

Summary:
AIX assembler does not generate correct relocation when .rename
appear between tc entry label and .tc directive.
So only emit .rename after .tc/.comm or other linkage is emitted.

Reviewed By: daltenty, hubert.reinterpretcast

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

4 years agoAuthor: Shuhong Liu <shuhong.liu@ibm.com>
Shuhong Liu [Mon, 10 Aug 2020 14:27:04 +0000 (10:27 -0400)]
Author: Shuhong Liu <shuhong.liu@ibm.com>
Date:   Mon Aug 10 10:31:50 2020 +0300

    [AIX][Clang][Driver] Generate reference to the C++ library on the link step

    Have the linker find libc++ on its search path by adding -lc++.

    Reviewed by: daltenty, hubert.reinterpretcast, stevewan

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

4 years ago[AIX] Static init frontend recovery and backend support
Xiangling Liao [Wed, 15 Jul 2020 20:12:22 +0000 (16:12 -0400)]
[AIX] Static init frontend recovery and backend support

On the frontend side, this patch recovers AIX static init implementation to
use the linkage type and function names Clang chooses for sinit related function.

On the backend side, this patch sets correct linkage and function names on aliases
created for sinit/sterm functions.

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

4 years ago[X86][SSE] Pull out shuffle(hop,hop) combine into combineShuffleWithHorizOp helper...
Simon Pilgrim [Mon, 10 Aug 2020 14:08:44 +0000 (15:08 +0100)]
[X86][SSE] Pull out shuffle(hop,hop) combine into combineShuffleWithHorizOp helper. NFC.

4 years ago[PowerPC] Add option to control PCRel GOT indirect linker optimization
Stefan Pintilie [Mon, 10 Aug 2020 13:47:09 +0000 (08:47 -0500)]
[PowerPC] Add option to control PCRel GOT indirect linker optimization

Add a hidden option to the compiler to control a the PC Relative GOT indirect
linker optimization.

If this option is set to false the compiler will no loger produce the
relocations required by the linker to perform the optimization.

Reviewed By: nemanjai, NeHuang, #powerpc

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

4 years ago[ARM] Unrestrict Armv8-a IT when at minsize
Sam Parker [Mon, 10 Aug 2020 12:23:37 +0000 (13:23 +0100)]
[ARM] Unrestrict Armv8-a IT when at minsize

IT blocks with more than one instruction were performance deprecated in Armv8
but that doesn't mean we should follow that advise when optimising for size.

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

4 years ago[DebugInfo] Don't error for zero-length arange entries
James Henderson [Mon, 10 Aug 2020 12:36:44 +0000 (13:36 +0100)]
[DebugInfo] Don't error for zero-length arange entries

Although the DWARF specification states that .debug_aranges entries
can't have length zero, these can occur in the wild. There's no
particular reason to enforce this part of the spec, since functionally
they have no impact. The patch removes the error and introduces a new
warning for premature terminator entries which does not stop parsing.

This is a relanding of cb3a598c87db, adding the missing obj2yaml part
that was needed.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46805. See also
https://reviews.llvm.org/D71932 which originally introduced the error.

Reviewed by: ikudrin, dblaikie, Higuoxing

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

4 years ago[SyntaxTree] Implement `NestedNameSpecifier` using the `List` base API
Eduardo Caldas [Fri, 7 Aug 2020 09:28:04 +0000 (09:28 +0000)]
[SyntaxTree] Implement `NestedNameSpecifier` using the `List` base API

4 years ago[X86][SSE] Add single undef element HADD test cases from PR34724
Simon Pilgrim [Mon, 10 Aug 2020 13:13:03 +0000 (14:13 +0100)]
[X86][SSE] Add single undef element HADD test cases from PR34724

4 years ago[X86][SSE] combineTargetShuffle - rearrange shuffle(hop,hop) matching to delay shuffl...
Simon Pilgrim [Mon, 10 Aug 2020 12:06:36 +0000 (13:06 +0100)]
[X86][SSE] combineTargetShuffle - rearrange shuffle(hop,hop) matching to delay shuffle mask manipulation. NFC.

Check that we're shuffling hadd/pack ops first before altering shuffle masks.

First step towards adding extra functionality, plus it avoids costly shuffle mask manipulation if not necessary.

4 years ago[clang-format] Add space between method modifier and a tuple return type in C#
Łukasz Krawczyk [Mon, 10 Aug 2020 12:58:28 +0000 (13:58 +0100)]
[clang-format] Add space between method modifier and a tuple return type in C#

"public (string name, int age) methodTuple() {}" is now properly spaced

Patch by lukaszkrawczyk@google.com

Reviewed By: jbcoe, krasimir

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

4 years agoAMDGPU/GlobalISel: Don't try to handle undef source operand
Matt Arsenault [Sun, 9 Aug 2020 19:01:21 +0000 (15:01 -0400)]
AMDGPU/GlobalISel: Don't try to handle undef source operand

This is now illegal MIR

4 years agoPeepholeOptimizer: Use Register
Matt Arsenault [Sun, 9 Aug 2020 18:37:45 +0000 (14:37 -0400)]
PeepholeOptimizer: Use Register

4 years agoGlobalISel: Remove redundant check for empty blocks
Matt Arsenault [Sun, 9 Aug 2020 21:28:15 +0000 (17:28 -0400)]
GlobalISel: Remove redundant check for empty blocks

4 years agoAMDGPU/GlobalISel: Merge load/store select cases
Matt Arsenault [Sun, 9 Aug 2020 19:26:30 +0000 (15:26 -0400)]
AMDGPU/GlobalISel: Merge load/store select cases

4 years agoAMDGPU/GlobalISel: Fix typo
Matt Arsenault [Sun, 9 Aug 2020 16:10:49 +0000 (12:10 -0400)]
AMDGPU/GlobalISel: Fix typo

4 years agoAMDGPU/GlobalISel: Use nicer form of buildInstr
Matt Arsenault [Sun, 9 Aug 2020 16:01:47 +0000 (12:01 -0400)]
AMDGPU/GlobalISel: Use nicer form of buildInstr

4 years ago[InstCombine] auto-generate test checks; NFC
Sanjay Patel [Mon, 10 Aug 2020 12:27:19 +0000 (08:27 -0400)]
[InstCombine] auto-generate test checks; NFC

4 years agoRevert "[DebugInfo] Don't error for zero-length arange entries"
Nico Weber [Mon, 10 Aug 2020 12:20:35 +0000 (08:20 -0400)]
Revert "[DebugInfo] Don't error for zero-length arange entries"

This reverts commit cb3a598c87db2db997401b82dfb3f7f80707194e.
Breaks build of check-llvm dep obj2yaml everywhere.

4 years ago[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WA...
Aleksandr Platonov [Mon, 10 Aug 2020 12:11:25 +0000 (15:11 +0300)]
[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WANT_LIB_EXT1__` is not a literal.

If `__STDC_WANT_LIB_EXT1__` is not a literal (e.g. `#define __STDC_WANT_LIB_EXT1__ ((unsigned)1)`) bugprone-not-null-terminated-result check crashes.
Stack dump:
```
 #0 0x0000000002185e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x2185e6a)
 #1 0x0000000002183e8c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x2183e8c)
 #2 0x0000000002183ff3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x2183ff3)
 #3 0x00007f08d91b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00000000021338bb llvm::StringRef::getAsInteger(unsigned int, llvm::APInt&) const (/llvm-project/build/bin/clang-tidy+0x21338bb)
 #5 0x000000000052051c clang::tidy::bugprone::NotNullTerminatedResultCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x52051c)
```

Reviewed By: hokein

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

4 years ago[InstCombine] rearrange code for readability; NFC
Sanjay Patel [Mon, 10 Aug 2020 12:05:26 +0000 (08:05 -0400)]
[InstCombine] rearrange code for readability; NFC

The code comment refers to the path where we change the
size of the integer type, so handle that first, otherwise
deal with the general case.

4 years ago[clangd] Fix the background index is not disabled when using remote-index.
Haojian Wu [Mon, 10 Aug 2020 12:02:22 +0000 (14:02 +0200)]
[clangd] Fix the background index is not disabled when using remote-index.

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

4 years ago[DebugInfo] Don't error for zero-length arange entries
James Henderson [Wed, 5 Aug 2020 14:39:57 +0000 (15:39 +0100)]
[DebugInfo] Don't error for zero-length arange entries

Although the DWARF specification states that .debug_aranges entries
can't have length zero, these can occur in the wild. There's no
particular reason to enforce this part of the spec, since functionally
they have no impact. The patch removes the error and introduces a new
warning for premature terminator entries which does not stop parsing.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46805. See also
https://reviews.llvm.org/D71932 which originally introduced the error.

Reviewed by: ikudrin, dblaikie

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

4 years ago[LoopInterchange] Move instructions from preheader to outer loop header.
Florian Hahn [Mon, 10 Aug 2020 09:52:33 +0000 (10:52 +0100)]
[LoopInterchange] Move instructions from preheader to outer loop header.

Instructions defined in the original inner loop preheader may depend on
values defined in the outer loop header, but the inner loop header will
become the entry block in the loop nest. Move the instructions from the
preheader to the outer loop header, so we do not break dominance. We
also have to check for unsafe instructions in the preheader. If there
are no unsafe instructions, all instructions should be movable.

Currently we move all instructions except the terminator and rely on
LICM to hoist out invariant instructions later.

Fixes PR45743

4 years ago[LoopInterchange] Form LCSSA phis for values in orig outer loop header.
Florian Hahn [Mon, 10 Aug 2020 09:51:36 +0000 (10:51 +0100)]
[LoopInterchange] Form LCSSA phis for values in orig outer loop header.

Values defined in the outer loop header could be used in the inner loop
latch. In that case, we need to create LCSSA phis for them, because after
interchanging they will be defined in the new inner loop and used in the
new outer loop.

4 years ago[SyntaxTree] Implement the List construct.
Eduardo Caldas [Tue, 4 Aug 2020 17:33:36 +0000 (17:33 +0000)]
[SyntaxTree] Implement the List construct.

We defined a List construct to help with the implementation of list-like
grammar rules. This is a first implementation of this API.

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

4 years ago[PowerPC] Add intrinsic to read or set FPSCR register
Qiu Chaofan [Mon, 10 Aug 2020 10:25:01 +0000 (18:25 +0800)]
[PowerPC] Add intrinsic to read or set FPSCR register

This patch introduces two intrinsics: llvm.ppc.setflm and
llvm.ppc.readflm. They read from or write to FPSCR register
(floating-point status & control) which contains rounding mode and
exception status.

To ensure correctness of program, we need to prevent FP operations from
being moved across these intrinsics (mffs/mtfsf instruction), so here I
set them as scheduling boundaries. We can relax such restriction if
FPSCR is modeled well in the future.

Reviewed By: steven.zhang

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

4 years ago[ScalarizeMaskedMemIntrin][X86] Refresh missed transform test cases from rGc0c3b9a25fee
Simon Pilgrim [Mon, 10 Aug 2020 10:14:01 +0000 (11:14 +0100)]
[ScalarizeMaskedMemIntrin][X86] Refresh missed transform test cases from rGc0c3b9a25fee

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

4 years ago[ScalarizeMaskedMemIntrin] Scalarize constant mask expandload as shuffle(build_vector...
Simon Pilgrim [Mon, 10 Aug 2020 10:05:43 +0000 (11:05 +0100)]
[ScalarizeMaskedMemIntrin] Scalarize constant mask expandload as shuffle(build_vector,pass_through)

As noticed on D66004, scalarization of an expandload with a constant mask as a chain of irregular loads+inserts makes it tricky to optimize before lowering, resulting in difficulties in merging loads etc.

This patch instead scalarizes the expansion to a build_vector(load0, load1, undef, load2,....) style pattern and then performs a blend shuffle with the pass through vector. This allows us to more easily make use of all the build_vector combines, merging of consecutive loads etc.

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

4 years ago[lldb][NFC] Remove dead code in BreakpointResolverAddress
Raphael Isemann [Mon, 10 Aug 2020 09:29:40 +0000 (11:29 +0200)]
[lldb][NFC] Remove dead code in BreakpointResolverAddress

4 years ago[DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.
Igor Kudrin [Mon, 10 Aug 2020 08:56:30 +0000 (15:56 +0700)]
[DebugInfo] Fix initialization of DwarfCompileUnit::LabelBegin.

This also fixes the condition in the assertion in
DwarfCompileUnit::getLabelBegin() because it checked something unrelated
to the returned value.

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

4 years agoFree the memory allocated by mlirOperationStateAddXXX methods in mlirOperationCreate.
Jing Pu [Mon, 10 Aug 2020 08:32:24 +0000 (10:32 +0200)]
Free the memory allocated by mlirOperationStateAddXXX methods in mlirOperationCreate.

Previously, the memory leaks on heap. Since the MlirOperationState is not intended to be used again after mlirOperationCreate, the patch simplify frees the memory in mlirOperationCreate instead of creating any new API.

Reviewed By: ftynse

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

4 years agoAMDGPU/GlobalISel: Lower G_FREM
Petar Avramovic [Mon, 10 Aug 2020 08:10:46 +0000 (10:10 +0200)]
AMDGPU/GlobalISel: Lower G_FREM

Add custom lower for G_FREM.

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

4 years ago[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WA...
Aleksandr Platonov [Mon, 10 Aug 2020 07:23:08 +0000 (10:23 +0300)]
[clang-tidy] Fix a crash in bugprone-not-null-terminated-result check when `__STDC_WANT_LIB_EXT1__` was undefined after definition.

PP->getMacroInfo() returns nullptr for undefined macro, so we need to check this return value before dereference.
Stack dump:
```
 #0 0x0000000002185e6a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x2185e6a)
 #1 0x0000000002183e8c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x2183e8c)
 #2 0x0000000002183ff3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x2183ff3)
 #3 0x00007f37df9b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x000000000052054e clang::tidy::bugprone::NotNullTerminatedResultCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x52054e)
```

Reviewed By: hokein

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

4 years ago[Concepts] Dump template arguments for immediately declared constraint.
Haojian Wu [Mon, 10 Aug 2020 07:11:08 +0000 (09:11 +0200)]
[Concepts] Dump template arguments for immediately declared constraint.

The template arguments were dumped as part of the TemplateTypeParmDecl, which
was incorrect.

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

4 years ago[clang] Allow DynTypedNode to store a TemplateArgumentLoc
Nathan Ridge [Mon, 10 Aug 2020 00:37:18 +0000 (20:37 -0400)]
[clang] Allow DynTypedNode to store a TemplateArgumentLoc

The patch also adds a templateArgumentLoc() AST matcher.

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

4 years ago[NFC][StackSafety] Add a couple of early returns
Vitaly Buka [Sat, 8 Aug 2020 09:10:10 +0000 (02:10 -0700)]
[NFC][StackSafety] Add a couple of early returns

4 years agoMore cleanup after removing the ability to reference a dependent
Richard Smith [Mon, 10 Aug 2020 06:30:30 +0000 (23:30 -0700)]
More cleanup after removing the ability to reference a dependent
VarTemplateSpecializationDecl.

4 years ago[NFC][StackSafety] Count dataflow inputs
Vitaly Buka [Sat, 8 Aug 2020 21:00:42 +0000 (14:00 -0700)]
[NFC][StackSafety] Count dataflow inputs

4 years ago[NFC][Attributor] Add missing override
Vitaly Buka [Mon, 10 Aug 2020 06:30:27 +0000 (23:30 -0700)]
[NFC][Attributor] Add missing override

4 years agoImprove modeling of variable template specializations with dependent
Richard Smith [Thu, 16 Jul 2020 02:37:15 +0000 (19:37 -0700)]
Improve modeling of variable template specializations with dependent
arguments.

Don't build a variable template specialization declaration until its
scope and template arguments are non-dependent.

No functionality change intended, but the AST representation is now more
consistent with how we model other templates.

4 years ago[StackSafety] Fix union which produces wrapped sets
Vitaly Buka [Sat, 8 Aug 2020 09:05:04 +0000 (02:05 -0700)]
[StackSafety] Fix union which produces wrapped sets

4 years ago[NFC][StackSafety] Avoid assert in getBaseObjec
Vitaly Buka [Sat, 8 Aug 2020 00:28:05 +0000 (17:28 -0700)]
[NFC][StackSafety] Avoid assert in getBaseObjec

4 years agoAdd override to fix -Winconsistent-missing-override warning.
Eric Christopher [Mon, 10 Aug 2020 05:12:10 +0000 (22:12 -0700)]
Add override to fix -Winconsistent-missing-override warning.

4 years ago[TableGen] Pull the increment of a variable out of an assert.
Craig Topper [Mon, 10 Aug 2020 03:24:54 +0000 (20:24 -0700)]
[TableGen] Pull the increment of a variable out of an assert.

The variable is only used by the assert so the code was fine
before, but it was flagged in PR47072.

4 years ago[docs] Fix typos
Kazu Hirata [Mon, 10 Aug 2020 02:29:38 +0000 (19:29 -0700)]
[docs] Fix typos

4 years ago[BuildLibCalls] Add noundef to standard I/O functions
Juneyoung Lee [Mon, 10 Aug 2020 01:57:18 +0000 (10:57 +0900)]
[BuildLibCalls] Add noundef to standard I/O functions

This patch adds noundef to return value and arguments of standard I/O functions.
With this patch, passing undef or poison to the functions becomes undefined
behavior in LLVM IR. Since undef/poison is lowered from operations having UB in C/C++,
passing undef to them was already UB in source.

With this patch, the functions cannot return undef or poison anymore as well.
According to C17 standard, ungetc/ungetwc/fgetpos/ftell can generate unspecified
value; 3.19.3 says unspecified value is a valid value of the relevant type,
and using unspecified value is unspecified behavior, which is not UB, so it
cannot be undef (using undef is UB when e.g. it is used at branch condition).

— The value of the file position indicator after a successful call to the ungetc function for a text stream, or the ungetwc function for any stream, until all pushed-back characters are read or discarded (7.21.7.10, 7.29.3.10).
— The details of the value stored by the fgetpos function (7.21.9.1).
— The details of the value returned by the ftell function for a text stream (7.21.9.4).

In the long run, most of the functions listed in BuildLibCalls should have noundefs; to remove redundant diffs which will anyway disappear in the future, I added noundef to a few more non-I/O functions as well.

Reviewed By: jdoerfert

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

4 years ago[mlir][drr] Make error easier to understand
Jacques Pienaar [Mon, 10 Aug 2020 01:02:08 +0000 (18:02 -0700)]
[mlir][drr] Make error easier to understand

Changes error from
  error: referencing unbound symbol ''
to
  error: raw string not supported as argument

4 years agoRe-enable OpenBSD PowerPC64 tests.
Brad Smith [Mon, 10 Aug 2020 00:52:43 +0000 (20:52 -0400)]
Re-enable OpenBSD PowerPC64 tests.

4 years ago[Attributor][NFC][AAPotentialValues] Change interface of PotentialValuesState
Shinji Okumura [Mon, 10 Aug 2020 00:18:10 +0000 (09:18 +0900)]
[Attributor][NFC][AAPotentialValues] Change interface of PotentialValuesState

Previously `PotentialValuesState` inherited `BooleanState`.
We have to add `getAssumed` to the state in order to use `clampStateAndIndicateChange` (which will be used in `AAPotentialValuesArgument`).
However `BooleanState::getAssumed` is not a virtual function and we cannot override it.
Therefore, I changed the state not to inherit `BooleanState` and add `getAssumed` to it.

Reviewed By: jdoerfert

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

4 years agoint64_t and intmax_t are always (signed) long long on OpenBSD.
Brad Smith [Sun, 9 Aug 2020 23:43:16 +0000 (19:43 -0400)]
int64_t and intmax_t are always (signed) long long on OpenBSD.

4 years ago[StackSafety] Don't keep FullSet in index
Vitaly Buka [Sat, 8 Aug 2020 00:25:50 +0000 (17:25 -0700)]
[StackSafety] Don't keep FullSet in index

Optimization. Missing record is enterpreted as FullSet anyway.

4 years ago[StackSafety] Use getSignedMin() to serialize ranges
Vitaly Buka [Sun, 9 Aug 2020 21:28:17 +0000 (14:28 -0700)]
[StackSafety] Use getSignedMin() to serialize ranges

Almost NFC as it's important only for full sets which should not
be serialized at all.