platform/upstream/llvm.git
2 years ago[GlobalISel] Port the udiv -> mul by constant combine.
Amara Emerson [Wed, 29 Sep 2021 06:41:11 +0000 (23:41 -0700)]
[GlobalISel] Port the udiv -> mul by constant combine.

This is a straight port from the equivalent DAG combine.

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

2 years ago[RISCV] Correct FileCheck prefixes in rv32zbc-intrinsic.ll and rv64zbc-intrinsic...
Craig Topper [Thu, 7 Oct 2021 18:27:07 +0000 (11:27 -0700)]
[RISCV] Correct FileCheck prefixes in rv32zbc-intrinsic.ll and rv64zbc-intrinsic.ll. NFC

Zbc RUN lines should use ZBC instead of BC in their prefix.

2 years agoRefactor code in ObjCARC.cpp. NFC
Akira Hatanaka [Thu, 7 Oct 2021 18:25:01 +0000 (11:25 -0700)]
Refactor code in ObjCARC.cpp. NFC

This is in preparation for another patch I'm planning to send later.

2 years ago[LangRef] Update ifunc syntax
Fangrui Song [Thu, 7 Oct 2021 18:14:40 +0000 (11:14 -0700)]
[LangRef] Update ifunc syntax

Extracted from Itay Bookstein's D108872.

2 years ago[NFC] Rename functions to match our naming scheme.
Kevin P. Neal [Wed, 6 Oct 2021 18:35:38 +0000 (14:35 -0400)]
[NFC] Rename functions to match our naming scheme.

In the review of D111085 it was pointed out that these functions don't
conform to the naming scheme in use in LLVM. With this commit we should
be good for all of FPEnv.h.

2 years ago[MIRParser] Add support for IsInlineAsmBrIndirectTarget
Jay Foad [Thu, 7 Oct 2021 09:38:38 +0000 (10:38 +0100)]
[MIRParser] Add support for IsInlineAsmBrIndirectTarget

Print this basic block flag as inlineasm-br-indirect-target and parse
it. This allows you to write MIR test cases for INLINEASM_BR. The test
case I added is one that I wanted to precommit anyway for D110834.

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

2 years ago[LoopRotate] Forget SCEV values in RewriteUsesOfClonedInstructions
Bjorn Pettersson [Wed, 6 Oct 2021 10:58:52 +0000 (12:58 +0200)]
[LoopRotate] Forget SCEV values in RewriteUsesOfClonedInstructions

This patch fixes problems reported in PR51981.

When rotating a loop it isn't enough to just forget SCEV for that
loop nest. When rotating we might clone some instructions from the
old header into the preheader, and insert new PHI nodes to merge
values together. There could be users of the original value that are
updated to use the PHI result. And those users were not necessarily
depending on a PHI node earlier, so they weren't cleaned up when just
forgetting all SCEV:s for the loop nest. So we need to explicitly
forget those values to avoid invalid cached SCEV expressions.

Reviewed By: fhahn, mkazantsev

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

2 years ago[test] Pre-commit test case for PR51981. NFC
Bjorn Pettersson [Thu, 30 Sep 2021 10:33:31 +0000 (12:33 +0200)]
[test] Pre-commit test case for PR51981. NFC

Reviewed By: fhahn

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

2 years agoWorkaround build error for mingw-g++
Luke Drummond [Thu, 7 Oct 2021 14:44:38 +0000 (15:44 +0100)]
Workaround build error for mingw-g++

mingw-g++ does not correctly support the full `std::errc` namespace as
worded in the standard[1]. As such, we cannot reliably use all names
therein. This patch changes the use of
`std::errc::state_not_recoverable`, to use portable error codes from the
`llvm::errc` equivalent.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71444

Reviewed by v.g.vassilev
Differential Revision: https://reviews.llvm.org/D111315

2 years ago[lldb] Fix a "missing field" warning
Kazu Hirata [Thu, 7 Oct 2021 17:25:05 +0000 (10:25 -0700)]
[lldb] Fix a "missing field" warning

This patch fixes:

  llvm-project/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp:204:6:
  error: missing field 'invalidate_regs' initializer
  [-Werror,-Wmissing-field-initializers]

2 years ago[RISCV] Handle vector of pointer in getTgtMemIntrinsic for strided load/store.
Craig Topper [Thu, 7 Oct 2021 00:14:08 +0000 (17:14 -0700)]
[RISCV] Handle vector of pointer in getTgtMemIntrinsic for strided load/store.

getScalarSizeInBits() doesn't work if the scalar type is a pointer.
For that we need to go through DataLayout.

2 years agoAdd information about partially implemented features
Corentin Jabot [Thu, 7 Oct 2021 17:07:15 +0000 (13:07 -0400)]
Add information about partially implemented features

Desccribe in cxx_status.html the missing parts of the partially
implemented proposals described in cxx_status.html.

Uses <details> blocks so the information appears collapsed
by default.

2 years ago[PS4][TargetLibraryInfo] Set TLI info correctly for PS4
Paul Robinson [Thu, 30 Sep 2021 21:12:29 +0000 (14:12 -0700)]
[PS4][TargetLibraryInfo] Set TLI info correctly for PS4

2 years ago[NFC] Update return type of vec_popcnt to vector unsigned.
Amy Kwan [Thu, 7 Oct 2021 15:55:50 +0000 (10:55 -0500)]
[NFC] Update return type of vec_popcnt to vector unsigned.

This patch updates the vec_popcnt builtins to return vector unsigned,
as defined by the Power Vector Intrinsics Programming Reference.
This patch is NFC and all existing tests pass.

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

2 years ago[InstSimplify] (x || y) && (x || !y) --> x
Sanjay Patel [Thu, 7 Oct 2021 15:53:16 +0000 (11:53 -0400)]
[InstSimplify] (x || y) && (x || !y) --> x

https://alive2.llvm.org/ce/z/4BE33w

This is the logical (select-form) equivalent of the bitwise logic fold:
e36d351d19b1

This is another part of solving the regression from:
https://llvm.org/PR52077

2 years ago[llvm-readelf][docs] Add missing options and details to the help output and the comma...
gbreynoo [Thu, 7 Oct 2021 16:09:52 +0000 (17:09 +0100)]
[llvm-readelf][docs] Add missing options and details to the help output and the command guide

This change is to keep the help text and command guide of llvm-readelf
in tandem.

 - In the help text mention that --section-data, --section-relocations,
   --section-symbols and --stack-sizes have no effect on GNU style
   output; give the accepted values for --elf-output-style and update
   the description of --gnu-hash-table to use the command guide
   description.
 - In the command guide add the missing options -a,
   --dependant-libraries,--no-demangle, --wide and -W. Also update the
   description of --symbols so it matches the help text.

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

2 years ago[libc++] Use addressof in assignment operator.
Mark de Wever [Tue, 28 Sep 2021 17:15:18 +0000 (19:15 +0200)]
[libc++] Use addressof in assignment operator.

Replace `&__rhs` with `_VSTD::addressof(__rhs)` to guard against ADL hijacking
of `operator&` in `operator=`. Thanks to @CaseyCarter for bringing it to our
attention.

Similar issues with hijacking `operator&` still exist, they will be
addressed separately.

Reviewed By: #libc, Quuxplusone, ldionne

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

2 years ago[lldb] Mark abort signal test unsupported on AArch64 Linux
David Spickett [Thu, 7 Oct 2021 16:08:08 +0000 (16:08 +0000)]
[lldb] Mark abort signal test unsupported on AArch64 Linux

This has started failing since we moved our bots to Focal.
For unknown reasons the abort_caller stack is missing when
we check from the handler breakpoint.

Mark unsupported while I investigate.

2 years agoC] Add option to ARCOptAddrMode to disable the pass and diagnose errors
Mark Schimmel [Thu, 7 Oct 2021 16:02:19 +0000 (09:02 -0700)]
C] Add option to ARCOptAddrMode to disable the pass and diagnose errors
Fixed formatting issues reported by clang-format

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

2 years ago[mlir] Extend C and Python API to support bulk loading of DenseElementsAttr.
Stella Laurenzo [Thu, 7 Oct 2021 01:41:22 +0000 (18:41 -0700)]
[mlir] Extend C and Python API to support bulk loading of DenseElementsAttr.

* This already half existed in terms of reading the raw buffer backing a DenseElementsAttr.
* Documented the precise expectations of the buffer layout.
* Extended the Python API to support construction from bitcasted buffers, allowing construction of all primitive element types (even those that lack a compatible representation in Python).
* Specifically, the Python API can now load all integer types at all bit widths and all floating point types (f16, f32, f64, bf16).

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

2 years ago[DebugInfo][LSR] Limit the size of SCEV translated to DIExpression
Chris Jackson [Thu, 7 Oct 2021 14:22:52 +0000 (14:22 +0000)]
[DebugInfo][LSR] Limit the size of SCEV translated to DIExpression

SCEV-based salvaging will use excessive resources if it encounters
very long SCEV expressions. This patch places a limit on the length of
SCEV expression that salvaging will attempt to translate.

Reviewed by: Orlando

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

2 years ago[libcxx[ Run generate_private_header_tests.py
Mark de Wever [Thu, 7 Oct 2021 15:34:47 +0000 (17:34 +0200)]
[libcxx[ Run generate_private_header_tests.py

The script was recently updated to generate different output. This
breaks the CI due the patches which used the old version of the script.

2 years ago[Inline] Introduce Constant::hasOneLiveUse, use it instead of hasOneUse in inline...
Erik Desjardins [Thu, 7 Oct 2021 15:14:56 +0000 (08:14 -0700)]
[Inline] Introduce Constant::hasOneLiveUse, use it instead of hasOneUse in inline cost model (PR51667)

Otherwise, inlining costs may be pessimized by dead constants.

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

Reviewed By: mtrofin, aeubanks

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

2 years ago[llvm-objdump][docs] Add details to the help output and command guide
gbreynoo [Thu, 7 Oct 2021 15:26:26 +0000 (16:26 +0100)]
[llvm-objdump][docs] Add details to the help output and command guide

This change is to add some missing details, clarifies some options and
brings the help text and command guide of objdump closer together.

- Added to the help that --all-headers also outputs symbols and
  relocations to match the command guide.
- Added to the help that --debug-vars accepts an optional
  ascii/unicode format to match the command guide.
- Changed the help descriptions for --disassemble,
  --disassemble-all, --dwarf=<value>, --fault-map-section,
  --line-numbers, --no-leading-addr and --source descriptions to
  match the command guide.
- Added to the help that --start-address and --stop-address also
  effect relocation entries and the symbol table output to match
  the command guide.
- Added a note to the command guide that --unwind-info and -u
  are not available for the elf format.

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

2 years ago[lldb, mlir] Migrate from getNumArgOperands and arg_operands (NFC)
Kazu Hirata [Thu, 7 Oct 2021 15:29:42 +0000 (08:29 -0700)]
[lldb, mlir] Migrate from getNumArgOperands and arg_operands (NFC)

Note that getNumArgOperands and arg_operands are considered legacy
names.  See llvm/include/llvm/IR/InstrTypes.h for details.

2 years ago[AArch64][SVE] Improve VECTOR_SPLICE codegen for VL > 128-bit
Bradley Smith [Tue, 5 Oct 2021 11:05:20 +0000 (11:05 +0000)]
[AArch64][SVE] Improve VECTOR_SPLICE codegen for VL > 128-bit

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

2 years ago[gn build] Port 7fb9f99f3bb6
LLVM GN Syncbot [Thu, 7 Oct 2021 15:19:45 +0000 (15:19 +0000)]
[gn build] Port 7fb9f99f3bb6

2 years ago[gn build] Port 49e736d845d8
LLVM GN Syncbot [Thu, 7 Oct 2021 15:19:44 +0000 (15:19 +0000)]
[gn build] Port 49e736d845d8

2 years ago[libc++][format] Adds bool formatter.
Mark de Wever [Mon, 14 Dec 2020 16:39:15 +0000 (17:39 +0100)]
[libc++][format] Adds bool formatter.

Implements the formatter for Boolean types.
[format.formatter.spec]/2.3
For each charT, for each cv-unqualified arithmetic type ArithmeticT other
than char, wchar_t, char8_t, char16_t, or char32_t, a specialization
```
  template<> struct formatter<ArithmeticT, charT>;
```
This removes the stub implemented in D96664.

Implements parts of:
- P0645 Text Formatting
- P1652 Printf corner cases in std::format

Completes:
- P1868 width: clarifying units of width and precision in std::format

Reviewed By: #libc, ldionne

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

2 years ago[libc++][format] Adds char formatter.
Mark de Wever [Mon, 14 Dec 2020 16:39:15 +0000 (17:39 +0100)]
[libc++][format] Adds char formatter.

Implements the formatter for all fundamental integer types.
[format.formatter.spec]/2.1
The specializations
```
  template<> struct formatter<char, char>;
  template<> struct formatter<char, wchar_t>;
  template<> struct formatter<wchar_t, wchar_t>;
```
This removes the stub implemented in D96664.

Implements parts of:
- P0645 Text Formatting

Reviewed By: #libc, ldionne

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

2 years ago[gn build] Port 3e9689d72cdf
LLVM GN Syncbot [Thu, 7 Oct 2021 15:11:38 +0000 (15:11 +0000)]
[gn build] Port 3e9689d72cdf

2 years ago[MachineInstr] Move MIParser's DBG_VALUE RegState::Debug invariant into MachineInstr...
Jack Andersen [Thu, 7 Oct 2021 15:02:30 +0000 (16:02 +0100)]
[MachineInstr] Move MIParser's DBG_VALUE RegState::Debug invariant into MachineInstr::addOperand

Based on the reasoning of D53903, register operands of DBG_VALUE are
invariably treated as RegState::Debug operands. This change enforces
this invariant as part of MachineInstr::addOperand so that all passes
emit this flag consistently.

RegState::Debug is inconsistently set on DBG_VALUE registers throughout
LLVM. This runs the risk of a filtering iterator like
MachineRegisterInfo::reg_nodbg_iterator to process these operands
erroneously when not parsed from MIR sources.

This issue was observed in the development of the llvm-mos fork which
adds a backend that relies on physical register operands much more than
existing targets. Physical RegUnit 0 has the same numeric encoding as
$noreg (indicating an undef for DBG_VALUE). Allowing debug operands into
the machine scheduler correlates $noreg with RegUnit 0 (i.e. a collision
of register numbers with different zero semantics). Eventually, this
causes an assert where DBG_VALUE instructions are prohibited from
participating in live register ranges.

Reviewed By: MatzeB, StephenTozer

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

2 years ago[libc++][format] Adds integer formatter.
Mark de Wever [Mon, 14 Dec 2020 16:39:15 +0000 (17:39 +0100)]
[libc++][format] Adds integer formatter.

Implements the formatter for all fundamental integer types
(except `char`, `wchar_t`, and `bool`).
[format.formatter.spec]/2.3
For each charT, for each cv-unqualified arithmetic type ArithmeticT other
than char, wchar_t, char8_t, char16_t, or char32_t, a specialization
```
  template<> struct formatter<ArithmeticT, charT>;
```
This removes the stub implemented in D96664.

As an extension it adds partial support for 128-bit integer types.

Implements parts of:
- P0645 Text Formatting
- P1652 Printf corner cases in std::format

Completes:
- LWG-3248 #b, #B, #o, #x, and #X presentation types misformat negative numbers

Reviewed By: #libc, ldionne, vitaut

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

2 years ago[gn build] Port d550930afcbb
LLVM GN Syncbot [Thu, 7 Oct 2021 15:03:32 +0000 (15:03 +0000)]
[gn build] Port d550930afcbb

2 years ago[libc++][format] Adds string formatter.
Mark de Wever [Mon, 14 Dec 2020 16:39:15 +0000 (17:39 +0100)]
[libc++][format] Adds string formatter.

Implements the formatter for all string types.
[format.formatter.spec]/2.2
For each charT, the string type specializations
```
  template<> struct formatter<charT*, charT>;
  template<> struct formatter<const charT*, charT>;
  template<size_t N> struct formatter<const charT[N], charT>;
  template<class traits, class Allocator>
    struct formatter<basic_string<charT, traits, Allocator>, charT>;
  template<class traits>
    struct formatter<basic_string_view<charT, traits>, charT>;
```
This removes the stub implemented in D96664.

Implements parts of:
- P0645 Text Formatting
- P1868 width: clarifying units of width and precision in std::format

Reviewed By: #libc, ldionne, vitaut

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

2 years ago[llvm-objdump] Fix --prefix and --prefix-strip
gbreynoo [Thu, 7 Oct 2021 14:45:22 +0000 (15:45 +0100)]
[llvm-objdump] Fix --prefix and --prefix-strip

In the command guide --prefix and --prefix-strip is used in the form
--prefix=<prefix> however currently it is used in the form --prefix
<prefix>. This change fixes these options to match the command guide.

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

2 years ago[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_SGT for generic sadd/ssub sat...
Simon Pilgrim [Thu, 7 Oct 2021 14:33:58 +0000 (15:33 +0100)]
[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_SGT for generic sadd/ssub sat cost expansion

The comparison always checks for negative values so know the icmp predicate will be ICMP_SGT

2 years ago[PatternMatch] add matchers for commutative logical and/or
Sanjay Patel [Thu, 7 Oct 2021 14:10:23 +0000 (10:10 -0400)]
[PatternMatch] add matchers for commutative logical and/or

We need these to add folds with the same structure as
regular commuted logic ops.

2 years ago[InstSimplify] add tests for (x || y) && (x || !y); NFC
Sanjay Patel [Wed, 6 Oct 2021 20:18:04 +0000 (16:18 -0400)]
[InstSimplify] add tests for (x || y) && (x || !y); NFC

2 years agoRevert "[Clang][OpenMP] Add partial support for Static Device Libraries"
Saiyedul Islam [Thu, 7 Oct 2021 14:01:55 +0000 (14:01 +0000)]
Revert "[Clang][OpenMP] Add partial support for Static Device Libraries"

This reverts commit 4c4117089599cb5b6c6fa5635c28462ffd1bddf4.

2 years agoRevert "[Clang][OpenMP] Fix windows buildbot failure for D105191"
Saiyedul Islam [Thu, 7 Oct 2021 14:01:42 +0000 (14:01 +0000)]
Revert "[Clang][OpenMP] Fix windows buildbot failure for D105191"

This reverts commit 06404d5488ea505b00f711393973db3ae32d01e9.

2 years agoRevert "[Clang][OpenMP] Fix fat archive tests for Mac and Windows"
Saiyedul Islam [Thu, 7 Oct 2021 14:01:23 +0000 (14:01 +0000)]
Revert "[Clang][OpenMP] Fix fat archive tests for Mac and Windows"

This reverts commit 2baf7ad6d27fc9c08dd6eb9f8581d7e1353d4ece.

2 years ago[lldb] [DynamicRegisterInfo] Support iterating over registers()
Michał Górny [Tue, 5 Oct 2021 12:16:38 +0000 (14:16 +0200)]
[lldb] [DynamicRegisterInfo] Support iterating over registers()

Add DynamicRegisterInfo::registers() method that returns
llvm::iterator_range<> over RegisterInfos.  This is a convenient
replacement for GetNumRegisters() + GetRegisterInfoAtIndex().

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

2 years agoExecutorProcessControl.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 13:34:18 +0000 (14:34 +0100)]
ExecutorProcessControl.h - remove unused Optional.h include

2 years agoLegalizerInfo.h - remove unused Optional.h + None.h includes
Simon Pilgrim [Thu, 7 Oct 2021 13:28:18 +0000 (14:28 +0100)]
LegalizerInfo.h - remove unused Optional.h + None.h includes

2 years ago[DebugInfo] Remove unused Optional.h includes
Simon Pilgrim [Thu, 7 Oct 2021 12:09:58 +0000 (13:09 +0100)]
[DebugInfo] Remove unused Optional.h includes

2 years ago[mlir][linalg][bufferize][NFC] Simplify getAliasingOpResult()
Matthias Springer [Thu, 7 Oct 2021 13:39:52 +0000 (22:39 +0900)]
[mlir][linalg][bufferize][NFC] Simplify getAliasingOpResult()

The signature of this function was confusing. Check for hasKnownBufferizationAliasingBehavior separately when needed.

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

2 years ago[mlir][vector] Split populateVectorContractLoweringPatterns
Lei Zhang [Thu, 7 Oct 2021 13:33:51 +0000 (09:33 -0400)]
[mlir][vector] Split populateVectorContractLoweringPatterns

It was bundling quite a lot of patterns that convert high-D
vector ops into low-D elementary ops. It might not be good
for all of the patterns to happen for a particular downstream
user. For example, `ShapeCastOpRewritePattern` rewrites
`vector.shape_cast` into data movement extract/insert ops.

Instead, split the entry point into multiple ones so users
can pull in patterns on demand.

Reviewed By: ftynse

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

2 years ago[Clang][OpenMP] Fix fat archive tests for Mac and Windows
Saiyedul Islam [Thu, 7 Oct 2021 13:31:13 +0000 (13:31 +0000)]
[Clang][OpenMP] Fix fat archive tests for Mac and Windows

Fixes missing libomptarget on Mac and Windows in check lines. Issue
was introduced by D105191.

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

2 years ago[mlir][linalg][bufferize][NFC] Change bufferizableInPlaceAnalysis signature
Matthias Springer [Thu, 7 Oct 2021 13:32:18 +0000 (22:32 +0900)]
[mlir][linalg][bufferize][NFC] Change bufferizableInPlaceAnalysis signature

Move getInplaceableOpResult() call into bufferizableInPlaceAnalysis.

Note: The only goal of this change is to make the signature of bufferizableInPlaceAnalysis smaller. (Fewer arguments.)

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

2 years ago[mlir][linalg][bufferize] tensor.cast may require a copy
Matthias Springer [Thu, 7 Oct 2021 13:23:10 +0000 (22:23 +0900)]
[mlir][linalg][bufferize] tensor.cast may require a copy

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

2 years ago[mlir] Add alignment attribute to memref.global
Eugene Zhulenev [Thu, 7 Oct 2021 12:49:59 +0000 (05:49 -0700)]
[mlir] Add alignment attribute to memref.global

Revived https://reviews.llvm.org/D102435

Add alignment attribute to `memref.global` and propagate it to llvm global in memref->llvm lowering

Reviewed By: ftynse

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

2 years agoFix two unused-variable warnings.
Michael Forster [Thu, 7 Oct 2021 13:17:58 +0000 (15:17 +0200)]
Fix two unused-variable warnings.

2 years ago[PowerPC] refactor rewriteLoadStores for reusing; nfc
Chen Zheng [Thu, 23 Sep 2021 05:48:46 +0000 (05:48 +0000)]
[PowerPC] refactor rewriteLoadStores for reusing; nfc

This is split from https://reviews.llvm.org/D108750.
Refactor rewriteLoadStores() so that we can reuse the outlined
functions.

Reviewed By: jsji

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

2 years ago[libcxx][pretty printers] Correct tests run detection
David Spickett [Thu, 7 Oct 2021 12:36:01 +0000 (13:36 +0100)]
[libcxx][pretty printers] Correct tests run detection

Missing "global" meant that we set a local "has_run_tests"
so the global was False by the time everything has run.

2 years ago[ARM] Introduce a MQPRCopy
David Green [Thu, 7 Oct 2021 11:52:12 +0000 (12:52 +0100)]
[ARM] Introduce a MQPRCopy

Currently when creating tail predicated loops, we need to validate that
all the live-outs of a loop will be equivalent with and without tail
predication, and if they are not we cannot legally create a
tail-predicated loop, leaving expensive vctp and vpst instructions in
the loop. These notably can include register-allocation instructions
like stack loads and stores, and copys lowered from COPYs to MVE_VORRs.

Instead of trying to prove this is valid late in the pipeline, this
patch introduces a MQPRCopy pseudo instruction that COPY is lowered to.
This can then either be converted to a MVE_VORR where possible, or to a
couple of VMOVD instructions if not. This way they do not behave
differently within and outside of tail-predications regions, and we can
know by construction that they are always valid. The idea is that we can
do the same with stack load and stores, converting them to VLDR/VSTR or
VLDM/VSTM where required to prove tail predication is always valid.

This does unfortunately mean inserting multiple VMOVD instructions,
instead of a single MVE_VORR, but my experiments show it to be an
improvement in general.

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

2 years ago[MachineCopyPropagation] Handle propagation of undef copies
Carl Ritson [Thu, 7 Oct 2021 10:36:10 +0000 (19:36 +0900)]
[MachineCopyPropagation] Handle propagation of undef copies

When propagating undefined copies the undef flag must also be
propagated.

Reviewed By: foad

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

2 years ago[lldb] Rewrite/expand TestCppTypedef and document a lookup bug.
Raphael Isemann [Thu, 7 Oct 2021 09:18:22 +0000 (11:18 +0200)]
[lldb] Rewrite/expand TestCppTypedef and document a lookup bug.

Just regrouping the checks for the same typedef together and also giving the
different typedefs unique names. We might want to have a second test with
identical names to see how LLDB handle the potential name conflict, but that
should be a separate test and not part of the main typedef test.

Also this test is actually unintentionally passing. LLDB can't lookup typedefs
in a struct/class scope, but in the test the check passes as the local variable
in the expression evaluation scope pulls in the typedef. I added a second check
that makes it clear that this is not working right now.

2 years ago[lldb/gdb-remote] Delete SendPacketsAndConcatenateResponses
Pavel Labath [Thu, 7 Oct 2021 11:07:42 +0000 (13:07 +0200)]
[lldb/gdb-remote] Delete SendPacketsAndConcatenateResponses

ReadExtFeature provides equivalent functionality. Also fix a but in
ReadExtFeature, which prevented it from being used for auxv data (it
contains nul characters).

2 years agoFunctionLoweringInfo.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 10:42:56 +0000 (11:42 +0100)]
FunctionLoweringInfo.h - remove unused Optional.h include

2 years agoTargetSchedule.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 10:32:23 +0000 (11:32 +0100)]
TargetSchedule.h - remove unused Optional.h include

2 years agoMCSchedule.h - remove unused Optional.h include
Simon Pilgrim [Thu, 7 Oct 2021 10:27:21 +0000 (11:27 +0100)]
MCSchedule.h - remove unused Optional.h include

2 years ago[ExecutionEngine] remove unused <string> includes
Simon Pilgrim [Thu, 7 Oct 2021 10:08:02 +0000 (11:08 +0100)]
[ExecutionEngine] remove unused <string> includes

2 years agoScalarEvolution.h - remove unused Hashing.h include
Simon Pilgrim [Thu, 7 Oct 2021 09:51:27 +0000 (10:51 +0100)]
ScalarEvolution.h - remove unused Hashing.h include

2 years ago[libomptarget] Move device environment to shared header, remove divergence
Jon Chesterfield [Thu, 7 Oct 2021 11:03:46 +0000 (12:03 +0100)]
[libomptarget] Move device environment to shared header, remove divergence

Follow on to D110006, related to D110957

Where implementations have diverged this resolves to match the new DeviceRTL

- replaces definitions of this struct in deviceRTL and plugins with include
- changes the dynamic_shared_size field from D110006 to 32 bits
- handles stdint being unavailable in DeviceRTL
- adds a zero initializer for the field to amdgpu
- moves the extern declaration for deviceRTL to target_interface
  (omptarget.h is more natural, but doesn't work due to include order
  with debug.h)
- Renames the fields everywhere to match the LLVM format used in DeviceRTL
- Makes debug_level uint32_t everywhere (previously sometimes int32_t)

Reviewed By: jdoerfert

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

2 years ago[clang][ASTImporter] Simplify code of attribute import [NFC].
Balázs Kéri [Thu, 7 Oct 2021 07:48:06 +0000 (09:48 +0200)]
[clang][ASTImporter] Simplify code of attribute import [NFC].

The code of `ASTImporter::Import(const Attr *)` was repetitive,
it is now simplified. (There is still room for improvement but
probably only after big changes.)

Reviewed By: martong, steakhal

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

2 years ago[ARM] Add tests for code that spills in tail predicate loops.
David Green [Thu, 7 Oct 2021 10:35:02 +0000 (11:35 +0100)]
[ARM] Add tests for code that spills in tail predicate loops.

2 years ago[libcxx][pretty printers] Report not being able to trace test program
David Spickett [Fri, 1 Oct 2021 14:29:48 +0000 (15:29 +0100)]
[libcxx][pretty printers] Report not being able to trace test program

If you don't have ptrace permissions this test will fail to run
silently, this adds a check for that and anything else that
might do similar things.

The output will now be:
```
FAILED test program did not run correctly, check gdb warnings

/usr/bin/gdb: warning: Couldn't determine a path for the index cache
directory.
No symbol table is loaded.  Use the "file" command.
warning: Error disabling address space randomization: Operation not
permitted
warning: Could not trace the inferior process.
warning: ptrace: Operation not permitted

error: command failed with exit status: 255
```

We already have a feature to check for a compatible python enabled
gdb, so I think it's reasonable to check for this at test runtime.

Note that this is different to the catch all at the end of the test
script. That would be a case where you can trace but something else
made it stop mid way that wasn't our test breakpoints.

Reviewed By: saugustine

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

2 years agoRecommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo
Pavel Labath [Thu, 23 Sep 2021 12:10:49 +0000 (14:10 +0200)]
Recommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo

The previous version of the patch did not update the definitions in
conditionally compiled code. This patch includes changes to ARC and
windows targets.

Original commit message was:

These were added to support some mips registers on linux, but linux mips
support has now been removed due.

They are still referenced in the freebds mips implementation, but the
completeness of that implementation is also unknown. All other
architectures just set these fields to zero, which is a cause of
significant bloat in our register info definitions.

Arm also has registers with variable sizes, but they were implemented in
a more gdb-compatible fashion and don't use this feature.

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

2 years ago[TwoAddressInstruction] Fix ReplacedAllUntiedUses in processTiedPairs
Jay Foad [Thu, 30 Sep 2021 15:35:44 +0000 (16:35 +0100)]
[TwoAddressInstruction] Fix ReplacedAllUntiedUses in processTiedPairs

Fix the calculation of ReplacedAllUntiedUses when any of the tied defs
are early-clobber. The effect of this is to fix the placement of kill
flags on an instruction like this (from @f2 in
 test/CodeGen/SystemZ/asm-18.ll):

  INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], killed %4:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit

After TwoAddressInstruction without this patch:

  %3:grh32bit = COPY killed %4:grh32bit
  INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], %3:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit

Note that the COPY kills %4, even though there is a later use of %4 in
the INLINEASM. This fails machine verification if you force it to run
after TwoAddressInstruction (currently it is disabled for other
reasons).

After TwoAddressInstruction with this patch:

  %3:grh32bit = COPY %4:grh32bit
  INLINEASM &"stepb $1, $2" [attdialect], $0:[regdef-ec:GRH32Bit], def early-clobber %3:grh32bit, $1:[reguse tiedto:$0], %3:grh32bit(tied-def 3), $2:[reguse:GRH32Bit], %4:grh32bit

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

2 years ago[TwoAddressInstruction] Pre-commit a test case for D110848
Jay Foad [Fri, 1 Oct 2021 18:26:22 +0000 (19:26 +0100)]
[TwoAddressInstruction] Pre-commit a test case for D110848

2 years ago[mlir] Don't allow dynamic extent tensor types for ConstShapeOp.
Adrian Kuegel [Tue, 5 Oct 2021 12:37:30 +0000 (14:37 +0200)]
[mlir] Don't allow dynamic extent tensor types for ConstShapeOp.

ConstShapeOp has a constant shape, so its type can always be static.
We still allow it to have ShapeType though.

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

2 years ago[AArch64][SME] Update DUP (predicate) instruction
Cullen Rhodes [Thu, 7 Oct 2021 08:29:51 +0000 (08:29 +0000)]
[AArch64][SME] Update DUP (predicate) instruction

Changes in architecture revision 00eac1:
  * Renamed to PSEL.
  * Copies whole source register.
  * Element type suffix removed from destination.
  * Element index no longer optional and '#' prefix has been removed.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-09

Depends on D111212.

Reviewed By: kmclaughlin

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

2 years ago[AArch64][SME] Update tile slice index offset
Cullen Rhodes [Thu, 7 Oct 2021 08:28:55 +0000 (08:28 +0000)]
[AArch64][SME] Update tile slice index offset

Changes in architecture revision 00eac1:
  * Tile slice index offset no longer prefixed with '#'.
  * The syntax for 128-bit (.Q) ZA tile slice accesses must now include
    an explicit zero index.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-09

Reviewed By: david-arm

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

2 years ago[VPlan] Replace hard-coded VPValue ids with patterns in tests.
Florian Hahn [Tue, 5 Oct 2021 19:42:00 +0000 (20:42 +0100)]
[VPlan] Replace hard-coded VPValue ids with patterns in tests.

This makes the tests a bit more robust with respect to small changes in
the value numbering.

2 years ago[libcxx][pretty printers] Correct locale for u16/u32 string tests
David Spickett [Tue, 5 Oct 2021 12:24:23 +0000 (13:24 +0100)]
[libcxx][pretty printers] Correct locale for u16/u32 string tests

When the locale is not some UTF-8 these tests fail.
(different results for python2 linked gdbs vs. python3
but same issue)

Setting the locale just for the test works around this.
By default Ubuntu comes with just C.UTF-8. I've chosen
to use en_US.UTF-8 instead given that my Mac doesn't have
the former and there's a slim chance this test might run there.

This also enables the u16string tests which are now passing.

Reviewed By: #libc, ldionne, saugustine

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

2 years ago[libcxx][CI] Install all locales used by the test suite
David Spickett [Wed, 6 Oct 2021 15:05:47 +0000 (16:05 +0100)]
[libcxx][CI] Install all locales used by the test suite

Reviewed By: #libc, ldionne

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

2 years ago[mlir][linalg] Add unsigned min/max/cast function to OpDSL.
Tobias Gysi [Thu, 7 Oct 2021 06:26:38 +0000 (06:26 +0000)]
[mlir][linalg] Add unsigned min/max/cast function to OpDSL.

Update OpDSL to support unsigned integers by adding unsigned min/max/cast signatures. Add tests in OpDSL and on the C++ side to verify the proper signed and unsigned operations are emitted.

The patch addresses an issue brought up in https://reviews.llvm.org/D111170.

Reviewed By: rsuderman

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

2 years ago[Clang][OpenMP] Fix windows buildbot failure for D105191
Saiyedul Islam [Thu, 7 Oct 2021 05:51:41 +0000 (05:51 +0000)]
[Clang][OpenMP] Fix windows buildbot failure for D105191

Fixes 4c4117089599cb5b6c6fa5635c28462ffd1bddf4.

2 years ago[GlobalISel] Silence gcc warning about unused variable
Mikael Holmen [Thu, 7 Oct 2021 05:18:04 +0000 (07:18 +0200)]
[GlobalISel] Silence gcc warning about unused variable

2 years ago[Clang][OpenMP] Add partial support for Static Device Libraries
Saiyedul Islam [Tue, 28 Sep 2021 14:26:54 +0000 (14:26 +0000)]
[Clang][OpenMP] Add partial support for Static Device Libraries

An archive containing device code object files can be passed to
clang command line for linking. For each given offload target
it creates a device specific archives which is either passed to llvm-link
if the target is amdgpu, or to clang-nvlink-wrapper if the target is
nvptx. -L/-l flags are used to specify these fat archives on the command
line. E.g.
  clang++ -fopenmp -fopenmp-targets=nvptx64 main.cpp -L. -lmylib

It currently doesn't support linking an archive directly, like:
  clang++ -fopenmp -fopenmp-targets=nvptx64 main.cpp libmylib.a

Linking with x86 offload also does not work.

Reviewed By: ye-luo

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

2 years ago[CFE][Codegen] Update auto-generated check lines for few GPU lit tests
hsmahesha [Thu, 7 Oct 2021 02:57:08 +0000 (08:27 +0530)]
[CFE][Codegen] Update auto-generated check lines for few GPU lit tests

which is essentially required as a pre-commit for https://reviews.llvm.org/D110257.

Reviewed By: yaxunl

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

2 years agoDon't register mem segments that aren't present in a corefile
Jason Molenda [Thu, 7 Oct 2021 03:04:49 +0000 (20:04 -0700)]
Don't register mem segments that aren't present in a corefile

A Mach-O corefile has an array of memory segments, representing
the memory of the process at the point of the capture.  Each segment
has a virtual address + size, and a file offset + size.  The file
size may be less than the virtual address size, indicating that
the memory was unavailable. When ProcessMachCore::DoLoadCore scans
this array of memory segments, it builds up a table to translate
virtual addresses to file offsets, for memory read requests.
This lookup table combines contiguous memory segments into a single
entry, to reduce the number of entries (some corefile writers will
emit a separate segement for each virtual meory page).

This contiguous check wasn't taking into account a segment that
isn't present in the corefile, e.g. filesize==0, and every contiguous
memory segment after that point would result in lldb reading the
wrong offset of the file because it didn't account for this.

I'd like to have an error message when someone tries to read memory from
one of these segments, instead of returning all zeroes, so this patch
intentionally leaves these out of the vmaddr -> fileoff table (and
avoids combining them with segments that actually do exist in the
corefile).

I'm a little unsure of writing a test for this one; I'd have to do
a yaml2obj of a corefile with the problem, or add an internal mode
to the Mach-O process save-core where it could write a filesize==0
segment while it was writing one.

rdar://83382487

2 years agoUpdate TODO noting that DriverKit should be added too
Jason Molenda [Thu, 7 Oct 2021 02:54:33 +0000 (19:54 -0700)]
Update TODO noting that DriverKit should be added too

When BridgeOS and DriverKit are added to llvm Triple.

2 years ago[MLIR] Add OrOp folding rule for constant one operand
Uday Bondhugula [Wed, 6 Oct 2021 04:39:56 +0000 (10:09 +0530)]
[MLIR] Add OrOp folding rule for constant one operand

Add folding rule for std.or op when an operand has all bits set.

or(x, <all bits set>) -> <all bits set>

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

2 years ago[IR][NFC] Rename getBaseObject to getAliaseeObject
Itay Bookstein [Thu, 7 Oct 2021 02:33:10 +0000 (19:33 -0700)]
[IR][NFC] Rename getBaseObject to getAliaseeObject

To better reflect the meaning of the now-disambiguated {GlobalValue,
GlobalAlias}::getBaseObject after breaking off GlobalIFunc::getResolverFunction
(D109792), the function is renamed to getAliaseeObject.

2 years ago[CUDA] remove unneeded includes from CUDA-related headers.
Artem Belevich [Thu, 7 Oct 2021 00:06:40 +0000 (17:06 -0700)]
[CUDA] remove unneeded includes from CUDA-related headers.

This should fix bot failures on PPC and windows.

2 years ago[MLIR] fix arith dialect build failure
Mogball [Wed, 6 Oct 2021 23:38:07 +0000 (23:38 +0000)]
[MLIR] fix arith dialect build failure

Missing function defs causes errors on some build configs.

2 years agoDebugInfo: Use clang's preferred names for integer types
David Blaikie [Fri, 24 Sep 2021 23:13:07 +0000 (16:13 -0700)]
DebugInfo: Use clang's preferred names for integer types

This reverts c7f16ab3e3f27d944db72908c9c1b1b7366f5515 / r109694 - which
suggested this was done to improve consistency with the gdb test suite.
Possible that at the time GCC did not canonicalize integer types, and so
matching types was important for cross-compiler validity, or that it was
only a case of over-constrained test cases that printed out/tested the
exact names of integer types.

In any case neither issue seems to exist today based on my limited
testing - both gdb and lldb canonicalize integer types (in a way that
happens to match Clang's preferred naming, incidentally) and so never
print the original text name produced in the DWARF by GCC or Clang.

This canonicalization appears to be in `integer_types_same_name_p` for
GDB and in `TypeSystemClang::GetBasicTypeEnumeration` for lldb.

(I tested this with one translation unit defining 3 variables - `long`,
`long (*)()`, and `int (*)()`, and another translation unit that had
main, and a function that took `long (*)()` as a parameter - then
compiled them with mismatched compilers (either GCC+Clang, or
Clang+(Clang with this patch applied)) and no matter the combination,
despite the debug info for one CU naming the type "long int" and the
other naming it "long", both debuggers printed out the name as "long"
and were able to correctly perform overload resolution and pass the
`long int (*)()` variable to the `long (*)()` function parameter)

Did find one hiccup, identified by the lldb test suite - that CodeView
was relying on these names to map them to builtin types in that format.
So added some handling for that in LLVM. (these could be split out into
separate patches, but seems small enough to not warrant it - will do
that if there ends up needing any reverti/revisiting)

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

2 years ago[GlobalDCE] In VFE, replace the whole 'sub' expression of unused relative-pointer...
Kuba Mracek [Wed, 6 Oct 2021 22:55:00 +0000 (15:55 -0700)]
[GlobalDCE] In VFE, replace the whole 'sub' expression of unused relative-pointer-based vtable slots

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

2 years agoReturn failure on failure in convertBlockSignature.
Stella Laurenzo [Wed, 6 Oct 2021 20:54:13 +0000 (13:54 -0700)]
Return failure on failure in convertBlockSignature.

This was causing a subsequent assert/crash when a type converter failed to convert a block argument.

Reviewed By: rriddle

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

2 years ago[gn build] Port ccfb0555f76b
LLVM GN Syncbot [Wed, 6 Oct 2021 22:24:38 +0000 (22:24 +0000)]
[gn build] Port ccfb0555f76b

2 years ago[CUDA] Implement experimental support for texture lookups.
Artem Belevich [Wed, 8 Sep 2021 00:04:07 +0000 (17:04 -0700)]
[CUDA] Implement experimental support for texture lookups.

The patch implements header-only support for testure lookups.

The patch has been tested on a source file with all possible combinations of
argument types supported by CUDA headers, compiled and verified that the
generated instructions and their parameters match the code generated by NVCC.
Unfortunately, compiling texture code requires CUDA headers and can't be tested
in clang itself.  The test will need to be added to the test-suite later.

While generated code compiles and seems to match NVCC, I do not have any code
that uses textures that I could test correctness of the implementation. Hence
the experimental status.

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

2 years agoMore size_t -> uint64_t fixes after 05392466
Arthur Eubanks [Wed, 6 Oct 2021 22:10:37 +0000 (15:10 -0700)]
More size_t -> uint64_t fixes after 05392466

Fixes some bots where the two differ.

2 years agoAdd missing diagnostic for use of _reserved name in extern "C"
Richard Smith [Wed, 6 Oct 2021 22:11:12 +0000 (15:11 -0700)]
Add missing diagnostic for use of _reserved name in extern "C"
declaration.

Names starting with an underscore are reserved at the global scope, so
cannot be used as the name of an extern "C" symbol in any scope because
such usages conflict with a name at global scope.

2 years agoPR50644: Do not warn on a declaration of `operator"" _foo`.
Richard Smith [Wed, 6 Oct 2021 21:11:32 +0000 (14:11 -0700)]
PR50644: Do not warn on a declaration of `operator"" _foo`.

Also do not warn on `#define _foo` or `#undef _foo`.

Only global scope names starting with _[a-z] are reserved, not the use
of such an identifier in any other context.

2 years agoPR50641: Properly handle AttributedStmts when checking for a valid
Richard Smith [Wed, 6 Oct 2021 20:12:20 +0000 (13:12 -0700)]
PR50641: Properly handle AttributedStmts when checking for a valid
constexpr function body.

2 years ago[SCEV] Search operand tree for scope bound when inferring flags from IR
Philip Reames [Wed, 6 Oct 2021 22:07:10 +0000 (15:07 -0700)]
[SCEV] Search operand tree for scope bound when inferring flags from IR

When checking to see if we can apply IR flags to a SCEV, we need to identify a bound on the defining scope of the SCEV to be produced.  We'd previously added support for a couple SCEVExpr types which trivially imply bounds, but hadn't handled types such as umax where the bounds come from the bounds of the operands.  This does the obvious thing, and recurses through operands searching for a tighter bound on the defining scope.

I'm honestly surprised by how little this seems to mater on existing tests, but it's worth doing for completeness sake alone.

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

2 years agoRevert "Reland "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build""
Leonard Chan [Wed, 6 Oct 2021 22:09:15 +0000 (15:09 -0700)]
Revert "Reland "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build""

This reverts commit c52d60ec3b9202eaa9e109be539f1d2a03fbad70.

The failing scudo test came up again.

2 years agoAdd a unit test for llvm-gcc producer strings and cleanup code. (NFC)
Adrian Prantl [Wed, 6 Oct 2021 21:44:32 +0000 (14:44 -0700)]
Add a unit test for llvm-gcc producer strings and cleanup code. (NFC)