platform/upstream/llvm.git
3 years ago[VE] Extract & insert vector element isel
Simon Moll [Fri, 8 Jan 2021 10:35:58 +0000 (11:35 +0100)]
[VE] Extract & insert vector element isel

Isel and tests for extract_vector_elt and insert_vector_elt.

Reviewed By: kaz7

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

3 years agoFix two pessimizing moves.
Christian Sigg [Thu, 7 Jan 2021 08:40:41 +0000 (09:40 +0100)]
Fix two pessimizing moves.

See https://en.cppreference.com/w/cpp/language/return#Automatic_move_from_local_variables_and_parameters

Reviewed By: rriddle

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

3 years ago[NFC] Update some PPC tests marked as auto-generated
Qiu Chaofan [Fri, 8 Jan 2021 09:50:53 +0000 (17:50 +0800)]
[NFC] Update some PPC tests marked as auto-generated

Update CodeGen regression tests with marker at first line telling it's
auto-generated by the script, under PowerPC directory. For some reason,
these tests are generated but manually written, which makes things
unclear when someone's change affecting them.

However, some tests only show simple change after re-generated, like
extra blank lines, disappearing '.localentry', etc. Besides, some tests
are generated but added checks for debug output. This commit doesn't try
updating them.

3 years agoRevert "[clang][cli] Port DiagnosticOpts to new option parsing system"
Jan Svoboda [Fri, 8 Jan 2021 09:53:12 +0000 (10:53 +0100)]
Revert "[clang][cli] Port DiagnosticOpts to new option parsing system"

This reverts commit 8e3230ff

3 years ago[LV] Don't sink into replication regions
David Green [Fri, 8 Jan 2021 09:50:10 +0000 (09:50 +0000)]
[LV] Don't sink into replication regions

The new test case here contains a first order recurrences and an
instruction that is replicated. The first order recurrence forces an
instruction to be sunk _into_, as opposed to after the replication
region. That causes several things to go wrong including registering
vector instructions multiple times and failing to create dominance
relations correctly.

Instead we should be sinking to after the replication region, which is
what this patch makes sure happens.

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

3 years ago[VE] Add SVOB intrinsic instruction
Kazushi (Jam) Marukawa [Thu, 7 Jan 2021 14:27:39 +0000 (23:27 +0900)]
[VE] Add SVOB intrinsic instruction

Add SVOB intrinsic instruction and a regression test.

Reviewed By: simoll

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

3 years ago[clang][cli] Port DiagnosticOpts to new option parsing system
Jan Svoboda [Tue, 22 Dec 2020 14:05:16 +0000 (15:05 +0100)]
[clang][cli] Port DiagnosticOpts to new option parsing system

This patch introduces additional infrastructure necessary to accommodate DiagnosticOptions.

DiagnosticOptions are unique in that they are parsed by the same function in cc1 AND in the Clang driver. The call to the parsing function from the driver occurs early on in the compilation process, where no proper DiagnosticEngine exists, because the diagnostic options (passed through command line) are not known yet.

To preserve the current behavior, we need to be able to selectively parse:
* all options (for -cc1),
* only diagnostic options (for driver).

This patch achieves that in the following way:
* new MacroPrefix field is added to the Option TableGen class,
* new IsDiag TableGen mixin sets MacroPrefix to "DIAG_",
* TableGen backend serializes option records into a macro with the prefix,
* CompilerInvocation parse/generate methods define the [DIAG_]OPTION_WITH_MARSHALLING macros to handle diagnostic options separately.

Depends on D93700, D93701 & D93702.

Reviewed By: dexonsmith

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

3 years ago[MachineLoop] New helper isLoopInvariant()
Sjoerd Meijer [Fri, 8 Jan 2021 09:04:56 +0000 (09:04 +0000)]
[MachineLoop] New helper isLoopInvariant()

This factors out code from MachineLICM that determines whether an instruction
is loop-invariant, which is a generally useful function. Thus this allows to
use that helper elsewhere too.

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

3 years ago[AArch64][SVE] Add lowering for llvm abs intrinsic
David Sherwood [Tue, 5 Jan 2021 15:53:06 +0000 (15:53 +0000)]
[AArch64][SVE] Add lowering for llvm abs intrinsic

Add functionality to permit lowering of the abs and neg intrinsics
using the passthru variants.

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

3 years ago[llvm-readobj] [ARMWinEH] Clearly print an invalid case of packed unwind info as...
Martin Storsjö [Sun, 15 Nov 2020 22:28:33 +0000 (00:28 +0200)]
[llvm-readobj] [ARMWinEH] Clearly print an invalid case of packed unwind info as such

As the actual windows unwinder doesn't support this case, don't
pretend that it is supported when dumping the generated unwind info
either, even if it would be possible to interpret it as something
sensible.

This should reduce the risk of us emitting such a case in code
(although it's unlikely as long as the unwind info is generated
through the SEH opcodes, as the opcodes can't describe this case).

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

3 years ago[X86] Correct the comments about comparison intrinsics. NFCI.
Wang, Pengfei [Fri, 8 Jan 2021 07:36:15 +0000 (15:36 +0800)]
[X86] Correct the comments about comparison intrinsics. NFCI.

3 years ago[NewPM] Don't error when there's an unrecognized pass name
Arthur Eubanks [Fri, 8 Jan 2021 04:20:46 +0000 (20:20 -0800)]
[NewPM] Don't error when there's an unrecognized pass name

This currently blocks --print-before/after with a legacy PM pass, for
example when we use the new PM for the optimization pipeline but the
legacy PM for the codegen pipeline. Also in the future when the codegen
pipeline works with the new PM there will be multiple places to specify
passes, so even when everything is using the new PM, there will still be
multiple places that can accept different pass names.

Reviewed By: hoy, ychen

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

3 years ago[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath
Raul Tambre [Thu, 7 Jan 2021 10:32:41 +0000 (12:32 +0200)]
[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath

When `BUILD_WITH_INSTALL_RPATH` is enabled it prevents using a custom rpath only
for the build tree as the install rpath will be used. This makes it impossible to run a
runtimes build when compiling with Clang and wanting the installed rpath to be
empty (i.e. `-DCMAKE_BUILD_RPATH="<some path>" -DCMAKE_SKIP_INSTALL_RPATH=ON`).

Disable `BUILD_WITH_INSTALL_RPATH` when `CMAKE_BUILD_RPATH` is non-empty to
allow for such build scenarios.

Reviewed By: phosek

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

3 years agoAMDGPU/GlobalISel: Enable sret demotion
Christudasan Devadasan [Wed, 6 Jan 2021 05:52:23 +0000 (11:22 +0530)]
AMDGPU/GlobalISel: Enable sret demotion

3 years ago[lldb] Make DoReadMemory a protected method.
Jonas Devlieghere [Fri, 8 Jan 2021 04:54:30 +0000 (20:54 -0800)]
[lldb] Make DoReadMemory a protected method.

DoReadMemory is LLDB's internal implementation and shouldn't be called
directly.

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

3 years ago[lldb] Access the ModuleList through iterators where possible (NFC)
Jonas Devlieghere [Fri, 8 Jan 2021 04:12:01 +0000 (20:12 -0800)]
[lldb] Access the ModuleList through iterators where possible (NFC)

Replace uses of GetModuleAtIndexUnlocked and
GetModulePointerAtIndexUnlocked with the ModuleIterable and
ModuleIterableNoLocking where applicable.

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

3 years ago[Target] Use llvm::find_if (NFC)
Kazu Hirata [Fri, 8 Jan 2021 04:29:35 +0000 (20:29 -0800)]
[Target] Use llvm::find_if (NFC)

3 years ago[llvm] Use *Set::contains (NFC)
Kazu Hirata [Fri, 8 Jan 2021 04:29:34 +0000 (20:29 -0800)]
[llvm] Use *Set::contains (NFC)

3 years ago[CodeGen] Remove unused function isCallerPreservedOrConstPhysReg (NFC)
Kazu Hirata [Fri, 8 Jan 2021 04:29:32 +0000 (20:29 -0800)]
[CodeGen] Remove unused function isCallerPreservedOrConstPhysReg (NFC)

The last use of the function was removed on Oct 20, 2018 in commit
8d6ff4c0af843e1a61b76d89812aed91e358de34.

3 years ago[gn build] Port 6b0ee02747e
LLVM GN Syncbot [Fri, 8 Jan 2021 04:23:02 +0000 (04:23 +0000)]
[gn build] Port 6b0ee02747e

3 years agoRevert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer impleme...
Artem Dergachev [Fri, 8 Jan 2021 03:23:43 +0000 (19:23 -0800)]
Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""""

This reverts commit b12f26733a4259c90e5f387aceb9f23c35e003b8.

Fix dead include that looked like another missed circular dependency.

3 years agolldb subprogram_ranges.test - remove dependence on temp file name
David Blaikie [Fri, 8 Jan 2021 04:04:22 +0000 (20:04 -0800)]
lldb subprogram_ranges.test - remove dependence on temp file name

3 years agoFix print-dot-ddg.ll so it doesn't try to write to the source tree (& uses the test...
David Blaikie [Fri, 8 Jan 2021 03:57:14 +0000 (19:57 -0800)]
Fix print-dot-ddg.ll so it doesn't try to write to the source tree (& uses the test temp paths instead)

3 years agoFix subprogram_ranges.test by explicitly using lld
David Blaikie [Fri, 8 Jan 2021 03:52:48 +0000 (19:52 -0800)]
Fix subprogram_ranges.test by explicitly using lld

Seems consistent with the way other tests in this directory do linking

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