platform/upstream/llvm.git
16 months ago[Test] Add test on freezing of widenable condition
Max Kazantsev [Tue, 21 Mar 2023 08:59:00 +0000 (15:59 +0700)]
[Test] Add test on freezing of widenable condition

16 months ago[flang] Handle polymorphic entities with rank > 0 in entry statement
Valentin Clement [Tue, 21 Mar 2023 08:50:31 +0000 (09:50 +0100)]
[flang] Handle polymorphic entities with rank > 0 in entry statement

Correctly create the temporary for argument absent in the entry statement.

Reviewed By: PeteSteinfeld

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

16 months ago[MergeFuncs] Compare load instruction metadata
Ding Xiang Fei [Tue, 21 Mar 2023 08:45:51 +0000 (09:45 +0100)]
[MergeFuncs] Compare load instruction metadata

MergeFuncs currently merges load instructions with differing
semantically-relevant metadata, e.g. a load that has !nonnull
with one that does not.

Update FunctionComparator to make sure that metadata of both
loads is the same. Alternatively, it would be possilbe to ignore
the metadata during comparison, and then drop it during merging.

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

16 months ago[NFC] Change strcpy to std::copy
Ilyas Mustafazade [Tue, 21 Mar 2023 08:43:51 +0000 (09:43 +0100)]
[NFC] Change strcpy to std::copy

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

16 months ago[X86][MemFold] Stop emitting Header for X86 fold tables
Bing1 Yu [Tue, 21 Mar 2023 08:38:05 +0000 (16:38 +0800)]
[X86][MemFold] Stop emitting Header for X86 fold tables

Reviewed By: skan

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

16 months ago[WebAssembly] Add auto-upgrade for renamed intrinsics
Nikita Popov [Mon, 20 Mar 2023 14:48:48 +0000 (15:48 +0100)]
[WebAssembly] Add auto-upgrade for renamed intrinsics

D138249 renamed a number of wasm intrinsics without implementing
auto-upgrade support.

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

16 months ago[Bazel] Fixup for D144351, Add `alwayslink` to `//llvm:tblgen`
NAKAMURA Takumi [Tue, 21 Mar 2023 07:52:14 +0000 (16:52 +0900)]
[Bazel] Fixup for D144351, Add `alwayslink` to `//llvm:tblgen`

16 months ago[InstCombine] Combine binary operator of two phi node
luxufan [Fri, 3 Mar 2023 08:34:17 +0000 (16:34 +0800)]
[InstCombine] Combine binary operator of two phi node

Combine binary operator of two phi node if there is at least one
specific constant value in phi0 and phi1's incoming values for each
same incoming block and this specific constant value can be used
to do optimization for specific binary operator.
For example:
```
%phi0 = phi i32 [0, %bb0], [%i, %bb1]
%phi1 = phi i32 [%j, %bb0], [0, %bb1]
%add = add i32 %phi0, %phi1
==>
%add = phi i32 [%j, %bb0], [%i, %bb1]
```

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

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

16 months agollvm-tblgen: Rewrite emitters to use `TableGen::Emitter`
NAKAMURA Takumi [Sun, 19 Feb 2023 05:30:14 +0000 (14:30 +0900)]
llvm-tblgen: Rewrite emitters to use `TableGen::Emitter`

Each emitter became self-contained since it has the registration of option.

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

16 months agollvm-tblgen: Cleanup for each EmitterClass to be invoked by uniform signature.
NAKAMURA Takumi [Sat, 18 Feb 2023 16:22:38 +0000 (01:22 +0900)]
llvm-tblgen: Cleanup for each EmitterClass to be invoked by uniform signature.

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

16 months agollvm-tblgen: Move decl of `EmitDecoder()`to TableGenBackends.h
NAKAMURA Takumi [Mon, 20 Feb 2023 14:02:00 +0000 (23:02 +0900)]
llvm-tblgen: Move decl of `EmitDecoder()`to TableGenBackends.h

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

16 months agoTableGen: Introduce `llvm::TableGen::Emitter` to register backends
NAKAMURA Takumi [Thu, 16 Feb 2023 23:24:07 +0000 (08:24 +0900)]
TableGen: Introduce `llvm::TableGen::Emitter` to register backends

`Opt(flag, func, desc)` registers an option into `Action`.

`OptClass<EmitterC>` is also available if `EmitterC(RK).run(OS)` is capable.

`Action` is defined as `ManagedStatic<cl::opt>` to guarantee to be created
when each registration of emitter is invoked.

`llvm::TableGenMain(argv0, MainFn)` invokes `Action` instead of `MainFn`

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

16 months agoTableGen: Make 2nd arg `MainFn` of `TableGenMain(argv0, MainFn)` optional.
NAKAMURA Takumi [Tue, 21 Mar 2023 03:58:57 +0000 (12:58 +0900)]
TableGen: Make 2nd arg `MainFn` of `TableGenMain(argv0, MainFn)` optional.

16 months agoReformat
NAKAMURA Takumi [Tue, 21 Mar 2023 04:09:34 +0000 (13:09 +0900)]
Reformat

16 months ago[clangd][NFC] Format & include cleanup for AddUsingTests.cpp
Kadir Cetinkaya [Tue, 21 Mar 2023 06:51:03 +0000 (07:51 +0100)]
[clangd][NFC] Format & include cleanup for AddUsingTests.cpp

16 months ago[InstCombine][NFC] Precommit test case of PR61137
luxufan [Fri, 3 Mar 2023 07:21:28 +0000 (15:21 +0800)]
[InstCombine][NFC] Precommit test case of PR61137

16 months agoRevert "Revert "[clangd] Fix AddUsing in the face of typo-correction""
Kadir Cetinkaya [Mon, 20 Mar 2023 18:06:09 +0000 (19:06 +0100)]
Revert "Revert "[clangd] Fix AddUsing in the face of typo-correction""

This reverts commit fb3f6a95393f33bc8d8550a5ac62c18e488a9b6f.

16 months ago[X86] Create extra prolog/epilog for stack realignment [part 2]
Luo, Yuanke [Tue, 21 Mar 2023 01:06:44 +0000 (09:06 +0800)]
[X86] Create extra prolog/epilog for stack realignment [part 2]

This patch is to support D145650 for elf target as well.

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

16 months ago[Attributor] Add convergent abstract attribute
Ishaan Gandhi [Tue, 21 Mar 2023 05:31:39 +0000 (22:31 -0700)]
[Attributor] Add convergent abstract attribute

This patch adds the AANonConvergent abstract attribute. It removes the
convergent attribute from functions that only call non-convergent
functions.

Reviewed By: jdoerfert

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

16 months ago[RISCV] Simplify RISCVISAInfo::compareExtension. NFCI
Craig Topper [Tue, 21 Mar 2023 04:58:42 +0000 (21:58 -0700)]
[RISCV] Simplify RISCVISAInfo::compareExtension. NFCI

Instead of having a separate single letter and multiletter ranking
use a unified rank that assigns multiletter a larger value than
single letter.

Once we've ranked the extensions, then we compare using these ranks.

Reviewed By: kito-cheng

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

16 months ago[Webassembly][NFC] Fix typo in comment
Congcong Cai [Tue, 21 Mar 2023 05:19:35 +0000 (13:19 +0800)]
[Webassembly][NFC] Fix typo in comment

16 months ago[MLIR][Affine] Fix addInductionVarOrTerminalSymbol
Uday Bondhugula [Tue, 21 Mar 2023 04:52:19 +0000 (10:22 +0530)]
[MLIR][Affine] Fix addInductionVarOrTerminalSymbol

Update affine analysis method `addInductionVarOrTerminalSymbol` for
affine.parallel IV.

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

Reviewed By: dcaballe

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

16 months ago[Webassembly][multivalue] update libcall signature when multivalue feature enabled
Congcong Cai [Tue, 21 Mar 2023 04:04:41 +0000 (12:04 +0800)]
[Webassembly][multivalue] update libcall signature when multivalue feature enabled

fixed: #59095
Update libcall signatures to use multivalue return rather than returning via a pointer
when the multivalue features is enabled in the WebAssembly backend.

Reviewed By: tlively

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

16 months ago[AVR] Fix incorrect expansion of the pseudo 'ELPMBRdZ' instruction
Ben Shi [Sun, 8 Jan 2023 12:35:23 +0000 (20:35 +0800)]
[AVR] Fix incorrect expansion of the pseudo 'ELPMBRdZ' instruction

The 'ELPM' instruction has three forms:

--------------------------
| form        | feature  |
| ----------- | -------- |
| ELPM        | hasELPM  |
| ELPM Rd, Z  | hasELPMX |
| ELPM Rd, Z+ | hasELPMX |
--------------------------

The second form is always used in the expansion of the pseudo
instruction 'ELPMBRdZ'. But for devices without ELPMX but only
with ELPM, only the first form can be emitted.

Reviewed By: jacquesguan

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

16 months ago[llvm-jitlink] Fix typo in description of llvm-jitlink's -alias option.
Lang Hames [Tue, 21 Mar 2023 01:55:00 +0000 (18:55 -0700)]
[llvm-jitlink] Fix typo in description of llvm-jitlink's -alias option.

16 months ago[llvm-readobj] Fix ambiguous call of printNumber in ELFDumper.cpp (NFC)
Jie Fu [Tue, 21 Mar 2023 02:33:48 +0000 (10:33 +0800)]
[llvm-readobj] Fix ambiguous call of printNumber in ELFDumper.cpp (NFC)

/Users/jiefu/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:7175:5: error: call to member function 'printNumber' is ambiguous
  W.printNumber("TotalBuckets", NBucket);
  ~~^~~~~~~~~~~
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:201:16: note: candidate function
  virtual void printNumber(StringRef Label, uint64_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:205:16: note: candidate function
  virtual void printNumber(StringRef Label, uint32_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:209:16: note: candidate function
  virtual void printNumber(StringRef Label, uint16_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:213:16: note: candidate function
  virtual void printNumber(StringRef Label, uint8_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:217:16: note: candidate function
  virtual void printNumber(StringRef Label, int64_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:221:16: note: candidate function
  virtual void printNumber(StringRef Label, int32_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:225:16: note: candidate function
  virtual void printNumber(StringRef Label, int16_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:229:16: note: candidate function
  virtual void printNumber(StringRef Label, int8_t Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:237:16: note: candidate function
  virtual void printNumber(StringRef Label, float Value) {
               ^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:241:16: note: candidate function
  virtual void printNumber(StringRef Label, double Value) {
               ^

16 months ago[docs] Update the status for coroutines
Chuanqi Xu [Thu, 16 Mar 2023 03:02:06 +0000 (11:02 +0800)]
[docs] Update the status for coroutines

According to the discussion in
https://discourse.llvm.org/t/rfc-could-we-mark-coroutines-as-unreleased-now/69220

We should mark coroutines as "it’s supported fully everywhere but on
Windows targets".

Reviewed By: aaron.ballman

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

16 months agoFix Windows export list.
Peter Collingbourne [Tue, 21 Mar 2023 02:20:33 +0000 (19:20 -0700)]
Fix Windows export list.

Should fix Windows buildbot:
https://lab.llvm.org/buildbot/#/builders/127/builds/45411

16 months ago[AIX] Consolidate Crt0Basename logic
Michael Francis [Mon, 20 Mar 2023 18:00:32 +0000 (18:00 +0000)]
[AIX] Consolidate Crt0Basename logic

when certain flags are specified, the Crt0 object files are not linked.
However, the logic for determining which files will always run. This
patch moves that logic so that the basename is only determined if it is
needed.

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

16 months ago[Attributor][FIX] Avoid H2S on GPUs if the pointer can be shared
Johannes Doerfert [Tue, 21 Mar 2023 00:13:18 +0000 (17:13 -0700)]
[Attributor][FIX] Avoid H2S on GPUs if the pointer can be shared

If the stack is not accessible by other threads, e.g., on a GPU, we need
to ensure heap-2-stack will not create a stack version of a pointer that
might be passed to another thread. Since passing through memory is by
default transparent, we need to register a callback and inspect stores
we might look through explicitly.

16 months ago[OpenMPOpt][FIX] Avoid removing barriers in callees
Johannes Doerfert [Mon, 20 Mar 2023 23:01:39 +0000 (16:01 -0700)]
[OpenMPOpt][FIX] Avoid removing barriers in callees

We could be smarter about this, e.g., if the callee has a single call
site, but for now we first avoid the miscompile.

16 months ago[OpenMP][FIX] Properly track and lookup Execution Domains
Johannes Doerfert [Tue, 7 Mar 2023 21:26:31 +0000 (13:26 -0800)]
[OpenMP][FIX] Properly track and lookup Execution Domains

This is a two part fix. First, we need two Execution Domains (ED) to
track the values of a function. One for incoming values and one for
outgoing values. This was conflated before. Second, at the function
entry we need to look at the incoming information from call sites not
iterate over non-existing predecessors.

16 months ago[Attributor][FIX] Ensure loop PHI replacements are dynamically unique
Johannes Doerfert [Mon, 20 Mar 2023 18:21:56 +0000 (11:21 -0700)]
[Attributor][FIX] Ensure loop PHI replacements are dynamically unique

Similar to loads, PHIs can be used to introduce non-dynamically unique
values into the simplification "algorithm". We need to check that PHIs
do not carry such a value from one iteration into the next as can cause
downstream reasoning to fail, e.g., downstream could think a comparison
is equal because the simplified values are equal while they are defined
in different loop iterations. Similarly, instructions in cycles are now
conservatively treated as non-dynamically unique. We could do better but
I'll leave that for the future.

The change in AAUnderlyingObjects allows us to ignore dynamically unique
when we simply look for underlying objects. The user of that AA should
be aware that the result might not be a dynamically unique value.

16 months ago[Attributor][NFC] Precommit test exposing a bug
Johannes Doerfert [Mon, 20 Mar 2023 19:42:56 +0000 (12:42 -0700)]
[Attributor][NFC] Precommit test exposing a bug

16 months ago[Attributor][NFC] Reduce output verbosity
Johannes Doerfert [Tue, 7 Mar 2023 21:31:44 +0000 (13:31 -0800)]
[Attributor][NFC] Reduce output verbosity

16 months ago[libc] temporarily disable wctob entrypoint
Michael Jones [Tue, 21 Mar 2023 00:41:07 +0000 (17:41 -0700)]
[libc] temporarily disable wctob entrypoint

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

16 months ago[libc][obvious] fix missing stdio dependency
Michael Jones [Tue, 21 Mar 2023 00:35:14 +0000 (17:35 -0700)]
[libc][obvious] fix missing stdio dependency

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

16 months ago[llvm-readobj] Provide Hash Histogram for all ELFDumper implementations
Paul Kirth [Sat, 18 Mar 2023 03:33:26 +0000 (03:33 +0000)]
[llvm-readobj] Provide Hash Histogram for all ELFDumper implementations

Previously, the GNUELFDumper was the only implementer for Hash Histograms.
This patch moves the implementation for printHashHistogram and
printGnuHashHistogram into the ELFDumper base class, and allows each
derived class to specialize how it outputs that information.

This change also prevents the JSONELFDumper from emitting invalid JSON,
since the shared implementation in LLVMELFDumper no longer emits a
warning message to the output stream.

Reviewed By: jhenderson

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

16 months ago[support] Support printing floats in ScopedPrinter
Paul Kirth [Sat, 18 Mar 2023 02:39:12 +0000 (02:39 +0000)]
[support] Support printing floats in ScopedPrinter

llvm-readobj will need the ability to print floats for use in
HashHistograms. This adds that functionality to the ScopedPrinter and
JSONScopedPrinter.

Reviewed By: jhenderson

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

16 months ago[libc][obvious] remove currently unused types
Michael Jones [Tue, 21 Mar 2023 00:20:01 +0000 (17:20 -0700)]
[libc][obvious] remove currently unused types

Somehow having MBState and StructTmType in the definition for wchar was
causing test failures. This should fix those.

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

16 months ago[gn build] Port e4c1dfed3837
LLVM GN Syncbot [Tue, 21 Mar 2023 00:14:05 +0000 (00:14 +0000)]
[gn build] Port e4c1dfed3837

16 months ago[X86] Create extra prolog/epilog for stack realignment
Luo, Yuanke [Thu, 9 Mar 2023 05:32:31 +0000 (13:32 +0800)]
[X86] Create extra prolog/epilog for stack realignment

The base pointer register is reserved by compiler when there is
dynamic size alloca and stack realign in a function. However the
base pointer register is not defined in X86 ABI, so user can use
this register in inline assembly. The inline assembly would
clobber base pointer register without being awared by user. This
patch is to create extra prolog to save the stack pointer to a
scratch register and use this register to reference argument from
stack. For some calling convention (e.g. regcall), there may be
few scratch register.
Below is the example code for such case.

```
extern int bar(void *p);
long long foo(size_t size, char c, int id) {
  __attribute__((__aligned__(64))) int a;
  char *p = (char *)alloca(size);
  asm volatile ("nop"::"S"(405):);
  asm volatile ("movl %0, %1"::"r"(id), "m"(a):);
  p[2] = 8;
  memset(p, c, size);
  return bar(p);
}
```
And below prolog/epilog will be emit for this case.
```
leal    4(%esp), %ebx
.cfi_def_cfa %ebx, 0
andl    $-128, %esp
pushl   -4(%ebx)
...
leal    4(%ebx), %esp
.cfi_def_cfa %esp, 4
```

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

16 months ago[-Wunsafe-buffer-usage] Add Fixable for dereference of simple ptr arithmetic
ziqingluo-90 [Mon, 20 Mar 2023 23:57:50 +0000 (16:57 -0700)]
[-Wunsafe-buffer-usage] Add Fixable for dereference of simple ptr arithmetic

For each expression `e` of the form `*(DRE + n)` (or `*(n + DRE)`), where
`DRE` has a pointer type and `n` is an integer literal, `e` will be
transformed to `DRE[n]` (or `n[DRE]` respectively), if
- `e` is at the left-hand side of an assignment or is an lvalue being casted to an rvalue; and
- the variable referred by `DRE` is going to be transformed to be of `std::span` type.

Reviewed by: jkorous, NoQ

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

16 months ago[gn build] Port ee232506b870
LLVM GN Syncbot [Mon, 20 Mar 2023 23:57:12 +0000 (23:57 +0000)]
[gn build] Port ee232506b870

16 months ago[mlir][sparse] Fixing -Wunused-variable in Sparsification.cpp
wren romano [Mon, 20 Mar 2023 23:41:39 +0000 (16:41 -0700)]
[mlir][sparse] Fixing -Wunused-variable in Sparsification.cpp

Reviewed By: aartbik, Peiming

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

16 months agoFollow on to 2c7abc83f605b2d3b1062f28422eeff81278ecd5.
Jim Ingham [Mon, 20 Mar 2023 23:47:07 +0000 (16:47 -0700)]
Follow on to 2c7abc83f605b2d3b1062f28422eeff81278ecd5.

I didn't refactor the test that's failing on arm64 correctly so it
failed everywhere.

Looks like the step test passes on other aarch64 systems as well as
Darwin.  Turn off the xfail and see how far that gets.

16 months ago[libc][obvious] fix missing type headers
Michael Jones [Mon, 20 Mar 2023 23:41:08 +0000 (16:41 -0700)]
[libc][obvious] fix missing type headers

forgot to add wint_t and wchar_t type headers to the wchar
headergen definition.

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

16 months agoDisable __sancov_lowest_stack on Windows.
Peter Collingbourne [Mon, 20 Mar 2023 23:38:54 +0000 (16:38 -0700)]
Disable __sancov_lowest_stack on Windows.

Should fix Windows buildbot:
https://lab.llvm.org/buildbot/#/builders/127/builds/45401

16 months agoRevert "[IRSim] Check largest sections first when analyzing similarity"
Andrew Litteken [Mon, 20 Mar 2023 23:38:39 +0000 (18:38 -0500)]
Revert "[IRSim] Check largest sections first when analyzing similarity"

This reverts commit 805ec19d7d9915989be8a8a626176b5e29e19eee.

Did not update llvm-sim tests

16 months ago[libc] add basic wide char functions
Michael Jones [Mon, 13 Mar 2023 22:30:36 +0000 (15:30 -0700)]
[libc] add basic wide char functions

This patch adds the wchar header, as well as the functions to convert to
and from wide chars. The header also sets up the definitions for wint
and wchar.

Reviewed By: lntue

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

16 months agoExpose `__tsan_on_thread_idle` as part of tsan shared interface
Dave MacLachlan [Mon, 20 Mar 2023 23:30:18 +0000 (16:30 -0700)]
Expose `__tsan_on_thread_idle` as part of tsan shared interface

`__tsan_on_thread_idle` is part of the tsan interface that was not being
exported in shared libraries. Fixes it so that we can link to dynamic
versions of tsan and still call `__tsan_on_thread_idle`.

Reviewed By: vitalybuka

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

16 months ago[IRSim] Check largest sections first when analyzing similarity
Andrew Litteken [Sun, 2 Oct 2022 17:34:14 +0000 (12:34 -0500)]
[IRSim] Check largest sections first when analyzing similarity

When we check for similarity, right now there is no order to how it is checked, except for via the suffix tree ordering.

We can reduce how much structural analysis we perform by checking the the regions in decreasing size. In doing so, we know that if two large sections match, each of their contained regions also match. This allows us to skip the structural checking for each smaller section. IT does require that we use the large regions as a "bridge" to create the canonical mapping between the two regions.

This reduces compile time significantly for some benchmarks. It will not perform as well for programs with many small items.

Reviewer: paquette
Differential Revision: https://reviews.llvm.org/D139338

16 months agosanitizer_common: Use plain thread_local for __sancov_lowest_stack definition.
Peter Collingbourne [Sat, 18 Mar 2023 03:48:21 +0000 (20:48 -0700)]
sanitizer_common: Use plain thread_local for __sancov_lowest_stack definition.

We can't use initial-exec for the definition of __sancov_lowest_stack
because it gets linked into shared libraries such as the UBSan and
HWASan runtimes on Android. I think we can expect plain thread_local
to work unconditionally in sanitizer_common as several other sanitizers
are already using it, so drop the platform-dependent macro and just use
thread_local in the definition.

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

16 months ago[NFC][tsan] Clang-format includes
Vitaly Buka [Mon, 20 Mar 2023 23:20:03 +0000 (16:20 -0700)]
[NFC][tsan] Clang-format includes

16 months ago[mlir][sparse] Making `TensorExp::Kind` a nested enum-class
wren romano [Mon, 20 Mar 2023 23:11:17 +0000 (16:11 -0700)]
[mlir][sparse] Making `TensorExp::Kind` a nested enum-class

This improves namespacing, and follows the pattern used for "Kind" enums elsewhere in MLIR.

Reviewed By: aartbik

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

16 months agoReapply 8d024a79ea783ed3fbb5691aeaf186ad3f0a4ae9 w/o the extra bits.
Jim Ingham [Mon, 20 Mar 2023 23:11:00 +0000 (16:11 -0700)]
Reapply 8d024a79ea783ed3fbb5691aeaf186ad3f0a4ae9 w/o the extra bits.

16 months agoRevert "Fix a problem with "watchpoint triggers before" watchpoint handling."
Jim Ingham [Mon, 20 Mar 2023 23:05:01 +0000 (16:05 -0700)]
Revert "Fix a problem with "watchpoint triggers before" watchpoint handling."

This reverts commit 8d024a79ea783ed3fbb5691aeaf186ad3f0a4ae9.

I accidentally included some "in progress" work that wasn't supposed to
go with this commit.

16 months ago[NFC] Include tsan_interface.h in tests
Vitaly Buka [Mon, 20 Mar 2023 22:56:38 +0000 (15:56 -0700)]
[NFC] Include tsan_interface.h in tests

16 months ago[NFC][tsan] Add include guards
Vitaly Buka [Mon, 20 Mar 2023 22:48:55 +0000 (15:48 -0700)]
[NFC][tsan] Add include guards

16 months ago[lldb] Move UnixSignals creation into Platform plugins
Alex Langford [Thu, 16 Mar 2023 21:47:17 +0000 (14:47 -0700)]
[lldb] Move UnixSignals creation into Platform plugins

The high level goal of this change is to remove lldbTarget's dependency
on lldbPluginProcessUtility. The reason for this existing dependency is
so that we can create the appropriate UnixSignals object based on an
ArchSpec. Instead of using the ArchSpec, we can instead take advantage
of the Platform associated with the current Target.

This is accomplished by adding a new method to Platform,
CreateUnixSignals, which will create the correct UnixSignals object for
us. We then can use `Platform::GetUnixSignals` and rely on that to give
us the correct signals as needed.

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

16 months agomodify dir of dep in OpenMPCommon
yijia1212 [Mon, 20 Mar 2023 22:33:54 +0000 (23:33 +0100)]
modify dir of dep in OpenMPCommon

Fix dir error of deps in OpenMPCommon bazel build

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

16 months agoRe-apply "[JITLink][ELF] Don't skip debug info sections by default."
Lang Hames [Mon, 20 Mar 2023 18:53:31 +0000 (18:53 +0000)]
Re-apply "[JITLink][ELF] Don't skip debug info sections by default."

This reapplies 57aeb305460406f7b822cfe6ab9fb4d730fc3b38, which was reverted in
f721fcb6ed0a186b8f146282467dd8420a5a36d0 due to buildbot failures.

The cause of the failure was missing support for R_AARCH64_ABS32, which was
added in fb1b9945be7657a3a25b727eaf0eeb3f74525210.

16 months ago[mlir][sparse] extend loop emitter and optimize lattices with the awareness of slice...
Peiming Liu [Fri, 20 Jan 2023 22:51:26 +0000 (22:51 +0000)]
[mlir][sparse] extend loop emitter and optimize lattices with the awareness of slice based iteration

Reviewed By: aartbik

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

16 months agoFix a problem with "watchpoint triggers before" watchpoint handling.
Jim Ingham [Mon, 20 Mar 2023 22:12:38 +0000 (15:12 -0700)]
Fix a problem with "watchpoint triggers before" watchpoint handling.

We need to step the watchpoint instruction in these cases, but the
when we queued the ThreadPlanStepOverWatchpoint to do this, we didn't
make it a Controlling plan.  So if you are stepping, this plan returns as
though it were a utility plan, and the stepping plan keeps going.

This only partially fixes the problem on Darwin; there's another bug
with reporting a watchpoint when we're instruction single stepping over
an instruction that triggers a watchpoint.  The kernel reports the
"single step completed" but not the watchpoint hit.  So this commit
also refactors the test into a part that works (at least on Darwin) and
a part that still fails.

We may have to adjust the test result expectations for other systems after
this fix.

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

16 months ago[SPIR-V] Add Machine Value Type for SPIR-V builtins
Michal Paszkowski [Mon, 20 Mar 2023 22:08:23 +0000 (23:08 +0100)]
[SPIR-V] Add Machine Value Type for SPIR-V builtins

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

16 months ago[libunwind][Modules] Add unwind_arm_ehabi.h and unwind_itanium.h to the unwind module)
Ian Anderson [Tue, 31 Jan 2023 08:56:27 +0000 (00:56 -0800)]
[libunwind][Modules] Add unwind_arm_ehabi.h and unwind_itanium.h to the unwind module)

Add unwind_arm_ehabi.h and unwind_itanium.h to the unwind module and use angle includes to include them.

Reviewed By: ldionne, #libunwind

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

16 months ago[libc][bazel] add targets for sprintf
Michael Jones [Tue, 14 Mar 2023 22:08:56 +0000 (15:08 -0700)]
[libc][bazel] add targets for sprintf

The bazel build is currently overlay mode only, so the FILE functions
are still out of reach for it, but sprintf only uses strings. This adds
targets for sprintf, snprintf, and all the interal printf pieces, as
well as tests.

Reviewed By: sivachandra, lntue

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

16 months ago[libc][obvious] fix missing memory_check_utils
Michael Jones [Mon, 20 Mar 2023 22:04:48 +0000 (15:04 -0700)]
[libc][obvious] fix missing memory_check_utils

memmove and bcopy tests were missing a dependancy on memory_check_utils
in the bazel build, causing build failures.

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

16 months agoAdd declaration for `__tsan_default_options` to tsan_interface.h
Dave MacLachlan [Mon, 20 Mar 2023 21:36:07 +0000 (14:36 -0700)]
Add declaration for `__tsan_default_options` to tsan_interface.h

`__tsan_default_options` is part of the tsan interface so should be
exposed in tsan_interface.h.

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

16 months ago[PowerPC][NFC] Test needs to include constant pool values
Nemanja Ivanovic [Mon, 20 Mar 2023 21:43:30 +0000 (16:43 -0500)]
[PowerPC][NFC] Test needs to include constant pool values

16 months ago[mlir][sparse] add merger/topo sort support for slice-based affine sparse index codegen
Peiming Liu [Thu, 19 Jan 2023 21:39:11 +0000 (21:39 +0000)]
[mlir][sparse] add merger/topo sort support for slice-based affine sparse index codegen

Reviewed By: aartbik

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

16 months ago[mlir][Tensor] Make `TilingInterface` implementation only return handle to the create...
Mahesh Ravishankar [Mon, 20 Mar 2023 21:04:55 +0000 (21:04 +0000)]
[mlir][Tensor] Make `TilingInterface` implementation only return handle to the created `pad` operation.

Pad tiling implementation only needs to return the tiled pad
operation. The rest of the generated code is related to handling
boundary conditions.

Reviewed By: hanchung

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

16 months ago[mlir][Tensor] Fix build error due to missing `<>` in D146440.
Mahesh Ravishankar [Mon, 20 Mar 2023 21:20:54 +0000 (21:20 +0000)]
[mlir][Tensor] Fix build error due to missing `<>` in D146440.

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

16 months agoReplace strlen with StringRef::size
Ilyas Mustafazade [Mon, 20 Mar 2023 21:00:46 +0000 (14:00 -0700)]
Replace strlen with StringRef::size

Replace multiple strlen calls with a StringRef constructor and a
StringRef::size call.

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

16 months ago[NFC] Rename ArgSize to SpellingSize, and add ArgStringSize.
Ilyas Mustafazade [Mon, 20 Mar 2023 20:58:26 +0000 (13:58 -0700)]
[NFC] Rename ArgSize to SpellingSize, and add ArgStringSize.

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

16 months ago[mlir][openMP] Add bazel deps
Anlun Xu [Mon, 20 Mar 2023 20:58:45 +0000 (13:58 -0700)]
[mlir][openMP] Add bazel deps

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

16 months ago[mlir][Tensor] Avoid dropping attributes for `tensor.pad` operations during canonical...
Mahesh Ravishankar [Mon, 20 Mar 2023 20:56:41 +0000 (20:56 +0000)]
[mlir][Tensor] Avoid dropping attributes for `tensor.pad` operations during canonicalization.

Reviewed By: hanchung

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

16 months ago[JITLink][ELF][AArch64] Add support for ELF R_AARCH64_ABS32 relocation.
Lang Hames [Mon, 20 Mar 2023 20:50:27 +0000 (20:50 +0000)]
[JITLink][ELF][AArch64] Add support for ELF R_AARCH64_ABS32 relocation.

This relocation is commonly used in debug sections. Failure to handle it caused
the test failure in https://lab.llvm.org/buildbot/#/builders/197/builds/4272,
which forced the reversion, in f721fcb6ed0, of 57aeb305460 ("[JITLink][ELF]
Don't skip debug info sections by default"). This fix should allow us to
re-land 57aeb305460.

16 months agoChanges to `SCFFuseProducerOfSliceResult` to also return the operations created durin...
Mahesh Ravishankar [Mon, 20 Mar 2023 18:58:39 +0000 (18:58 +0000)]
Changes to `SCFFuseProducerOfSliceResult` to also return the operations created during fusion.

This is follow up to https://reviews.llvm.org/D145133 that allows
propogating information about ops that are fused back to the caller.

Reviewed By: hanchung

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

16 months ago[LSR] Fix wrapping bug in lsr-term-fold logic
Philip Reames [Mon, 20 Mar 2023 20:41:49 +0000 (13:41 -0700)]
[LSR] Fix wrapping bug in lsr-term-fold logic

The existing logic was unsound, in two ways.

First, due to wrapping on the trip count computation, it could compute a value which convert a loop which exiting on iteration 256, to one which exited at 255. (With i8 trip counts.)

Second, it allowed rewriting when the trip count implies wrapping around the alternate IV. As a trivial example, it allowed rewriting an i128 exit test in terms of an i64 IV. This is obviously wrong.

Note that the test change is fairly minimal - i.e. only the targeted test - but that's only because I precommitted a change which switched the test from 32 to 64 bit pointers. For 32 bit point architectures with 32 bit primary inductions, this transform is almost always unsound to perform.

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

16 months ago[SampleProfile] Use LazyCallGraph instead of CallGraph
Arthur Eubanks [Mon, 20 Mar 2023 20:42:56 +0000 (13:42 -0700)]
[SampleProfile] Use LazyCallGraph instead of CallGraph

The function order in some tests had to be changed because they relied on ordering of functions returned in an SCC which is consistent but unspecified.

16 months ago[PowerPC][NFC] Pre-commit a test case for upcoming patch
Nemanja Ivanovic [Mon, 20 Mar 2023 20:41:27 +0000 (15:41 -0500)]
[PowerPC][NFC] Pre-commit a test case for upcoming patch

16 months agoAdd scalar support for amdgpu.raw_buffer_{load,store}
giuseros [Mon, 20 Mar 2023 20:02:03 +0000 (20:02 +0000)]
Add scalar support for amdgpu.raw_buffer_{load,store}

Introduce the possibility to load/store scalars via amdgpu.raw_buffer_{load,store}

Reviewed By: krzysz00

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

16 months ago[Flang] Exit gracefully with a useful message when we fail to lookup a target
Nadeem, Usman [Mon, 20 Mar 2023 19:05:18 +0000 (12:05 -0700)]
[Flang] Exit gracefully with a useful message when we fail to lookup a target

Without this patch we were asserting with a generic message `Failed to
create Target`, but we already have a detailed error message stored in
the variable `error` after calling `lookupTarget()` but this error was not
getting used/printed.

With this patch we will emit a message with more details instead of a
stack dump with a generic message.

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

Change-Id: I7ddee917cf921a2133ca3e6b35791b2142f770a2

16 months ago[SLP]Fix PR61554: use of missing vectorized value in buildvector nodes.
Alexey Bataev [Mon, 20 Mar 2023 17:21:12 +0000 (10:21 -0700)]
[SLP]Fix PR61554: use of missing vectorized value in buildvector nodes.

If the buildvector node matches the vector node, it reuse the vector
value from this vector node, but its VectorizedValue field is not
updated. Need to update this field to avoid misses during the analysis
of the reused gather/buildvector nodes.

16 months ago[llvm-readobj] Pretty-print IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY.
Eli Friedman [Mon, 20 Mar 2023 18:56:59 +0000 (11:56 -0700)]
[llvm-readobj] Pretty-print IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY.

16 months ago[clangd] Remove reundant use of getSpellingLoc()
Nathan Ridge [Sun, 19 Mar 2023 08:04:13 +0000 (04:04 -0400)]
[clangd] Remove reundant use of getSpellingLoc()

getFileLoc() is guaranteed to return a file loc, and getSpellingLoc()
on a file loc is a no-op.

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

16 months ago[MLIR][OpenMP] Added OMPIRBuilder support for Target Data directives
Akash Banerjee [Fri, 17 Mar 2023 12:40:29 +0000 (12:40 +0000)]
[MLIR][OpenMP] Added OMPIRBuilder support for Target Data directives

This patch adds OpenMP IRBuilder support for the Target Data directives to allow lowering to LLVM IR.

The mlir::Translation is responsible for generating supporting code for processing the map_operands through the processMapOperand function, and also generate code for the r>

The OMPIRBuilder is responsible for generating the begin and end mapper function calls.

Limitations:
        - use_device_ptr and use_device_addr clauses are NOT supported for Target Data operation.
        - nowait clauses are NOT supported for Target Enter and Exit Data operations.
        - Only LLVMPointerType is supported for map_operands.

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

16 months ago[ADT] Work around `enumerate` compilation error with modules enabled
Jakub Kuderski [Mon, 20 Mar 2023 18:27:50 +0000 (14:27 -0400)]
[ADT] Work around `enumerate` compilation error with modules enabled

This manifests on Apple clang 14 with `-DLLVM_ENABLE_MODULES=1` and
`-DLLVM_ENABLE_ASSERTIONS=1` and seems like a host compiler bug.

Sample compilation failure:
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/52513/consoleFull#-458239162a1ca8a51-895e-46c6-af87-ce24fa4cd561.

Reviewed By: aprantl

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

16 months ago[LSR] Inline getAlternateIVEnd and simplify [nfc]
Philip Reames [Mon, 20 Mar 2023 18:15:54 +0000 (11:15 -0700)]
[LSR] Inline getAlternateIVEnd and simplify [nfc]

Also, add a comment to highlight that the "good" result on this test is accidental, and not based on a principled decision.  I matched the original behavior to make this nfc, but selecting the last legal IV is not well motivated here.

16 months ago[NFC][Outliner] Delete default ctors for Candidate & OutlinedFunction.
Amara Emerson [Sun, 19 Mar 2023 06:17:28 +0000 (23:17 -0700)]
[NFC][Outliner] Delete default ctors for Candidate & OutlinedFunction.

I think it's good practice to avoid having default ctors unless they're really
valid/useful. For OutlinedFunction the default ctor was used to represent a
bail-out value for getOutliningCandidateInfo(), so I changed the API to return
an optional<getOutliningCandidateInfo> instead which seems a tad cleaner.

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

16 months ago[libc] Add environment variables to GPU libc test for AMDGPU
Joseph Huber [Fri, 17 Mar 2023 19:06:53 +0000 (14:06 -0500)]
[libc] Add environment variables to GPU libc test for AMDGPU

This patch performs the same operation to copy over the `argv` array to
the `envp` array. This allows the GPU tests to use environment
variables.

Reviewed By: sivachandra

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

16 months ago[clang][deps] Only cache files with specific extension
Jan Svoboda [Fri, 17 Mar 2023 20:19:12 +0000 (13:19 -0700)]
[clang][deps] Only cache files with specific extension

In the scanner's VFS, we cache all files by default and only avoid caching stat failures for certain files. This tanks the performance of scanning with pre-populated module cache. When there is a stale PCM file, it gets cached by the scanner at the start and the rebuilt version never makes it through the VFS again. The TU invocation that rebuilds the PCM only sees the copy in its InMemoryModuleCache, which is invisible to other invocations. This means the PCM gets rebuilt for every TU given to the scanner.

This patch fixes the situation by flipping the default, only caching files that are known to be important, and letting everything else fall through to the underlying VFS.

rdar://106376153

Reviewed By: Bigcheese

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

16 months ago[InstCombine] Add test for issue fixed by 50fe87a5c8597e.
Florian Hahn [Mon, 20 Mar 2023 17:59:36 +0000 (17:59 +0000)]
[InstCombine] Add test for issue fixed by 50fe87a5c8597e.

Extra test that was fixed by 50fe87a5c8597e to make sure it doesn't
regress again.

16 months ago[SLP][NFC]Add a test with missed buildvector node, matching the
Alexey Bataev [Mon, 20 Mar 2023 17:55:44 +0000 (10:55 -0700)]
[SLP][NFC]Add a test with missed buildvector node, matching the
vectorized node.

16 months agoRevert "[clangd] Fix AddUsing in the face of typo-correction"
Kadir Cetinkaya [Mon, 20 Mar 2023 17:57:40 +0000 (18:57 +0100)]
Revert "[clangd] Fix AddUsing in the face of typo-correction"

This reverts commit 6f23fee4ef98a695062aa128a177478ba7d742d4.
Breaks windows buildbots

16 months ago[AIX][Clang] Respect -r when invoking the linker
Michael Francis [Mon, 13 Mar 2023 06:53:54 +0000 (06:53 +0000)]
[AIX][Clang] Respect -r when invoking the linker

On AIX, libraries are still being linked when `-r` is passed to the driver. This patch corrects this error.

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

16 months ago[MLIR][Linalg] Generate unique LibraryCallName for LinalgOps.
Amy Wang [Mon, 20 Mar 2023 17:19:13 +0000 (13:19 -0400)]
[MLIR][Linalg] Generate unique LibraryCallName for LinalgOps.

When lowering LinalgToStandard for named UnaryFn/BinaryFn ops, ensure
the fun name appears in the generated library name. Further, for
linalg.copy to/from different address spaces, ensure the to/from
address spaces are appended onto the library name for uniqueness.
This fixes the lowering error with the linalg.copy testcase shown in
this patch.

Reviewed By: ftynse

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

16 months ago[PowerPC] Adding test coverage for vector compatibility warning
Maryam Moghadas [Thu, 23 Feb 2023 01:33:04 +0000 (19:33 -0600)]
[PowerPC] Adding test coverage for vector compatibility warning

This is to test D143210 patch to have the same vector
compatibility logic for error and warning diagnostics.

Reviewed By: lei

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

16 months ago[lldb] Introduce CMake variable LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS
Alex Langford [Fri, 17 Mar 2023 22:14:21 +0000 (15:14 -0700)]
[lldb] Introduce CMake variable LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS

The goal of this patch is to add the ability for the CMake configure to
fail when some optional test dependencies are not met. LLDB tries to be
flexible when test dependencies are not present but there are cases
where it would be useful to know that these dependencies are missing
before we run the test suite.

The intent here is to apply this setting on CI machines and make sure
that they have useful optional dependencies installed. We recently hit a
case where some CI machines were timing out while running the test suite
because a few tests were hanging. With this option, we'll be able to
know if the machine does not have psutil installed so we can install it
and avoid the timeout scenario altogether.

rdar://103194447

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