platform/upstream/llvm.git
3 years ago[LLD][COFF] Simplify function. NFC.
Alexandre Ganea [Fri, 8 Jan 2021 03:36:59 +0000 (22:36 -0500)]
[LLD][COFF] Simplify function. NFC.

3 years agoFix MLIR DRR matching when attributes are interleaved with operands
Mehdi Amini [Fri, 8 Jan 2021 02:44:33 +0000 (02:44 +0000)]
Fix MLIR DRR matching when attributes are interleaved with operands

The ODSOperand indexing should ignore the attributes.

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

3 years ago[gn build] (manually) merge a whole bunch of libc++ header files
Nico Weber [Fri, 8 Jan 2021 03:02:00 +0000 (22:02 -0500)]
[gn build] (manually) merge a whole bunch of libc++ header files

I noticed __availability was missing, so I manually diffed the
file lists and put all recently(ish) added headers:
* __availability from 2eadbc86142ba
* concepts from 601f7631827ae
* execution from 0a06eb911b830
* numbers from 4f6c4b473c4a5

Also remove libcxx_install_support_headers like the CMake build did in
6706342f48bea, and unconditionally copy
support/win32/{limits_msvc_win32.h,locale_win32.h} like the CMake
build always did as far as I can tell.

3 years ago[gn build] Port b12f26733a4
LLVM GN Syncbot [Fri, 8 Jan 2021 02:19:24 +0000 (02:19 +0000)]
[gn build] Port b12f26733a4

3 years agoRevert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations...
David Blaikie [Fri, 8 Jan 2021 01:01:17 +0000 (17:01 -0800)]
Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""

This reverts commit d2ddc694ff94743d9735aaf07edcaf6db8aaca04.

This still contains a circular dependency between Analysis and CrossTU:

$ grep -r include.*Analysis clang/include/clang/CrossTU
clang/include/clang/CrossTU/CrossTranslationUnit.h:
  #include "clang/Analysis/CrossTUAnalysisHelper.h"
$ grep -r include.*CrossTU clang/lib/Analysis
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp:
  #include "clang/CrossTU/CrossTranslationUnit.h"
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp:
  #include "clang/Analysis/CrossTUAnalysisHelper.h"

3 years ago[builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS
Ryan Prichard [Fri, 8 Jan 2021 01:49:29 +0000 (17:49 -0800)]
[builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS

On Android, when the builtins are linked into a binary, they are
typically linked using -Wl,--exclude-libs so that the symbols aren't
reexported. For the NDK, compiler-rt's default behavior (build the
builtins archive with -fvisibility=hidden) is better so that builtins
are hidden even without -Wl,--exclude-libs.

Android needs the builtins with non-hidden symbols only for a special
case: for backwards compatibility with old binaries, the libc.so and
libm.so DSOs in the platform need to export some builtins for arm32 and
32-bit x86. See D56977.

Control the behavior with a new flag,
`COMPILER_RT_BUILTINS_HIDE_SYMBOLS`, that behaves similarly to the
`*_HERMETIC_STATIC_LIBRARY` in libunwind/libcxx/libcxxabi, so that
Android can build a special builtins variant for libc.so/libm.so.

Unlike the hermetic flags for other projects, this new flag is enabled
by default.

Reviewed By: compnerd, MaskRay

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

3 years ago[clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64
clementval [Fri, 8 Jan 2021 01:07:53 +0000 (20:07 -0500)]
[clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

While trying to compile clang and openmp with a freshly built clang with the gcc/7.4.0
toolchain on the Summit supercomputer I face some error because of the triple under which
the GCC toolchain is installed was not present in for PPC64LE triples.
This patch add the powerpc64le-none-linux-gnu used on system like Summit and Ascent.

Reviewed By: jdenny

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

3 years ago[Cloning] Copy metadata of global declarations
Ruiling Song [Thu, 17 Dec 2020 00:03:20 +0000 (08:03 +0800)]
[Cloning] Copy metadata of global declarations

We have modules with metadata on declarations, and out-of-tree passes
use that metadata, and we need to clone those modules. We really expect
such metadata is kept during the clone operation.

Reviewed by: arsenm, aprantl

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

3 years agoFix build after eaadb41db6233cf1c9e882d74a31c1f9d6e211ff when the MSVC libs are not...
Alexandre Ganea [Thu, 7 Jan 2021 23:51:51 +0000 (18:51 -0500)]
Fix build after eaadb41db6233cf1c9e882d74a31c1f9d6e211ff when the MSVC libs are not in PATH.

3 years ago[RISCV] Define the vfsqrt RVV intrinsics
Evandro Menezes [Wed, 23 Dec 2020 06:43:15 +0000 (00:43 -0600)]
[RISCV] Define the vfsqrt RVV intrinsics

Define the `vfsqrt` IR intrinsics for the respective V instructions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Evandro Menezes <evandro.menezes@sifive.com>
Differential Revision: https://reviews.llvm.org/D93745

3 years ago[SimplifyCFG] markAliveBlocks(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 22:12:30 +0000 (01:12 +0300)]
[SimplifyCFG] markAliveBlocks(): switch to non-permissive DomTree updates

No actual changes needed, invoke can't have the same block as an unwind
destination and a normal destination.

3 years ago[SimplifyCFG] removeUnwindEdge(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 22:08:23 +0000 (01:08 +0300)]
[SimplifyCFG] removeUnwindEdge(): switch to non-permissive DomTree updates

No actual changes needed, Catchswitch cannot unwind to one of its catchpads.

3 years ago[SimplifyCFG] changeToCall(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 21:58:49 +0000 (00:58 +0300)]
[SimplifyCFG] changeToCall(): switch to non-permissive DomTree updates

No actual changes needed, normal and unwind destinations of an invoke
can never be identical.

3 years ago[SimplifyCFG] DeleteDeadBlocks(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 21:52:20 +0000 (00:52 +0300)]
[SimplifyCFG] DeleteDeadBlocks(): switch to non-permissive DomTree updates

No actual changes needed, DetatchDeadBlocks() was already doing the right thing.

3 years ago[SimplifyCFG] MergeBlockIntoPredecessor(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 21:51:29 +0000 (00:51 +0300)]
[SimplifyCFG] MergeBlockIntoPredecessor(): switch to non-permissive DomTree updates

... which requires not deleting edges that were just deleted already,
    by not processing the same successor more than once.

3 years ago[SimplifyCFG] changeToUnreachable(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 20:55:21 +0000 (23:55 +0300)]
[SimplifyCFG] changeToUnreachable(): switch to non-permissive DomTree updates

... which requires not deleting edges that were just deleted already,
    by not processing the same predecessor more than once.

3 years ago[NFC][SimplifyCFG] Add a test with an undef cond branch to identical destinations
Roman Lebedev [Thu, 7 Jan 2021 21:10:50 +0000 (00:10 +0300)]
[NFC][SimplifyCFG] Add a test with an undef cond branch to identical destinations

3 years ago[SimplifyCFG] removeUnreachableBlocks(): switch to non-permissive DomTree updates
Roman Lebedev [Thu, 7 Jan 2021 20:32:30 +0000 (23:32 +0300)]
[SimplifyCFG] removeUnreachableBlocks(): switch to non-permissive DomTree updates

... which requires not deleting edges that were just deleted already,
    by not processing the same predecessor more than once.

3 years ago[NFC][SimplifyCFG] Add test with an unreachable block with two identical successors
Roman Lebedev [Thu, 7 Jan 2021 20:23:36 +0000 (23:23 +0300)]
[NFC][SimplifyCFG] Add test with an unreachable block with two identical successors

3 years ago[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock(): switch to non-permissive...
Roman Lebedev [Thu, 7 Jan 2021 20:10:43 +0000 (23:10 +0300)]
[SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock(): switch to non-permissive DomTree updates

... which requires not deleting edges that were just deleted already,
    by not processing the same predecessor more than once.

3 years ago[SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates...
Roman Lebedev [Thu, 7 Jan 2021 19:32:04 +0000 (22:32 +0300)]
[SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates in `indirectbr` handling

... which requires not deleting edges that were just deleted already.

3 years ago[NFC][SimlifyCFG] Add some indirectbr-of-blockaddress tests
Roman Lebedev [Thu, 7 Jan 2021 19:21:50 +0000 (22:21 +0300)]
[NFC][SimlifyCFG] Add some indirectbr-of-blockaddress tests

3 years ago[SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates...
Roman Lebedev [Thu, 7 Jan 2021 18:51:19 +0000 (21:51 +0300)]
[SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates in `SwitchInst` handling

... which requires not deleting edges that will still be present.

3 years ago[SimplifyCFG] ConstantFoldTerminator(): handle matching destinations of condbr earlier
Roman Lebedev [Thu, 7 Jan 2021 18:18:50 +0000 (21:18 +0300)]
[SimplifyCFG] ConstantFoldTerminator(): handle matching destinations of condbr earlier

We need to handle this case before dealing with the case of constant
branch condition, because if the destinations match, latter fold
would try to remove the DomTree edge that would still be present.

This allows to make that particular DomTree update non-permissive

3 years ago[NFC][SimplifyCFG] Add a test with cond br on constant w/ identical destinations
Roman Lebedev [Thu, 7 Jan 2021 18:16:48 +0000 (21:16 +0300)]
[NFC][SimplifyCFG] Add a test with cond br on constant w/ identical destinations

3 years ago[NewPM][NVPTX] Port NVPTX opt passes
Arthur Eubanks [Wed, 30 Dec 2020 04:48:27 +0000 (20:48 -0800)]
[NewPM][NVPTX] Port NVPTX opt passes

There are only two used in the IR optimization pipeline.
Port these and add them to the default pipeline.

Similar to https://reviews.llvm.org/D93863.

I added -mtriple to some tests since under the new PM, the passes are
only available when the TargetMachine is specified.

Reviewed By: rnk

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

3 years ago[libc++] Alphabetize generate_feature_test_macro_components.py. NFCI.
Arthur O'Dwyer [Thu, 7 Jan 2021 23:04:41 +0000 (18:04 -0500)]
[libc++] Alphabetize generate_feature_test_macro_components.py. NFCI.

For ease of comparing our list with the official SD-6 list, which is alphabetized.
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#library-feature-test-macros
This also alphabetizes the lists of headers in which the macros are
defined, which harmlessly alters many comments in <version>.
Also drive-by-fix some trivial flake8 warnings.

3 years ago[NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline
Arthur Eubanks [Wed, 30 Dec 2020 03:54:32 +0000 (19:54 -0800)]
[NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline

In https://reviews.llvm.org/D88138 this was incorrectly added with
registerOptimizerLastEPCallback(), when it should be
registerLoopOptimizerEndEPCallback(), matching the legacy PM's
EP_LoopOptimizerEnd.

Reviewed By: rnk

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

3 years ago[LLDB][RISCV] Add RISC-V ArchSpec and rv32/rv64 variant detection
Luís Marques [Thu, 7 Jan 2021 23:01:27 +0000 (23:01 +0000)]
[LLDB][RISCV] Add RISC-V ArchSpec and rv32/rv64 variant detection

Adds the RISC-V ArchSpec bits contributed by @simoncook as part of D62732,
plus logic to distinguish between riscv32 and riscv64 based on ELF class.

The patch follows the implementation approach previously used for MIPS.
It defines RISC-V architecture subtypes and inspects the ELF header,
namely the ELF class, to detect the right subtype.

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

3 years ago[OpenMP] Always print error messages in libomptarget CUDA plugin
Joseph Huber [Thu, 7 Jan 2021 21:43:01 +0000 (16:43 -0500)]
[OpenMP] Always print error messages in libomptarget CUDA plugin

Summary:
Currently error messages from the CUDA plugins are only printed to the user if they have debugging enabled. Change this behaviour to always print the messages that result in offloading failure. This improves the error messages by indidcating what happened when the error occurs in the plugin library, such as a segmentation fault on the device.

Reviewed by: jdoerfert

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

3 years ago[hip] Enable HIP compilation with `<complex`> on MSVC.
Michael Liao [Thu, 7 Jan 2021 10:24:12 +0000 (05:24 -0500)]
[hip] Enable HIP compilation with `<complex`> on MSVC.

- MSVC has different `<complex>` implementation which calls into functions
  declared in `<ymath.h>`. Provide their device-side implementation to enable
  `<complex>` compilation on HIP Windows.

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

3 years agoGlobalISel: Fail legalization on narrowing extload below memory size
Matt Arsenault [Wed, 6 Jan 2021 04:25:18 +0000 (23:25 -0500)]
GlobalISel: Fail legalization on narrowing extload below memory size

3 years ago[libc++] Fix typo in run-buildbot
Louis Dionne [Thu, 7 Jan 2021 22:37:09 +0000 (17:37 -0500)]
[libc++] Fix typo in run-buildbot

The installation directory was never meant to contain a brace.

3 years agolldb: Add support for DW_AT_ranges on DW_TAG_subprograms
David Blaikie [Tue, 5 Jan 2021 06:44:59 +0000 (22:44 -0800)]
lldb: Add support for DW_AT_ranges on DW_TAG_subprograms

gcc already produces debug info with this form
-freorder-block-and-partition
clang produces this sort of thing with -fbasic-block-sections and with a
coming-soon tweak to use ranges in DWARFv5 where they can allow greater
reuse of debug_addr than the low/high_pc forms.

This fixes the case of breaking on a function name, but leaves broken
printing a variable - a follow-up commit will add that and improve the
test case to match.

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

3 years ago[LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under...
Alexandre Ganea [Thu, 7 Jan 2021 21:32:47 +0000 (16:32 -0500)]
[LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under /DEBUG:GHASH

Before this patch, when using LLD with /DEBUG:GHASH and MSVC precomp.OBJ files, we had a bunch of:

lld-link: warning: S_[GL]PROC32ID record in blabla.obj refers to PDB item index 0x206ED1 which is not a LF[M]FUNC_ID record

This was caused by LF_FUNC_ID and LF_MFUNC_ID which didn't have correct mapping to the corresponding TPI records. The root issue was that the indexMapStorage was improperly re-assembled in UsePrecompSource::remapTpiWithGHashes.

After this patch, /DEBUG and /DEBUG:GHASH produce exactly the same debug infos in the PDB.

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

3 years ago[TableGen] Make CodeGenDAGPatterns::getSDNodeNamed take a StringRef instead of const...
Craig Topper [Thu, 7 Jan 2021 22:15:03 +0000 (14:15 -0800)]
[TableGen] Make CodeGenDAGPatterns::getSDNodeNamed take a StringRef instead of const std::string &.

All callers use a string literal and the getDef method the string
is passed to already takes a StringRef.

3 years agoFixup Asserts+!AbiBreakingChecks fallout from db33f85c7124
David Blaikie [Thu, 7 Jan 2021 22:17:24 +0000 (14:17 -0800)]
Fixup Asserts+!AbiBreakingChecks fallout from db33f85c7124

3 years ago[CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones
Arthur Eubanks [Thu, 7 Jan 2021 20:45:23 +0000 (12:45 -0800)]
[CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones

Apparently there can be no clones, as happens in
coro-retcon-unreachable.ll.

The alternative is to allow no split functions in
addSplitRefRecursiveFunctions(), but it seems better to have the caller
make sure it's not accidentally splitting no functions out.

Reviewed By: rnk

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

3 years ago[test] Move coro-retcon-unreachable.ll into llvm/test
Arthur Eubanks [Thu, 7 Jan 2021 20:33:10 +0000 (12:33 -0800)]
[test] Move coro-retcon-unreachable.ll into llvm/test

Reviewed By: rjmccall

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

3 years ago[libc++abi] Simplify __gxx_personality_v0
Fangrui Song [Thu, 7 Jan 2021 22:05:46 +0000 (14:05 -0800)]
[libc++abi] Simplify __gxx_personality_v0

In three cases we call `scan_eh_tab` to parse LSDA:

* `actions & _UA_SEARCH_PHASE`
* `actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && !native_exception`
* `actions & _UA_CLEANUP_PHASE && !(actions & _UA_HANDLER_FRAME)`

Check
`actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && native_exception` first,
then we can move three `scan_eh_tab` into one place.

Another simplification is that we can check whether the result of `scan_eh_tab`
is `_UA_CONTINUE_UNWIND` or `_UA_FATAL_PHASE1_ERROR` first. Then many of the
original checks will be dead and can thus be deleted.

Reviewed By: #libc_abi, ldionne

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

3 years ago[NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name
Jeroen Dobbelaere [Thu, 7 Jan 2021 21:39:02 +0000 (16:39 -0500)]
[NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

This makes the test more robust to other changes.

Reviewed By: tianshilei1992

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

3 years agoGlobalISel: Add combine for G_UREM by power of 2
Matt Arsenault [Wed, 6 Jan 2021 23:45:12 +0000 (18:45 -0500)]
GlobalISel: Add combine for G_UREM by power of 2

Really I want this in the legalizer, but this is a start.

3 years agoFix check-gdb-mlir-support build after MLIR API changed to take Context as first...
Mehdi Amini [Thu, 7 Jan 2021 21:30:39 +0000 (21:30 +0000)]
Fix check-gdb-mlir-support build after MLIR API changed to take Context as first argument

3 years agoFix include path for check-gdb-mlir-support to include the MLIR binary dir
Mehdi Amini [Thu, 7 Jan 2021 21:25:59 +0000 (21:25 +0000)]
Fix include path for check-gdb-mlir-support to include the MLIR binary dir

This fixes a build failure:

fatal error: 'mlir/IR/BuiltinTypes.h.inc' file not found

3 years ago[OpenMP][FIX] Avoid string literal comparison, use `StringRef::equal`
Johannes Doerfert [Thu, 7 Jan 2021 20:48:50 +0000 (14:48 -0600)]
[OpenMP][FIX] Avoid string literal comparison, use `StringRef::equal`

3 years ago[mlir] Adds argument attributes for using LLVM's sret and byval attributes
Eric Schweitz [Thu, 7 Jan 2021 20:50:20 +0000 (12:50 -0800)]
[mlir] Adds argument attributes for using LLVM's sret and byval attributes
to the conversion of LLVM IR dialect. These attributes are used in FIR to
support the lowering of Fortran using target-specific calling conventions.

Add roundtrip tests.

Add changes per review comments/concerns.

Reviewed By: ftynse

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

3 years ago[llvm-pdbutil] Don't crash when printing unknown CodeView type records
Alexandre Ganea [Thu, 7 Jan 2021 20:41:47 +0000 (15:41 -0500)]
[llvm-pdbutil] Don't crash when printing unknown CodeView type records

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

3 years ago[OpenMP][Docs] Mark finished features as done
Johannes Doerfert [Wed, 6 Jan 2021 19:16:25 +0000 (13:16 -0600)]
[OpenMP][Docs] Mark finished features as done

Reviewed By: ABataev

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

3 years ago[clang] Change builtin object size when subobject is invalid
Jeffrey T Mott [Thu, 7 Jan 2021 19:56:32 +0000 (11:56 -0800)]
[clang] Change builtin object size when subobject is invalid

Motivating example:

```
  struct { int v[10]; } t[10];

  __builtin_object_size(
      &t[0].v[11], // access past end of subobject
      1            // request remaining bytes of closest surrounding
                   // subobject
  );
```

In GCC, this returns 0. https://godbolt.org/z/7TeGs7

In current clang, however, this returns 356, the number of bytes
remaining in the whole variable, as if the `type` was 0 instead of 1.
https://godbolt.org/z/6Kffox

This patch checks for the specific case where we're requesting a
subobject's size (type 1) but the subobject is invalid.

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

3 years ago[OpenMP][FIX] Ensure the isa trait is evaluated last
Johannes Doerfert [Thu, 24 Dec 2020 00:16:57 +0000 (18:16 -0600)]
[OpenMP][FIX] Ensure the isa trait is evaluated last

Since isa can cause diagnostics we want it to be evaluated last to avoid
the "unknown isa" warning if the rest of the selector wouldn't match
anyway. That allows us to guard isa with arch properly.

Reviewed By: jhuber6

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

3 years ago[OpenMP][Fix] Make the arch selector for x86_64 work
Johannes Doerfert [Wed, 23 Dec 2020 23:58:07 +0000 (17:58 -0600)]
[OpenMP][Fix] Make the arch selector for x86_64 work

The triple uses a bar "x86-64" instead of an underscore. Since we
have troubles accepting x86-64 as an identifier, we stick with
x86_64 in the frontend and translate it explicitly.

Reviewed By: tianshilei1992

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

3 years ago[OpenMP][Docs] Add remarks intro section
Johannes Doerfert [Wed, 23 Dec 2020 23:55:03 +0000 (17:55 -0600)]
[OpenMP][Docs] Add remarks intro section

Reviewed By: jhuber6

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

3 years ago[Clang][Driver] Fix read-after-free when using /clang:
Alexandre Ganea [Thu, 7 Jan 2021 19:45:40 +0000 (14:45 -0500)]
[Clang][Driver] Fix read-after-free when using /clang:

Fixes PR42501.

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

3 years agoFix gcc5 build failure (NFC)
Mehdi Amini [Thu, 7 Jan 2021 19:59:37 +0000 (19:59 +0000)]
Fix gcc5 build failure (NFC)

The loop index was shadowing the container name.
It seems that we can just not use a for-range loop here since there is
an induction variable anyway.

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

3 years ago[OpenMP] Add example in Libomptarget Information docs
Joseph Huber [Thu, 7 Jan 2021 18:41:49 +0000 (13:41 -0500)]
[OpenMP] Add example in Libomptarget Information docs

Add an example to the OpenMP Documentation on the LIBOMPTARGET_INFO environment variable

Reviewed By: jdoerfert

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

3 years ago[NFC][AMDGPU] Reduce include files dependency.
dfukalov [Fri, 25 Dec 2020 15:52:14 +0000 (18:52 +0300)]
[NFC][AMDGPU] Reduce include files dependency.

Reviewed By: rampitec

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

3 years agoSimplify vectorcall argument classification of HVAs, NFC
Reid Kleckner [Thu, 7 Jan 2021 18:21:44 +0000 (10:21 -0800)]
Simplify vectorcall argument classification of HVAs, NFC

This reduces the number of `WinX86_64ABIInfo::classify` call sites from
3 to 1. The call sites were similar, but passed different values for
FreeSSERegs. Use variables instead of `if`s to manage that argument.

3 years ago[SLP] remove opcode identifier for reduction; NFC
Sanjay Patel [Thu, 7 Jan 2021 19:06:10 +0000 (14:06 -0500)]
[SLP] remove opcode identifier for reduction; NFC

Another step towards allowing intrinsics in reduction matching.

3 years ago[mlir] don't match the text produced only in debug mode in Python tests
Alex Zinenko [Thu, 7 Jan 2021 10:29:17 +0000 (11:29 +0100)]
[mlir] don't match the text produced only in debug mode in Python tests

Some Python bindings tests were using FileCheck to match parts of the
error description produced only in the debug compilation mode. Remove
these parts (but keep the main message) to ensure tests also pass when
running them in the release compilation mode.

Reviewed By: mehdi_amini

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

3 years ago[mlir] replace LLVMIntegerType with built-in integer type
Alex Zinenko [Wed, 6 Jan 2021 15:19:04 +0000 (16:19 +0100)]
[mlir] replace LLVMIntegerType with built-in integer type

The LLVM dialect type system has been closed until now, i.e. did not support
types from other dialects inside containers. While this has had obvious
benefits of deriving from a common base class, it has led to some simple types
being almost identical with the built-in types, namely integer and floating
point types. This in turn has led to a lot of larger-scale complexity: simple
types must still be converted, numerous operations that correspond to LLVM IR
intrinsics are replicated to produce versions operating on either LLVM dialect
or built-in types leading to quasi-duplicate dialects, lowering to the LLVM
dialect is essentially required to be one-shot because of type conversion, etc.
In this light, it is reasonable to trade off some local complexity in the
internal implementation of LLVM dialect types for removing larger-scale system
complexity. Previous commits to the LLVM dialect type system have adapted the
API to support types from other dialects.

Replace LLVMIntegerType with the built-in IntegerType plus additional checks
that such types are signless (these are isolated in a utility function that
replaced `isa<LLVMType>` and in the parser). Temporarily keep the possibility
to parse `!llvm.i32` as a synonym for `i32`, but add a deprecation notice.

Reviewed By: mehdi_amini, silvas, antiagainst

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

3 years ago[WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION
Wouter van Oortmerssen [Wed, 6 Jan 2021 00:58:21 +0000 (16:58 -0800)]
[WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION

A struct in C passed by value did not get debug information. Such values are currently
lowered to a Wasm local even in -O0 (not to an alloca like on other archs), which becomes
a Target Index operand (TI_LOCAL). The DWARF writing code was not emitting locations
in for TI's specifically if the location is a single range (not a list).

In addition, the ExplicitLocals pass which removes the ARGUMENT pseudo instructions did
not update the associated DBG_VALUEs, and couldn't even find these values since the code
assumed such instructions are adjacent, which is not the case here.

Also fixed asm printing of TIs needed by a test.

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

3 years agoCodeGen: Refactor regallocator command line and target selection
Matt Arsenault [Fri, 22 Feb 2019 18:15:39 +0000 (13:15 -0500)]
CodeGen: Refactor regallocator command line and target selection

Make the sequence of passes to select and rewrite instructions to
physical registers be a target callback. This is to prepare to allow
targets to split register allocation into multiple phases.

3 years ago[PGO][PGSO] Let unroll hints take precedence over PGSO.
Hiroshi Yamauchi [Wed, 6 Jan 2021 22:42:26 +0000 (14:42 -0800)]
[PGO][PGSO] Let unroll hints take precedence over PGSO.

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

3 years agoSilence warning: comparison of integers of different signs: 'const unsigned int'...
Alexandre Ganea [Sun, 27 Dec 2020 19:15:50 +0000 (14:15 -0500)]
Silence warning: comparison of integers of different signs: 'const unsigned int' and 'const long' [-Wsign-compare]

(off_t being a signed type)

3 years ago[NFC] Removed unused prefixes from CodeGen/AMDGPU
Mircea Trofin [Thu, 7 Jan 2021 16:26:45 +0000 (08:26 -0800)]
[NFC] Removed unused prefixes from CodeGen/AMDGPU

Last bulk batch.

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

3 years agoFix GCC5 build, require explicit this->... in this call inside a lambda (NFC)
Mehdi Amini [Thu, 7 Jan 2021 17:42:55 +0000 (17:42 +0000)]
Fix GCC5 build, require explicit this->... in this call inside a lambda (NFC)

Error was:

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp:2247:36: error: cannot call member function 'mlir::LLVM::FastmathFlags mlir::LLVM::FMFAttr::getFlags() const' without object
     return bitEnumContains(getFlags(), flag);
                                    ^

3 years ago[mlir] revert 82f5ee3c3e601daad5
Eric Schweitz [Thu, 7 Jan 2021 17:38:21 +0000 (09:38 -0800)]
[mlir] revert 82f5ee3c3e601daad5

3 years ago[Coverage] Refactor three tests from commit rG9f2967bcfe2f
Alan Phipps [Wed, 6 Jan 2021 23:40:32 +0000 (17:40 -0600)]
[Coverage] Refactor three tests from commit rG9f2967bcfe2f

Refactor three tests to not depend on other test files as input but to instead
refer to "Inputs" subdirectory.

3 years agoAdd element-type to the Vector TypeLoc types.
Erich Keane [Thu, 17 Dec 2020 20:09:11 +0000 (12:09 -0800)]
Add element-type to the Vector TypeLoc types.

As shown by bug 48540, GCC vector types would cause a crash when the
declaration hada ParenType. This was because the walking of the
declaration would try to expand the 'inner' type, but there was no
ability to get it from the vector type.  This patch adds that element
type access to the vector type loc objects.

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

3 years ago[AST][NFC] Silence GCC warning about multiline comments
Thomas Preud'homme [Tue, 1 Dec 2020 18:08:31 +0000 (18:08 +0000)]
[AST][NFC] Silence GCC warning about multiline comments

Remove continuation line in code snippet to prevent GCC warning about
multiline comments (-Wcomment) when building a project using libclang
with GCC.

Reviewed By: rjmccall

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

3 years ago[mlir] NFC: fix trivial typos
Kazuaki Ishizaki [Thu, 7 Jan 2021 17:09:48 +0000 (02:09 +0900)]
[mlir] NFC: fix trivial typos

fix typo under include and lib directories

Reviewed By: antiagainst

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

3 years ago[NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute...
Jeroen Dobbelaere [Thu, 7 Jan 2021 17:03:56 +0000 (17:03 +0000)]
[NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute id changes

When introducing support for @llvm.experimental.noalias.scope.decl, this tests started failing because it checks
(for no good reason) for a function attribute id of '#8' which now becomes '#9'

Reviewed By: pratlucas

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

3 years agoAdds argument attributes for using LLVM's sret and byval attributes to
Eric Schweitz [Tue, 5 Jan 2021 00:32:48 +0000 (16:32 -0800)]
Adds argument attributes for using LLVM's sret and byval attributes to
the conversion of LLVM IR dialect. These attributes are used in FIR to
support the lowering of Fortran using target-specific calling
conventions.

Add roundtrip tests. Add changes per review comments/concerns.

Reviewed By: ftynse

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

3 years ago[IR] Use LLVM_ENABLE_ABI_BREAKING_CHECKS to guard ABI changes.
Varun Gandhi [Thu, 17 Dec 2020 01:01:12 +0000 (17:01 -0800)]
[IR] Use LLVM_ENABLE_ABI_BREAKING_CHECKS to guard ABI changes.

Incorrect usage of NDEBUG to guard ABI changes can prevent clients
from enabling assertions for their C++ code while having assertions in
LLVM turned off. So we use LLVM_ENABLE_ABI_BREAKING_CHECKS instead, as
described in llvm/docs/ProgrammersManual.rst. Most types already use this
macro, however, there were a couple of stragglers in ValueHandle.h, which
are fixed by this revision.

Reviewed By: dblaikie, dexonsmith

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

3 years ago[NFC] Removed unused prefixes in CodeGen/AMDGPU
Mircea Trofin [Wed, 6 Jan 2021 18:34:21 +0000 (10:34 -0800)]
[NFC] Removed unused prefixes in CodeGen/AMDGPU

This covers tests starting with s.

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

3 years ago[SVE] Add unpacked scalable floating point ZIP/UZP/TRN patterns
Cameron McInally [Thu, 7 Jan 2021 15:47:50 +0000 (09:47 -0600)]
[SVE] Add unpacked scalable floating point ZIP/UZP/TRN patterns

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

3 years ago[DDG] Data Dependence Graph - DOT printer tests
Bardia Mahjour [Thu, 7 Jan 2021 15:51:14 +0000 (10:51 -0500)]
[DDG] Data Dependence Graph - DOT printer tests

Adds some tests to check the formatting of the dot
file produced when using -dot-ddg.

Reviewed By: Meinersbur

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

3 years agoAMDGPU/GlobalISel: Start cleaning up calling convention lowering
Matt Arsenault [Tue, 7 Jul 2020 21:49:52 +0000 (17:49 -0400)]
AMDGPU/GlobalISel: Start cleaning up calling convention lowering

There are various hacks working around limitations in
handleAssignments, and the logical split between different parts isn't
correct. Start separating the type legalization to satisfy going
through the DAG infrastructure from the code required to split into
register types. The type splitting should be moved to generic code.

3 years ago[DDG] Fix duplicate edge removal during pi-block formation
Bardia Mahjour [Thu, 7 Jan 2021 15:31:11 +0000 (10:31 -0500)]
[DDG] Fix duplicate edge removal during pi-block formation

When creating pi-blocks we try to avoid creating duplicate edges
between outside nodes and the pi-block when an edge is of the
same kind and direction as another one that has already been
created. We do this by keeping track of the edges in an
enumerated array called EdgeAlreadyCreated. The problem is that
this array is declared local to the loop that iterates over the
nodes in the pi-block, so the information gets lost every time a
new inside-node is iterated over. The fix is to move the
declaration to the outer loop.

Reviewed By: Meinersbur

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

3 years ago[SimplifyCFG] FoldValueComparisonIntoPredecessors(): drop reachable errneous assert
Roman Lebedev [Thu, 7 Jan 2021 15:04:37 +0000 (18:04 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): drop reachable errneous assert

I have added it in d15d81c because it *seemed* correct, was holding
for all the tests so far, and was validating the fix added in the same
commit, but as David Major is pointing out (with a reproducer),
the assertion isn't really correct after all. So remove it.

Note that the d15d81c still fine.

3 years ago[llvm-reduce] ReduceGlobalVarInitializers delta pass: fix handling of globals w/...
Roman Lebedev [Thu, 7 Jan 2021 14:28:25 +0000 (17:28 +0300)]
[llvm-reduce] ReduceGlobalVarInitializers delta pass: fix handling of globals w/ comdat/non-external linkage

Much like with ReduceFunctionBodies delta pass,
we need to remove comdat and set linkage to external,
else verifier will complain, and our deltas are invalid.

3 years ago[SplitEdge] Add new parameter to SplitEdge to name the newly created basic block
Sidharth Baveja [Thu, 7 Jan 2021 14:49:23 +0000 (14:49 +0000)]
[SplitEdge] Add new parameter to SplitEdge to name the newly created basic block

Summary:
Currently SplitEdge does not support passing in parameter which allows you to
name the newly created BasicBlock.

This patch updates the function such that the name of the block can be passed
in, if users of this utility decide to do so.

Reviewed By: Whitney, bmahjour, asbirlea, jamieschmeiser

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

3 years ago[TableGen] Add field kind to the RecordVal class.
Paul C. Anagnostopoulos [Thu, 31 Dec 2020 19:50:51 +0000 (14:50 -0500)]
[TableGen] Add field kind to the RecordVal class.

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

3 years ago[flang][openacc] Enforce delcare directive restriction
Valentin Clement [Thu, 7 Jan 2021 14:25:00 +0000 (09:25 -0500)]
[flang][openacc] Enforce delcare directive restriction

Add semantic check for most of the restrictions for the declare directive.

Reviewed By: kiranktp

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

3 years ago[AArch64] SVEIntrinsicOpts - use range loop and cast<> instead of dyn_cast<> for...
Simon Pilgrim [Thu, 7 Jan 2021 14:21:29 +0000 (14:21 +0000)]
[AArch64] SVEIntrinsicOpts - use range loop and cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

Don't directly dereference a dyn_cast<> - use cast<> so we assert for the correct type.

Also, simplify the for loop to a range loop.

Fixes clang static analyzer warning.

3 years ago[Analysis] MemoryDepChecker::couldPreventStoreLoadForward - remove dead store. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 13:58:13 +0000 (13:58 +0000)]
[Analysis] MemoryDepChecker::couldPreventStoreLoadForward - remove dead store. NFCI.

As we're breaking from the loop when clamping MaxVF, clang static analyzer was warning that the VF iterator was being updated and never used.

3 years ago[flang][driver] Rename driver tests (nfc)
Andrzej Warzynski [Thu, 7 Jan 2021 14:03:39 +0000 (14:03 +0000)]
[flang][driver] Rename driver tests (nfc)

As per [1]:
```
File names should use dashes, not underscores.
```

This patch updates the names of Flang driver tests accordingly.

[1] https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md

3 years ago[AArch64][CostModel]Fix gather scatter cost model
Caroline Concatto [Thu, 7 Jan 2021 09:07:06 +0000 (09:07 +0000)]
[AArch64][CostModel]Fix gather scatter cost model

This patch fixes a bug introduced in the patch:
https://reviews.llvm.org/D93030

This patch pulls the test for scalable vector to be the first instruction
to be checked. This avoids the Gather and Scatter cost model for AArch64 to
compute the number of vector elements for something that is not a vector and
therefore crashing.

3 years ago[clang][cli] NFC: Make parsing macro reusable
Jan Svoboda [Wed, 6 Jan 2021 14:18:43 +0000 (15:18 +0100)]
[clang][cli] NFC: Make parsing macro reusable

This is necessary for a future patch, where we start using this macro in another function.

Reviewed By: dexonsmith

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

3 years ago[mlir] remove a use of deprecated OpState::setAttr
Alex Zinenko [Thu, 7 Jan 2021 13:19:30 +0000 (14:19 +0100)]
[mlir] remove a use of deprecated OpState::setAttr

3 years ago[clang][cli] NFC: Move parseSimpleArgs
Jan Svoboda [Wed, 6 Jan 2021 13:58:19 +0000 (14:58 +0100)]
[clang][cli] NFC: Move parseSimpleArgs

This patch moves `parseSimpleArgs` closer to `ParseDiagnosticArgs` so that sharing the parsing macro between them can be done more locally in a future patch.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs
Jan Svoboda [Tue, 22 Dec 2020 14:05:16 +0000 (15:05 +0100)]
[clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs

Before this patch, ParseDiagnosticArgs can be called with a nullptr DiagnosticsEngine *. This happens early on in the compilation process, where no proper DiagnosticEngine exists, because the diagnostic options (passed through command line) are not known yet.

This patch ensures nullptr is replaced by an ignoring DiagnosticEngine in ParseDiagnosticArgs, which allows to switch from pointer to a reference in some utility functions.

Besides simplifying the code, this patch enables a future patch (D84673) that ports diagnostic options to the new marshalling infrastructure.

Reviewed By: dexonsmith

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

3 years ago[mlir] Add fastmath flags support to some LLVM dialect ops
Ivan Butygin [Thu, 7 Jan 2021 12:56:37 +0000 (13:56 +0100)]
[mlir] Add fastmath flags support to some LLVM dialect ops

Add fastmath enum, attributes to some llvm dialect ops, `FastmathFlagsInterface` op interface, and `translateModuleToLLVMIR` support.

Reviewed By: ftynse

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

3 years ago[llvm-objdump] Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 12:34:11 +0000 (12:34 +0000)]
[llvm-objdump] Pass Twine by const reference instead of by value. NFCI.

3 years ago[DWARF] DWARFDebugLoc::dumpRawEntry - remove dead stores. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 12:23:01 +0000 (12:23 +0000)]
[DWARF] DWARFDebugLoc::dumpRawEntry - remove dead stores. NFCI.

Don't bother zeroing local (unused) variables just before returning.

Fixes clang static analyzer warning.

3 years ago[CompilationDatabase] Pass Twine by const reference instead of by value. NFCI.
Simon Pilgrim [Thu, 7 Jan 2021 12:15:01 +0000 (12:15 +0000)]
[CompilationDatabase] Pass Twine by const reference instead of by value. NFCI.

3 years ago[SLP]Need shrink the load vector after reordering.
Alexey Bataev [Fri, 1 Jan 2021 16:43:33 +0000 (08:43 -0800)]
[SLP]Need shrink the load vector after reordering.

After merging the shuffles, we cannot rely on the previous shuffle
anymore and need to shrink the final shuffle, if it is required.

Reported in D92668

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

3 years ago[clangd] Add server capability advertising hot-reloading of CDBs.
Sam McCall [Thu, 7 Jan 2021 10:40:33 +0000 (11:40 +0100)]
[clangd] Add server capability advertising hot-reloading of CDBs.

Currently some clients watch for CDB changes and restart clangd, now that we
can reload compile_commands.json ourselves this is counterproductive.
The capability allows this behavior to be phased out.

This is going to be a mild regression, as we do not actually watch for files on
disk and so new diagnostics need to wait until a rebuild is requested e.g. due
to file change (and the internal caches have expired).
However this is still a better tradeoff (and if it's important, we can request
the client to watch files for us in the future).

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

3 years ago[mlir] Refactor translation of OpenMP dialect ops to LLVM IR
Alex Zinenko [Tue, 5 Jan 2021 15:04:00 +0000 (16:04 +0100)]
[mlir] Refactor translation of OpenMP dialect ops to LLVM IR

The original implementation of the OpenMP dialect to LLVM IR translation has
been relying on a stack of insertion points for delayed insertion of branch
instructions that correspond to terminator ops. This is an intrusive into
ModuleTranslation and makes the translation non-local. A recent addition of the
WsLoop translation exercised another approach where the parent op is
responsible for converting terminators of all blocks in its regions. Use this
approach for other OpenMP dialect operations with regions, remove the stack and
deduplicate the code for converting such regions.

Reviewed By: kiranchandramohan

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

3 years ago[libc++] Use c++20 instead of c++2a consistently.
Marek Kurdej [Thu, 7 Jan 2021 11:29:04 +0000 (12:29 +0100)]
[libc++] Use c++20 instead of c++2a consistently.

* The only exception is that the flag -std=c++2a is still used not to break compatibility with older compilers (clang <= 9, gcc <= 9).
* Bump _LIBCPP_STD_VER for C++20 to 20 and use 21 for the future standard (C++2b).

That's a preparation step to add c++2b support to libc++.

Reviewed By: ldionne, #libc

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