platform/upstream/llvm.git
2 years ago[RISCV] Make getMinRVVVectorSizeInBits and getMaxRVVVectorSizeInBits protected [nfc]
Philip Reames [Fri, 24 Jun 2022 23:59:46 +0000 (16:59 -0700)]
[RISCV] Make getMinRVVVectorSizeInBits and getMaxRVVVectorSizeInBits protected [nfc]

These are now only used in the implementation of getRealMinVLen and getRealMaxVLEn, and useRVVForFixedLengthVectors; make them protected to discourage new users.

2 years ago[libcxx][test] MaybePOCCAAllocator should meet the Cpp17Allocator requirements
Casey Carter [Fri, 7 Jan 2022 02:45:28 +0000 (18:45 -0800)]
[libcxx][test] MaybePOCCAAllocator should meet the Cpp17Allocator requirements

Implement `rebind`, the rebinding constructor, and rebind-compatible comparison operators.

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

2 years ago[NFC] Remove dead code
Guillaume Chatelet [Sat, 25 Jun 2022 17:18:29 +0000 (17:18 +0000)]
[NFC] Remove dead code

2 years ago[gn build] Port c92056d03881
LLVM GN Syncbot [Sat, 25 Jun 2022 17:03:46 +0000 (17:03 +0000)]
[gn build] Port c92056d03881

2 years ago[Clang][C++23] P2071 Named universal character escapes
Corentin Jabot [Mon, 4 Apr 2022 10:41:12 +0000 (12:41 +0200)]
[Clang][C++23] P2071 Named universal character escapes

Implements [[ https://wg21.link/p2071r1  | P2071 Named Universal Character Escapes ]] - as an extension in all language mode, the patch  not warn in c++23 mode will be done later once this paper is plenary approved (in July).

We add

 * A code generator that transforms `UnicodeData.txt` and `NameAliases.txt` to a space efficient data structure that can be queried in `O(NameLength)`
 * A set of functions in `Unicode.h` to query that data, including

   * A function to find an exact match of a given Unicode character name
   * A function to perform a loose (ignoring case, space, underscore, medial hyphen) matching
   * A function returning the best matching codepoint for a given string per edit distance

 * Support of `\N{}` escape sequences in String and character Literals, with loose and typos diagnostics/fixits
 * Support of `\N{}` as UCN with loose matching diagnostics/fixits.

Loose matching is considered an error to match closely the semantics of P2071.

The generated data contributes to 280kB of data to the binaries.

`UnicodeData.txt` and `NameAliases.txt`  are not committed to the repository in this patch, and regenerating the data is a manual process.

Reviewed By: tahonermann

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

2 years ago[mlir] Fix a warning
Kazu Hirata [Sat, 25 Jun 2022 16:18:04 +0000 (09:18 -0700)]
[mlir] Fix a warning

This patch fixes:

  llvm-project/mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp:300:26:
  error: comparison of integers of different signs: 'int64_t' (aka
  'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]

2 years ago[mlir][shape] Switch types to ODS generated (NFC)
Jacques Pienaar [Sat, 25 Jun 2022 16:06:52 +0000 (09:06 -0700)]
[mlir][shape] Switch types to ODS generated (NFC)

These were already pretty simple, so just switching to generated.

2 years agoGlobalISel: Make LoadStoreOpt preserve all
Matt Arsenault [Fri, 24 Jun 2022 23:03:57 +0000 (19:03 -0400)]
GlobalISel: Make LoadStoreOpt preserve all

Avoids dropping CSE info analysis

2 years agoX86: Regenerate test checks
Matt Arsenault [Fri, 24 Jun 2022 15:57:04 +0000 (11:57 -0400)]
X86: Regenerate test checks

2 years agoCodeGen: Use else if between Value and PseudoSourceValue cases
Matt Arsenault [Fri, 24 Jun 2022 01:55:42 +0000 (21:55 -0400)]
CodeGen: Use else if between Value and PseudoSourceValue cases

These are mutually exclusive.

2 years ago[MLIR][Presburger] Support computing a representation of a set that only has locals...
Arjun P [Tue, 21 Jun 2022 04:30:11 +0000 (06:30 +0200)]
[MLIR][Presburger] Support computing a representation of a set that only has locals that are divs

This paves the way for integer-exact projection, and for supporting
non-division locals in subtraction, complement, and equality checks.

Reviewed By: Groverkss

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

2 years agoReland "[lldb] [llgs] Support multiprocess in qfThreadInfo"
Michał Górny [Sat, 25 Jun 2022 13:04:26 +0000 (15:04 +0200)]
Reland "[lldb] [llgs] Support multiprocess in qfThreadInfo"

Now preserving the non-standard behavior of returning "OK" response
when there is no debugged process.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128152

2 years ago[clang-format] NFC Sort names of format token types
sstwcw [Sat, 25 Jun 2022 08:35:51 +0000 (08:35 +0000)]
[clang-format] NFC Sort names of format token types

Suggested by HazardyKnusperkeks in D126845.

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years ago[asan][test] XFAIL global-location-nodebug.cpp on Solaris
Rainer Orth [Sat, 25 Jun 2022 08:40:11 +0000 (10:40 +0200)]
[asan][test] XFAIL global-location-nodebug.cpp on Solaris

A new test `FAIL`s on Solaris:

  FAIL: AddressSanitizer-i386-sunos ::
TestCases/global-location-nodebug.cpp (465 of 64279)
  FAIL: AddressSanitizer-i386-sunos-dynamic ::
TestCases/global-location-nodebug.cpp (961 of 64279)

The problem is the unconditional use of `-Wl,-S`:

  ld: fatal: dlopen() of support library (-lstdc++) failed with error:
ld.so.1: ld: -lstdc++: open failed: No such file or directory

`ld -S` has a completely different semantics compared to GNU `ld
-S`/`--strip-debug`: specify a link-edit support library.  To avoid this,
I've chosen to `XFAIL` the test.

Tested on `amd64-pc-solaris2.11`.

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

2 years agoRevert "[lldb] [llgs] Support multiprocess in qfThreadInfo"
Michał Górny [Sat, 25 Jun 2022 07:39:25 +0000 (09:39 +0200)]
Revert "[lldb] [llgs] Support multiprocess in qfThreadInfo"

This reverts part of commit 75757c86c695a6b4695458343637b3c4fe86def6.
It broke the following test:

  commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py

I need more time to figure it out, so I'm reverting the code changes
and marking the tests depending on them xfail.

2 years ago[DeadArgElim] Replace insert with emplace (NFC)
Pavel Samolysov [Sat, 25 Jun 2022 07:31:27 +0000 (10:31 +0300)]
[DeadArgElim] Replace insert with emplace (NFC)

2 years ago[flang] Use descriptors for real/complex input other than kinds 4 and 8
Valentin Clement [Sat, 25 Jun 2022 07:18:59 +0000 (09:18 +0200)]
[flang] Use descriptors for real/complex input other than kinds 4 and 8

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, vdonaldson

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[libc] Add compound assignment and pre-increment operators to UInt.
Siva Chandra Reddy [Sat, 25 Jun 2022 06:38:03 +0000 (06:38 +0000)]
[libc] Add compound assignment and pre-increment operators to UInt.

2 years ago[Driver] Fix -fstrict-flex-arrays= help message after D126864
Fangrui Song [Sat, 25 Jun 2022 05:20:37 +0000 (22:20 -0700)]
[Driver] Fix -fstrict-flex-arrays= help message after D126864

2 years ago[clang] Add back -fsanitize=array-bounds workaround for size-1 array after -fstrict...
Fangrui Song [Sat, 25 Jun 2022 05:15:47 +0000 (22:15 -0700)]
[clang] Add back -fsanitize=array-bounds workaround for size-1 array after -fstrict-flex-arrays change

Before C99 introduced flexible array member, common practice uses size-1 array
to emulate FAM, e.g. https://github.com/python/cpython/issues/94250
As a result, -fsanitize=array-bounds instrumentation skipped such structures
as a workaround (from 539e4a77bbabbc19f22b2bd24e04af2e432e599d).

D126864 accidentally dropped the workaround. Add it back with tests.

2 years ago[libc][Obvious] Compare values of the same type in memory_utils/backend_test.
Siva Chandra Reddy [Sat, 25 Jun 2022 04:50:04 +0000 (04:50 +0000)]
[libc][Obvious] Compare values of the same type in memory_utils/backend_test.

2 years ago[libc][Obvious] Fix incorrect nested namespace name.
Siva Chandra Reddy [Sat, 25 Jun 2022 04:47:21 +0000 (04:47 +0000)]
[libc][Obvious] Fix incorrect nested namespace name.

2 years ago[libc] Add a cacheline size of arm target.
Siva Chandra Reddy [Fri, 24 Jun 2022 18:08:18 +0000 (18:08 +0000)]
[libc] Add a cacheline size of arm target.

It is set arbitrarily at 32 now. It can be adjusted as required in
future.

2 years agoRevert "[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi"
Petr Hosek [Sat, 25 Jun 2022 03:10:55 +0000 (03:10 +0000)]
Revert "[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi"

This reverts commit 4164cfa537e545f8ea9bc4f3c8b913867a7ac79d since
it broke the clang-x86_64-debian-fast builder:

  https://lab.llvm.org/buildbot/#/builders/109/builds/41339

2 years ago[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi
Petr Hosek [Thu, 2 Jun 2022 18:45:26 +0000 (18:45 +0000)]
[CMake][compiler-rt] Clean up the use of libcxx and libcxxabi

We no longer support the use of LLVM_ENABLE_PROJECTS for libcxx and
libcxxabi. We don't use paths to libcxx and libcxxabi in compiler-rt.

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

2 years ago[RISCV][MC] Fold UIMM related code
Shao-Ce SUN [Fri, 24 Jun 2022 09:36:38 +0000 (17:36 +0800)]
[RISCV][MC] Fold UIMM related code

Reviewed By: craig.topper

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

2 years ago[clang-format] Further improve requires clause detection
Björn Schäpers [Fri, 24 Jun 2022 06:02:35 +0000 (08:02 +0200)]
[clang-format] Further improve requires clause detection

If there is a typeish token before the requires, it can't be a requires
expression.

Fixes https://github.com/llvm/llvm-project/issues/56176

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

2 years ago[CMake] Use set rather than list PREPEND
Petr Hosek [Sat, 25 Jun 2022 02:18:51 +0000 (02:18 +0000)]
[CMake] Use set rather than list PREPEND

list PREPEND is only supported since CMake 3.15.

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

2 years ago[MCA][unittest] Hot fix for -Wpessimizing-move on test harness
Min-Yih Hsu [Sat, 25 Jun 2022 01:31:27 +0000 (18:31 -0700)]
[MCA][unittest] Hot fix for -Wpessimizing-move on test harness

Hot fix for -Wpessimizing-move build errors regarding MCA unit test
harness introduced in 97579dcc6d3cd129c75b0502f7c43a18292d44b1.

2 years ago[lldb] Add support for specifying a log handler
Jonas Devlieghere [Fri, 24 Jun 2022 19:53:10 +0000 (12:53 -0700)]
[lldb] Add support for specifying a log handler

This patch adds a new flag to `log enable`, allowing the user to specify
a custom log handler. In addition to the default (stream) handler, this
allows using the circular log handler (which logs to a fixed size,
in-memory circular buffer) as well as the system log handler (which logs
to the operating system log).

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

2 years ago[MLInliner] No need to invalidate everything post-inlining.
Mircea Trofin [Sat, 25 Jun 2022 01:19:34 +0000 (18:19 -0700)]
[MLInliner] No need to invalidate everything post-inlining.

We really just need to invalidate loop info and the dominator tree, in
addition to the FunctionPropertiesInfo we were invalidating originally.
Doing more adds unnecessary compile time overhead.

2 years ago[gn build] Port b847692ed8e1
LLVM GN Syncbot [Sat, 25 Jun 2022 01:03:12 +0000 (01:03 +0000)]
[gn build] Port b847692ed8e1

2 years ago[gn build] (manually) port 97579dcc6d3 (LLVMMCATests)
Nico Weber [Sat, 25 Jun 2022 01:00:16 +0000 (21:00 -0400)]
[gn build] (manually) port 97579dcc6d3 (LLVMMCATests)

The CMake code makes a number of imho strange choices. I pointed those
out on https://reviews.llvm.org/D127083.

The GN build mirrors the CMake build's choices for now.

2 years ago[mlir][affine] Rigorous check for loop unrolling store operation
lewuathe [Fri, 24 Jun 2022 23:59:13 +0000 (08:59 +0900)]
[mlir][affine] Rigorous check for loop unrolling store operation

Static loop unrolling does not change the operation type. We can rigorously make sure to use affine.store in the check.

Reviewed By: ftynse

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

2 years ago[BOLT] Mark option values of --split-functions deprecated
Fabian Parzefall [Sat, 25 Jun 2022 00:00:20 +0000 (17:00 -0700)]
[BOLT] Mark option values of --split-functions deprecated

The SplitFunctions pass does not distinguish between various splitting
modes anymore. This change updates the command line interface to
reflect this behavior by deprecating values passed to the
--split-function option.

Reviewed By: rafauler

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

2 years ago[mlir][quant] output spec verification check for quant.region
lewuathe [Fri, 24 Jun 2022 23:27:38 +0000 (08:27 +0900)]
[mlir][quant] output spec verification check for quant.region

We can have validation test for quant.region having incompatible output spec.

Reviewed By: stellaraccident

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

2 years ago[RISCV] Implement RISCVTTIImpl::getMaxVScale correctly
Philip Reames [Fri, 24 Jun 2022 23:48:21 +0000 (16:48 -0700)]
[RISCV] Implement RISCVTTIImpl::getMaxVScale correctly

The comments in the existing code appear to pre-exist the standardization of the +v extension. In particular, the specification *does* provide a bound on the maximum value VLEN can take. From what I can tell, the LMUL comment was simply a misunderstanding of what this API returns.

This API returns the maximum value that vscale can take at runtime. This is used in the vectorizer to bound the largest scalable VF (e.g. LMUL in RISCV terms) which can be used without violating memory dependence.

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

2 years ago[libc][math] Fix broken compilation due to __builtin_inf/nan functions.
Kirill Okhotnikov [Fri, 24 Jun 2022 23:39:32 +0000 (01:39 +0200)]
[libc][math] Fix broken compilation due to __builtin_inf/nan functions.

2 years ago[MCA] Hot fix for -Wmismatched-tags errors on mca::SourceMgr
Min-Yih Hsu [Fri, 24 Jun 2022 23:10:27 +0000 (16:10 -0700)]
[MCA] Hot fix for -Wmismatched-tags errors on mca::SourceMgr

Hot fix for -Wmismatched-tags build errors regarding mca::SourceMgr
changes introduced in 97579dcc6d3cd129c75b0502f7c43a18292d44b1.

2 years ago[MCA] Allow mca::Instruction-s to be recycled and reused
Min-Yih Hsu [Sun, 5 Jun 2022 19:06:01 +0000 (12:06 -0700)]
[MCA] Allow mca::Instruction-s to be recycled and reused

This patch introduces a new feature that allows InstrBuilder to reuse
mca::Instruction recycled from IncrementalSourceMgr. This significantly
reduces the memory footprint.
Note that we're only recycling instructions that have static InstrDesc
and no variadic operands.

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

2 years ago[MCA] Introducing incremental SourceMgr and resumable pipeline
Min-Yih Hsu [Mon, 30 May 2022 23:50:09 +0000 (16:50 -0700)]
[MCA] Introducing incremental SourceMgr and resumable pipeline

The new resumable mca::Pipeline capability introduced in this patch
allows users to save the current state of pipeline and resume from the
very checkpoint.
It is better (but not require) to use with the new IncrementalSourceMgr,
where users can add mca::Instruction incrementally rather than having a
fixed number of instructions ahead-of-time.

Note that we're using unit tests to test these new features. Because
integrating them into the `llvm-mca` tool will make too many churns.

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

2 years ago[CMake][compiler-rt] Treat target cflags as list rather than string
Petr Hosek [Fri, 24 Jun 2022 18:52:35 +0000 (18:52 +0000)]
[CMake][compiler-rt] Treat target cflags as list rather than string

This is need after 30dfe016d4259398689dc1be163e0ecc804b5feb.

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

2 years ago[clang][dataflow] Implement functionality to compare if two boolean values are equiva...
Wei Yi Tee [Fri, 24 Jun 2022 22:06:30 +0000 (00:06 +0200)]
[clang][dataflow] Implement functionality to compare if two boolean values are equivalent.

`equivalentBoolValues` compares equivalence between two booleans. The current implementation does not consider constraints imposed by flow conditions on the booleans and its subvalues.

Depends On D128520

Reviewed By: gribozavr2, xazax.hun

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

2 years ago[clang][dataflow] Refactor function that queries the solver for satisfiability checking.
Wei Yi Tee [Fri, 24 Jun 2022 22:02:13 +0000 (00:02 +0200)]
[clang][dataflow] Refactor function that queries the solver for satisfiability checking.

Given a set of `Constraints`, `querySolver` adds common background information across queries (`TrueVal` is always true and `FalseVal` is always false) and passes the query to the solver.

`checkUnsatisfiable` is a simple wrapper around `querySolver` for checking that the solver returns an unsatisfiable result.

Depends On D128519

Reviewed By: gribozavr2, xazax.hun

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

2 years ago[libc][math] Fix broken aarch64 due to clz refactoring.
Kirill Okhotnikov [Fri, 24 Jun 2022 21:59:26 +0000 (23:59 +0200)]
[libc][math] Fix broken aarch64 due to clz refactoring.

2 years agofix-forward hwasan-globals.cpp (round 2)
Mitch Phillips [Fri, 24 Jun 2022 21:49:37 +0000 (14:49 -0700)]
fix-forward hwasan-globals.cpp (round 2)

Just force the aarch64 target compilation (after making sure the test
only runs if that target is available).

Because global metadata isn't target-specific, just selecting a target
here is fine.

Should fix https://reviews.llvm.org/D127544#3609312

2 years agoDon't run hwasan-globals.cpp test on non-x86/aarch64
Mitch Phillips [Fri, 24 Jun 2022 21:31:45 +0000 (14:31 -0700)]
Don't run hwasan-globals.cpp test on non-x86/aarch64

Fix-forward for https://reviews.llvm.org/D127544#3609312

IR pass has some target-specific inline asm lowering that check-fails
for non-x86 non-aarch64 targets.

For now, just run these tests only on those targets.

2 years ago[libc++][AIX] Make basic_string layout compatible with earlier version
Xing Xue [Fri, 24 Jun 2022 21:25:15 +0000 (17:25 -0400)]
[libc++][AIX] Make basic_string layout compatible with earlier version

Summary:
Patch D123580 changed to use bit fields for strings in long and short mode. As a result, this changes the layout of these strings on AIX because bit fields on AIX are 4 bytes, which breaks the ABI compatibility with earlier strings before the change on AIX. This patch uses the attribute 'packed' and anonymous structure to make string layout compatible. This patch will also make test cases alignof.compile.pass.cpp and sizeof.compile.pass.cpp introduced in D127672 pass on AIX.

Reviewed by: philnik, Mordante, hubert.reinterpretcast, libc++

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

2 years ago[clang][dataflow] Move logic for creating implication and iff expressions into `Dataf...
Wei Yi Tee [Fri, 24 Jun 2022 19:59:16 +0000 (21:59 +0200)]
[clang][dataflow] Move logic for creating implication and iff expressions into `DataflowAnalysisContext` from `DataflowEnvironment`.

To keep functionality of creating boolean expressions in a consistent location.

Depends On D128357

Reviewed By: gribozavr2, sgatev, xazax.hun

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

2 years ago[libc][math] fmod/fmodf implementation.
Kirill Okhotnikov [Mon, 6 Jun 2022 08:10:24 +0000 (10:10 +0200)]
[libc][math] fmod/fmodf implementation.

This is a implementation of find remainder fmod function from standard libm.
The underline algorithm is developed by myself, but probably it was first
invented before.
Some features of the implementation:
1. The code is written on more-or-less modern C++.
2. One general implementation for both float and double precision numbers.
3. Spitted platform/architecture dependent and independent code and tests.
4. Tests covers 100% of the code for both float and double numbers. Tests cases with NaN/Inf etc is copied from glibc.
5. The new implementation in general 2-4 times faster for “regular” x,y values. It can be 20 times faster for x/y huge value, but can also be 2 times slower for double denormalized range (according to perf tests provided).
6. Two different implementation of division loop are provided. In some platforms division can be very time consuming operation. Depend on platform it can be 3-10 times slower than multiplication.

Performance tests:

The test is based on core-math project (https://gitlab.inria.fr/core-math/core-math). By Tue Ly suggestion I took hypot function and use it as template for fmod. Preserving all test cases.

`./check.sh <--special|--worst> fmodf` passed.
`CORE_MATH_PERF_MODE=rdtsc ./perf.sh fmodf` results are

```
GNU libc version: 2.35
GNU libc release: stable
21.166 <-- FPU
51.031 <-- current glibc
37.659 <-- this fmod version.
```

2 years agoRevert "[Driver][test] Replace ^//$ with empty string"
Fangrui Song [Fri, 24 Jun 2022 20:52:27 +0000 (13:52 -0700)]
Revert "[Driver][test] Replace ^//$ with empty string"

This reverts commit 4817b7729a1846b709ec02b98bfe11b0125f8e8f.

It caused some `^/\n` and had some objection about its readability improvement.

2 years ago[RISCV] Simplify 16 bit index handling in lowerVECTOR_REVERSE [nfc]
Philip Reames [Fri, 24 Jun 2022 20:08:39 +0000 (13:08 -0700)]
[RISCV] Simplify 16 bit index handling in lowerVECTOR_REVERSE [nfc]

getRealMaxVLen returns an upper bound on the value of VLEN.  We can use this upper bound (which unless explicitly set at command line is going to result in a e8 MaxVLMax of much greater than 256) instead of explicitly handling the unknown case separately from the bounded by number greater than 256 case.

Note as well that this code already implicitly depends on a capped value for VLEN.  If infinite VLEN were possible, than 16 bit indices wouldn't be enough.

2 years ago[RISCV] Replace two calls to getMinRVVVectorSizeInBits in fixed length lowering ...
Philip Reames [Fri, 24 Jun 2022 19:59:06 +0000 (12:59 -0700)]
[RISCV] Replace two calls to getMinRVVVectorSizeInBits in fixed length lowering [nfc]

Both of these are only reached if useRVVForFixedLengthVectors is true.  Given that, we know that getRealMinVLen() == getMinRVVVectorSizeInBits().

2 years ago[clang][dataflow] Store flow condition constraints in a single `FlowConditionConstrai...
Wei Yi Tee [Fri, 24 Jun 2022 19:39:23 +0000 (21:39 +0200)]
[clang][dataflow] Store flow condition constraints in a single `FlowConditionConstraints` map.

A flow condition is represented with an atomic boolean token, and it is bound to a set of constraints: `(FC <=> C1 ^ C2 ^ ...)`. \
This was internally represented as `(FC v !C1 v !C2 v ...) ^ (C1 v !FC) ^ (C2 v !FC) ^ ...` and tracked by 2 maps:
- `FlowConditionFirstConjunct` stores the first conjunct `(FC v !C1 v !C2 v ...)`
- `FlowConditionRemainingConjuncts` stores the remaining conjuncts `(C1 v !FC) ^ (C2 v !FC) ^ ...`

This patch simplifies the tracking of the constraints by using a single `FlowConditionConstraints` map which stores `(C1 ^ C2 ^ ...)`, eliminating the use of two maps.

Reviewed By: gribozavr2, sgatev, xazax.hun

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

2 years ago[BOLT][DWARF] Add support for DW_AT_call_pc/DW_AT_call_return_pc
Alexander Yermolovich [Fri, 24 Jun 2022 19:37:01 +0000 (12:37 -0700)]
[BOLT][DWARF] Add support for DW_AT_call_pc/DW_AT_call_return_pc

DWARF 5 added two new attributes DW_AT_call_pc and DW_AT_call_return_pc.
Adding support for them.

Reviewed By: maksfb

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

2 years ago[mlir][vector] Fix bug when swapping scf.for and vector warp op
Thomas Raoux [Fri, 24 Jun 2022 19:11:36 +0000 (19:11 +0000)]
[mlir][vector] Fix bug when swapping scf.for and vector warp op

When creating a scf.for without argument a scf.yield is automatically
created. Make sure we don't create a second one.

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

2 years ago[RISCV] Replace two calls to getMinRVVVectorSizeInBits with getRealMinVLen [nfc]
Philip Reames [Fri, 24 Jun 2022 19:03:33 +0000 (12:03 -0700)]
[RISCV] Replace two calls to getMinRVVVectorSizeInBits with getRealMinVLen [nfc]

This doesn't change behavior, it just makes it slightly more obvious what's
going on.  Note that getRealMinVLen is always >= getMinRVVVectorSizeInBits.

The first case is a bit tricky, as you have to know that
getMinRVVVectorSizeInBits returns 0 when not set, and thus is equivalent
to the else value clause.  The new code structure makes it more obvious we
return 0 unless using RVV for fixed length vectors.

2 years ago[flang][OpenACC] Lower parallel loop
Valentin Clement [Fri, 24 Jun 2022 19:06:05 +0000 (21:06 +0200)]
[flang][OpenACC] Lower parallel loop

Lower the `parallel loop` contrsuct and refactor some of the code
of parallel and loop lowering to be reused.

Also add tests for loop and parallel since they were not upstreamed.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

2 years ago[flang][lowering] handle MERGE with different FSOURCE and TSOURCE types
Valentin Clement [Fri, 24 Jun 2022 19:04:24 +0000 (21:04 +0200)]
[flang][lowering] handle MERGE with different FSOURCE and TSOURCE types

In merge FSOURCE and TSOURCE must have the same Fortran dynamic types,
but this does not imply that FSOURCE and TSOURCE will be lowered to the
same MLIR types. For instance, TSOURCE may be a character expression
with a compile type constant length (!fir.char<1,4>) while FSOURCE may
have dynamic length (!fir.char<1,?>).

Cast FSOURCE to TSOURCE MLIR types to handle these cases.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years agoAdd no_sanitize('hwaddress') (and 'memtag', but that's a no-op).
Mitch Phillips [Fri, 24 Jun 2022 17:48:18 +0000 (10:48 -0700)]
Add no_sanitize('hwaddress') (and 'memtag', but that's a no-op).

Currently, `__attribute__((no_sanitize('hwaddress')))` is not possible. Add this piece of plumbing, and now that we properly support copying attributes between an old and a new global variable, add a regression test for the GlobalOpt bug that previously lost the attribute.

Reviewed By: aaron.ballman

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

2 years ago[HWASan] Use new IR attribute for communicating unsanitized globals.
Mitch Phillips [Fri, 24 Jun 2022 17:47:34 +0000 (10:47 -0700)]
[HWASan] Use new IR attribute for communicating unsanitized globals.

Globals that shouldn't be sanitized are currently communicated to HWASan
through the use of the llvm.asan.globals IR metadata. Now that we have
an on-GV attribute, use it.

Reviewed By: pcc

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

2 years ago[flang] Explicitly map host associated symbols
Valentin Clement [Fri, 24 Jun 2022 19:03:00 +0000 (21:03 +0200)]
[flang] Explicitly map host associated symbols

Explicitly map host associated symbols in DoConcurrent with shared
locality-spec, clauses in OpenMP/OpenACC. The mapping of host-assoc
symbols is set to their parent SymbolBox. This is achieved through
a new interface function in the AbstractConverter.

This was already upstream for OpenMP.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
2 years ago[mlir][vector] Relax transfer_write vector distribution pattern
Thomas Raoux [Fri, 24 Jun 2022 18:40:40 +0000 (18:40 +0000)]
[mlir][vector] Relax transfer_write vector distribution pattern

Small change to relax the pattern to support any vector containing a
single element.

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

2 years ago[flang] Fix LBOUND with assumed size array and non constant DIM
Valentin Clement [Fri, 24 Jun 2022 19:01:25 +0000 (21:01 +0200)]
[flang] Fix LBOUND with assumed size array and non constant DIM

LBOUND with a non constant DIM argument use the runtime to allow runtime
verification of DIM <= RANK. The interface uses a descriptor. This caused
undefined behavior because the runtime believed it was seeing an explicit
shape arrays with zero extent and returned `1` (the runtime descriptor
does not allow making a difference between an explicit shape and an
assumed size. Assumed size are not meant to be described by runtime
descriptors).

Fix the issue by setting the last extent of assumed size to `1` when
creating the descriptor to inquire about the LBOUND with the runtime.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[LV][RISCV] Add coverage showing scalable codegen when etype != ELEN
Philip Reames [Fri, 24 Jun 2022 18:35:19 +0000 (11:35 -0700)]
[LV][RISCV] Add coverage showing scalable codegen when etype != ELEN

We currently have a costing bug around the etype == ELEN case, so add otherwise duplicate tests to show test diffs as I work on other parts of costing.

2 years ago[lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers
Venkata Ramanaiah Nalamothu [Thu, 2 Jun 2022 17:49:30 +0000 (23:19 +0530)]
[lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers

The requirements for "thread until <line number>" are:

a) If any code contributed by <line number> or the nearest subsequent of <line number> is executed before leaving the function, stop
b) If you end up leaving the function w/o triggering (a), then stop

In case of (a), since the <line number> may have multiple entries in the line table and the compiler might have scheduled/moved the relevant code across, and the lldb does not know the control flow, set breakpoints on all the line table entries of best match of <line number> i.e. exact or the nearest subsequent line.

Along with the above, currently, CommandObjectThreadUntil is also setting the breakpoints on all the subsequent line numbers after the best match and this latter part is wrong.

This issue is discussed at http://lists.llvm.org/pipermail/lldb-dev/2018-August/013979.html.

In fact, currently `TestStepUntil.py` is not actually testing step until scenarios and `test_missing_one` test fails without this patch if tests are made to run. Fixed the test as well.

Reviewed By: jingham

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

2 years ago[Driver][test] Replace ^//$ with empty string
Fangrui Song [Fri, 24 Jun 2022 18:25:03 +0000 (11:25 -0700)]
[Driver][test] Replace ^//$ with empty string

The convention does not add //\n. Having all RUN/CHECK lines separated by //\n
makes editor movement difficult (e.g. { } in Vim).

2 years ago[lldb] Move Host::SystemLog out of !defined(_WIN32)
Jonas Devlieghere [Fri, 24 Jun 2022 18:17:38 +0000 (11:17 -0700)]
[lldb] Move Host::SystemLog out of !defined(_WIN32)

The definition of Host::SystemLog was (unintentionally) guarded by
!defined(_WIN32).

2 years ago[mlir][bufferization][sparse] put restriction on sparse tensor allocation
Aart Bik [Thu, 23 Jun 2022 19:17:01 +0000 (12:17 -0700)]
[mlir][bufferization][sparse] put restriction on sparse tensor allocation

Putting some direct use restrictions on tensor allocations in the
sparse case enables the use of simplifying assumptions in the
bufferization analysis.

Reviewed By: springerm

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

2 years ago[lldb] Fix flakiness in shell tests that mixed stderr and stdout
Jonas Devlieghere [Fri, 24 Jun 2022 17:52:13 +0000 (10:52 -0700)]
[lldb] Fix flakiness in shell tests that mixed stderr and stdout

Because the diagnostic events are processed by the default event handler
in its own thread, tests cannot rely on output ordering. Split stdout
and stderr to make the test reliable again.

2 years ago[lldb] Add SystemLogHandler for emitting log messages to the system log
Jonas Devlieghere [Fri, 24 Jun 2022 17:03:03 +0000 (10:03 -0700)]
[lldb] Add SystemLogHandler for emitting log messages to the system log

Add a system log handler that emits log messages to the operating system
log. In addition to the log handler itself, this patch also introduces a
new Host::SystemLog helper function to abstract over writing to the
system log.

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

2 years agoRevert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info"
David Blaikie [Fri, 24 Jun 2022 16:47:57 +0000 (16:47 +0000)]
Revert "DebugInfo: Fully integrate ctor type homing into 'limited' debug info"

Reverting to simplify some Google-internal rollout issues. Will recommit
in a week or two.

This reverts commit 517bbc64dbe493644eff8d55fd9566435e930520.

2 years ago[Inline] Annotate inline pass name with link phase information for analysis.
Mingming Liu [Thu, 12 May 2022 07:12:20 +0000 (00:12 -0700)]
[Inline] Annotate inline pass name with link phase information for analysis.

The annotation is flag gated; flag is turned off by default.

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

2 years ago[OpenMP][libomp] avoid spin wait and yield on arm64 macOS
Daniel Douglas [Fri, 24 Jun 2022 16:59:22 +0000 (11:59 -0500)]
[OpenMP][libomp] avoid spin wait and yield on arm64 macOS

This patch changes the default behavior to avoid spin waiting and
yielding. (See “Don’t Keep Threads Active And Idle” section here:
https://developer.apple.com/documentation/apple-silicon/tuning-your-code-s-performance-for-apple-silicon)

We verified using instruments traces that the changes improve scheduling
behavior on macOS.

We also collected results using EPCC schedbench
(https://github.com/LangdalP/EPCC-OpenMP-micro-benchmarks) that are
attached here that show a reduction in standard deviation and max test
run time across all scheduling types. Static scheduling sees dramatic
improvements with these changes, we see a 2-4x average runtime
improvement in the benchmark.

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

2 years ago[OpenMP] Initial parsing and sema support for 'masked taskloop' construct
Fazlay Rabbi [Fri, 24 Jun 2022 15:42:21 +0000 (08:42 -0700)]
[OpenMP] Initial parsing and sema support for 'masked taskloop' construct

This patch gives basic parsing and semantic support for "masked taskloop"
construct introduced in OpenMP 5.1 (section 2.16.7)

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

2 years ago[clang codegen] Add dso_local/hidden/etc. markings to VTT declarations
Eli Friedman [Fri, 24 Jun 2022 16:58:31 +0000 (09:58 -0700)]
[clang codegen] Add dso_local/hidden/etc. markings to VTT declarations

We were marking definitions, but not declarations. Marking declarations
makes computing the address more efficient.

Fixes issue reported at https://discourse.llvm.org/t/63090

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

2 years ago[Sema] Check whether `__auto_type` has been deduced before merging
Akira Hatanaka [Wed, 22 Jun 2022 18:52:22 +0000 (11:52 -0700)]
[Sema] Check whether `__auto_type` has been deduced before merging

This fixes a bug in clang where it emits the following diagnostic when
compiling the test case:

"argument to 'sizeof' in 'memset' call is the same pointer type 'S' as
the destination"

The code that merges __auto_type with other types was committed in
https://reviews.llvm.org/D122029.

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

2 years ago[clang-tidy] Update release notes (NFC)
Richard [Fri, 24 Jun 2022 16:47:51 +0000 (10:47 -0600)]
[clang-tidy] Update release notes (NFC)

- Sort changes to existing checks by check name
- Correct check link

2 years ago[lldb] Replace Host::SystemLog with Debugger::Report{Error,Warning}
Jonas Devlieghere [Fri, 24 Jun 2022 16:36:29 +0000 (09:36 -0700)]
[lldb] Replace Host::SystemLog with Debugger::Report{Error,Warning}

As it exists today, Host::SystemLog is used exclusively for error
reporting. With the introduction of diagnostic events, we have a better
way of reporting those. Instead of printing directly to stderr, these
messages now get printed to the debugger's error stream (when using the
default event handler). Alternatively, if someone is listening for these
events, they can decide how to display them, for example in the context
of an IDE such as Xcode.

This change also means we no longer write these messages to the system
log on Darwin. As far as I know, nobody is relying on this, but I think
this is something we could add to the diagnostic event mechanism.

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

2 years ago[SLP]Improve shuffles cost estimation where possible.
Alexey Bataev [Thu, 9 Dec 2021 18:34:08 +0000 (10:34 -0800)]
[SLP]Improve shuffles cost estimation where possible.

Improved/fixed cost modeling for shuffles by providing masks, improved
cost model for non-identity insertelements.

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

2 years ago[ObjCopy] Fix type mismatch in writeCodeSignatureData()
Joshua Root [Fri, 24 Jun 2022 16:12:55 +0000 (09:12 -0700)]
[ObjCopy] Fix type mismatch in writeCodeSignatureData()

The result of pointer subtraction is of type ptrdiff_t, which is not necessarily the same underlying type as ssize_t. This can lead to a compilation error since std::min requires both parameters to be the same type.

Fixes: https://github.com/llvm/llvm-project/issues/54846

Reviewed By: alexander-shaposhnikov, drodriguez, jhenderson

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

2 years ago[GlobalOpt] Perform store->dominated load forwarding for stored once globals
Arthur Eubanks [Sat, 18 Jun 2022 21:14:04 +0000 (14:14 -0700)]
[GlobalOpt] Perform store->dominated load forwarding for stored once globals

The initial land incorrectly optimized forwarding non-Constants in non-nosync/norecurse functions. Bail on non-Constants since norecurse should cause global -> alloca promotion anyway.

The initial land also incorrectly assumed that StoredOnceStore was the only store to the global, but it actually means that only one value other than the global initializer is stored. Add a check that there's only one store.

Compile time tracker:
https://llvm-compile-time-tracker.com/compare.php?from=c80b88ee29f34078d2149de94e27600093e6c7c0&to=ef2c2b7772424b6861a75e794f3c31b45167304a&stat=instructions

Reviewed By: nikic, asbirlea, jdoerfert

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

2 years ago[libcxx][test] barrier completion functions must be non-throwing
Casey Carter [Fri, 24 Jun 2022 16:06:39 +0000 (09:06 -0700)]
[libcxx][test] barrier completion functions must be non-throwing

... per N4910 [thread.barrier.class]/5.

2 years ago[libc] Add Uint128 type as a fallback when __uint128_t is not available.
Siva Chandra Reddy [Tue, 21 Jun 2022 18:14:13 +0000 (18:14 +0000)]
[libc] Add Uint128 type as a fallback when __uint128_t is not available.

Also, the unused specializations of __int128_t have been removed.

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

2 years ago[RISCV] Split a vectorizer test runline so that upcoming changes in defaults are...
Philip Reames [Fri, 24 Jun 2022 15:47:03 +0000 (08:47 -0700)]
[RISCV] Split a vectorizer test runline so that upcoming changes in defaults are visible

2 years ago[RISCV] Modify a test line so it exercises the intended configuration once we turn...
Philip Reames [Fri, 24 Jun 2022 15:45:53 +0000 (08:45 -0700)]
[RISCV] Modify a test line so it exercises the intended configuration once we turn on scalable vectorization

2 years agoELF: Do not relax ADRP/LDR -> ADRP/ADD for absolute symbols in PIC.
Peter Collingbourne [Fri, 24 Jun 2022 04:47:14 +0000 (21:47 -0700)]
ELF: Do not relax ADRP/LDR -> ADRP/ADD for absolute symbols in PIC.

GOT references to absolute symbols can't be relaxed to use ADRP/ADD in
position-independent code because these instructions produce a relative
address.

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

2 years ago[LV] Create RT checks once VF/IC are selected, track scalar cost.
Florian Hahn [Fri, 24 Jun 2022 15:42:11 +0000 (17:42 +0200)]
[LV] Create RT checks once VF/IC are selected, track scalar cost.

This patch updates LV to generate runtime after the VF & IC are selected. It
allows deciding whether to vectorize with runtime checks or not based on
their cost compared to the vector loop.

It also updates VectorizationFactor to include the scalar cost.

Reviewed By: lebedev.ri, dmgreen

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

2 years ago[NFC][lldb][trace] Rename trace session to trace bundle
Walter Erquinigo [Fri, 24 Jun 2022 00:45:24 +0000 (17:45 -0700)]
[NFC][lldb][trace] Rename trace session to trace bundle

As previously discussed with @jj10306, we didn't really have a name for
the post-mortem (or offline) trace session representation, which is in
fact a folder with a bunch of files. We decided to call this folder
"trace bundle", and the main JSON file in it "trace bundle description
file". This naming is pretty decent, so I'm refactoring all the existing
code to account for that.

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

2 years ago[AMDGPU] gfx11 VOPD instructions MC support
Joe Nash [Wed, 25 May 2022 18:09:11 +0000 (14:09 -0400)]
[AMDGPU] gfx11 VOPD instructions MC support

VOPD is a new encoding for dual-issue instructions for use in wave32.
This patch includes MC layer support only.

A VOPD instruction is constituted of an X component (for which there are
13 possible opcodes) and a Y component (for which there are the 13 X
opcodes plus 3 more). Most of the complexity in defining and parsing
a VOPD operation arises from the possible different total numbers of
operands and deferred parsing of certain operands depending on the
constituent X and Y opcodes.

Reviewed By: dp

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

2 years ago[RISCV] Change how we isel (add X, [-4096, -2049]) or (add X, [2048,4095]).
Craig Topper [Fri, 24 Jun 2022 15:21:05 +0000 (08:21 -0700)]
[RISCV] Change how we isel (add X, [-4096, -2049]) or (add X, [2048,4095]).

We currently split the immediate almost equally between two addis.
If the immediate is odd, it won't be split exactly equal.

This patch instead gives one addi an immediate of 2047 or -2048 and the
other getsthe remainder. If the original immediate is near -2049 or 2048,
this might allow the use of c.addi for the addi that receives the
smaller immediate.

Reviewed By: asb, luismarques

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

2 years agoAMDGPU: Clear kill flags when optimizing vcmp save exec sequence
Konstantin Zhuravlyov [Fri, 24 Jun 2022 15:28:59 +0000 (11:28 -0400)]
AMDGPU: Clear kill flags when optimizing vcmp save exec sequence

It was causing bad machine code for several blender scenes:
  *** Bad machine code: Using an undefined physical register ***
  - function:    kernel_holdout_emission_blurring_pathtermination_ao
  - basic block: %bb.28 if.end40.i (0x7f84861a2320)
  - instruction: V_CMPX_EQ_U32_nosdst_e64 0, $vgpr3, implicit-def $exec, implicit $exec
  - operand 1:   $vgpr3

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

2 years ago[lldb] [test] Move part of fork tests to common helper
Michał Górny [Wed, 22 Jun 2022 17:25:13 +0000 (19:25 +0200)]
[lldb] [test] Move part of fork tests to common helper

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128361

2 years ago[lldb] [llgs] Introduce an AppendThreadIDToResponse() helper
Michał Górny [Wed, 22 Jun 2022 06:32:05 +0000 (08:32 +0200)]
[lldb] [llgs] Introduce an AppendThreadIDToResponse() helper

Introduce a helper function to append GDB Remote Serial Protocol "thread
IDs", with optional PID in multiprocess mode.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128324

2 years ago[lldb] [llgs] Implement the 'T' packet
Michał Górny [Mon, 20 Jun 2022 09:34:23 +0000 (11:34 +0200)]
[lldb] [llgs] Implement the 'T' packet

Implement the 'T' packet that is used to verify whether the specified
thread belongs to the debugged processes.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128170

2 years ago[lldb] [llgs] Include PID in QC response in multiprocess mode
Michał Górny [Mon, 20 Jun 2022 06:59:27 +0000 (08:59 +0200)]
[lldb] [llgs] Include PID in QC response in multiprocess mode

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128156

2 years ago[lldb] [llgs] Add a test for multiprocess register read/write
Michał Górny [Sun, 19 Jun 2022 07:00:54 +0000 (09:00 +0200)]
[lldb] [llgs] Add a test for multiprocess register read/write

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128153

2 years ago[lldb] [llgs] Support multiprocess in qfThreadInfo
Michał Górny [Sat, 18 Jun 2022 19:06:41 +0000 (21:06 +0200)]
[lldb] [llgs] Support multiprocess in qfThreadInfo

Update the `qfThreadInfo` handler to report threads of all debugged
processes and include PIDs when in multiprocess mode.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128152

2 years ago[lldb] [llgs] Add a test for multiprocess memory read/write
Michał Górny [Sat, 18 Jun 2022 16:56:10 +0000 (18:56 +0200)]
[lldb] [llgs] Add a test for multiprocess memory read/write

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128150

2 years ago[lldb] [llgs] Support resuming one process with PID!=current via vCont
Michał Górny [Wed, 15 Jun 2022 14:48:48 +0000 (16:48 +0200)]
[lldb] [llgs] Support resuming one process with PID!=current via vCont

Extend vCont function to support resuming a process with an arbitrary
PID, that could be different than the one selected via Hc (or no process
at all may be selected).  Resuming more than one process simultaneously
is not supported yet.

Remove the ReadTid() method that was only used by Handle_vCont(),
and furthermore it was wrongly using m_current_process rather than
m_continue_process.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D127862