platform/upstream/llvm.git
19 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

19 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

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

19 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

19 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

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

19 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

19 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.

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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.

19 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.

19 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

19 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

19 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

19 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

19 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.

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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

19 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.

19 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

19 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

19 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.

19 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

19 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

19 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

19 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.

19 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.

19 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

19 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

19 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

19 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.

19 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

19 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

19 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

19 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.

19 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.

19 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

19 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

19 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

19 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

19 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

19 months ago[LSR] Rewrite IV match for term-fold using existing utilities
Philip Reames [Mon, 20 Mar 2023 16:54:56 +0000 (09:54 -0700)]
[LSR] Rewrite IV match for term-fold using existing utilities

Main benefit here is making the logic easier to follow, slightly more efficient, and more in line with LFTR.  This is not NFC.  There are three semantic changes here.

First, we drop handling for constants on the LHS of the comparison.  These are non-canonical, and we're very late in the optimization pipeline here, so there's no point in supporting this.  I removed a test which covered this case.

Second, we don't need the almost dead IV to be an addrec.  We just need SCEV to be able to compute a trip count for it.

Third, we require a simple IV for the almost dead IV.  In theory, this removes cases we could have previously handled, but given a) zero testing and b) multiple known correctness issues, I'm adopting an attidute of narrowing this down to something which works correctly, and *then* expanding.

19 months ago[Serialization] Place command line defines in the correct file
John Brawn [Tue, 21 Feb 2023 11:09:26 +0000 (11:09 +0000)]
[Serialization] Place command line defines in the correct file

Fix several problems related to serialization causing command line
defines to be reported as being built-in defines:
 * When serializing the <built-in> and <command line> files don't
   convert them into absolute paths.
 * When deserializing SM_SLOC_BUFFER_ENTRY we need to call
   setHasLineDirectives in the same way as we do for
   SM_SLOC_FILE_ENTRY.
 * When created suggested predefines based on the current command line
   options we need to add line markers in the same way that
   InitializePreprocessor does.
 * Adjust a place in clangd where it was implicitly relying on command
   line defines being treated as builtin.

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

19 months ago[clang][dataflow] Fix indentation in a test
Dmitri Gribenko [Mon, 20 Mar 2023 17:33:40 +0000 (18:33 +0100)]
[clang][dataflow] Fix indentation in a test

19 months ago[lldb] Sidestep -Wformat warning by using LLDB_LOG instead of LLDB_LOGF
Jonas Devlieghere [Mon, 20 Mar 2023 17:30:42 +0000 (10:30 -0700)]
[lldb] Sidestep -Wformat warning by using LLDB_LOG instead of LLDB_LOGF

Fixes warning: format specifies type 'unsigned long' but the argument
has type 'DataType' (aka 'unsigned long long') [-Wformat]

19 months ago[libc] Make string tests compatible with the Fuchsia build
Roland McGrath [Sat, 18 Mar 2023 00:57:15 +0000 (17:57 -0700)]
[libc] Make string tests compatible with the Fuchsia build

Some test code was doing loose conversions caught by compiler
warnings in  the Fuchsia build.  This included duplicated code
in a few tests that was reconsolidated with the existing header
file copy of the same functions.

The MemoryMatcher abstraction presumes gtest-style matcher support,
which is not available in Fuchsia's zxtest library.  It's avoided
in favor of simpler memory-comparing assertions.

Reviewed By: abrachet

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

19 months ago[SimpleLoopUnswitch] Skip non-trivial unswitching of cold loop nests
Teresa Johnson [Sun, 19 Mar 2023 15:45:28 +0000 (08:45 -0700)]
[SimpleLoopUnswitch] Skip non-trivial unswitching of cold loop nests

This fixes a compile time issue due to guarding loop unswitching based
on whether the enclosing function is cold. That approach is very
inefficient in the case of large cold functions that contain numerous
loops, since the loop pass calls isFunctionColdInCallGraph once per
loop, and that function walks all BBs in the function (twice for Sample
PGO) looking for any non-cold blocks.

Originally, this code only checked if the current Loop's header was cold
(D129599). However, that apparently caused a slowdown on a SPEC
benchmark, and the example given was that of a cold inner loop nested in
a non-cold outer loop (see comments in D129599). The fix was to check if
the whole function is cold, done in D133275.

This is overkill, and we can simply check if the header of any loop in
the current loop's loop nest is non-cold (looking at both outer and
inner loops). This patch drops the compile time for a large module by
40% with this approach.

I also updated PGO-nontrivial-unswitch2.ll since it only had one cold
loop in a non-cold function, so that it instead had IR based off the
example given in the comments relating to the SPEC degradation in
D129599. I confirmed that the new version of the test fails with the
original check done in D129599 of only the current loop's header
coldness.

Similarly updated test PGO-nontrivial-unswitch.ll to contain a cold loop
in a cold loop nest, and created PGO-nontrivial-unswitch3.ll to contain
a non-cold loop in a non-cold loop nest.

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

19 months ago[RISCV] Make Zfh PseudoQuietFCMP definitions predicated on HasStdExtZfh
Alex Bradbury [Mon, 20 Mar 2023 17:05:48 +0000 (17:05 +0000)]
[RISCV] Make Zfh PseudoQuietFCMP definitions predicated on HasStdExtZfh

These are currently in a `Predicates = [HasStdExtZfhOrZfhmin]` block,
but Zfhmin has no fcmp instructions so the definition makes no sense for
Zfhmin.

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

19 months ago[Libomptarget] Add missing explicit moves on llvm::Error
Joseph Huber [Mon, 20 Mar 2023 17:00:01 +0000 (12:00 -0500)]
[Libomptarget] Add missing explicit moves on llvm::Error

Summary:
Some older compilers, which we still support, have problems handling the
copy elision that allows us to directly move an `Error` to an
`Expected`. This patch adds explicit moves to remove the error. Same as
last patch but I forgot this one.

19 months ago[Libomptarget] Add missing explicit moves on llvm::Error
Joseph Huber [Mon, 20 Mar 2023 16:49:10 +0000 (11:49 -0500)]
[Libomptarget] Add missing explicit moves on llvm::Error

Summary:
Some older compilers, which we still support, have problems handling the
copy elision that allows us to directly move an `Error` to an
`Expected`. This patch adds explicit moves to remove the error.

19 months ago[LSR] Regen tests to adjust for naming in SCEVExpander [nfc]
Philip Reames [Mon, 20 Mar 2023 16:34:57 +0000 (09:34 -0700)]
[LSR] Regen tests to adjust for naming in SCEVExpander [nfc]

19 months ago[AArch64] Regenerate neon-vcmla.ll tests and add tests for combining fadd with vcmla...
David Green [Mon, 20 Mar 2023 16:29:28 +0000 (16:29 +0000)]
[AArch64] Regenerate neon-vcmla.ll tests and add tests for combining fadd with vcmla. NFC

See D146407.

19 months ago[Internalize] Don't claim to preserve CallGraph
Arthur Eubanks [Mon, 20 Mar 2023 16:25:47 +0000 (09:25 -0700)]
[Internalize] Don't claim to preserve CallGraph

Follow up to c41c336ee065a

19 months ago[Internalize] Remove interaction with CallGraph
Arthur Eubanks [Mon, 20 Mar 2023 16:24:11 +0000 (09:24 -0700)]
[Internalize] Remove interaction with CallGraph

Internalize was trying to update CallGraph if the analysis was available, but the new PM doesn't really use it so there's little reason to update it.

19 months ago[mlir][nfc] Fix syntax to conform with the C++20 restrictions on error-prone redundancy
Eric Schweitz [Mon, 20 Mar 2023 15:10:26 +0000 (08:10 -0700)]
[mlir][nfc] Fix syntax to conform with the C++20 restrictions on error-prone redundancy

See: http://eel.is/c++draft/diff.cpp17.class#2

Reviewed By: springerm

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

19 months ago[LSR/LFTR] Move two utilities to common code for reuse [nfc]
Philip Reames [Mon, 20 Mar 2023 15:44:15 +0000 (08:44 -0700)]
[LSR/LFTR] Move two utilities to common code for reuse [nfc]

We're working on a transform in LSR which is essentiall an inverse of LFTR (in certain sub-cases).  Move utilties so that they can be reused.

19 months ago[clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments
NagaChaitanya Vellanki [Mon, 20 Mar 2023 15:42:04 +0000 (15:42 +0000)]
[clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments

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

Reviewed By: dang

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

19 months agoReland "[LSAN][HWASAN] Turn on leak sanitizer in HWASAN for Linux"
Kirill Stoimenov [Mon, 20 Mar 2023 15:41:05 +0000 (15:41 +0000)]
Reland "[LSAN][HWASAN] Turn on leak sanitizer in HWASAN for Linux"

This reverts commit 35c05f04e547100d03b6359d1f66950ff83350e0.

19 months agoRevert "[clang][ASTImport] Add support for import of empty records"
Pavel Kosov [Mon, 20 Mar 2023 15:20:41 +0000 (18:20 +0300)]
Revert "[clang][ASTImport] Add support for import of empty records"

This reverts commit 21cd04c46fe0a2bee224899f56518a09bce5306e.

19 months ago[x86][MemFold] Fix anon namespace in header
Felipe de Azevedo Piovezan [Mon, 20 Mar 2023 12:51:04 +0000 (08:51 -0400)]
[x86][MemFold] Fix anon namespace in header

D142084 moved an enumeration inside a header from the llvm namespace
into an anon namespace. Some of the bots started failing as a result.

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

19 months ago[mlir] Support bufferization of arith.constant to memref.global with memory space
Maya Amrami [Sun, 19 Mar 2023 14:28:23 +0000 (16:28 +0200)]
[mlir] Support bufferization of arith.constant to memref.global with memory space

Reviewed By: springerm

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

19 months ago[Flang] [PowerPC] Implement remaining PPC math operation intrinsics that do not requi...
Paul Scoropan [Wed, 15 Mar 2023 14:43:06 +0000 (14:43 +0000)]
[Flang] [PowerPC] Implement remaining PPC math operation intrinsics that do not require semantic error checks

This review implements the following PowerPC math operations that we care about:
- fnabs
- fre
- fres
- frsqrte
- frsqrtes

None of these intrinsics require additional error checks in semantics. The interfaces handle checking types and kinds

Reviewed By: kkwli0

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

19 months ago[IRSim] Ensure that assignment accurately reduces potential mapping between different...
Andrew Litteken [Tue, 13 Dec 2022 05:51:11 +0000 (23:51 -0600)]
[IRSim] Ensure that assignment accurately reduces potential mapping between different candidates

Previous:
When we do not make decisions about commutative operands, we can end up in a situation where two values have two potential canonical numbers between two regions. This ensures that an ordering is decided after the initial structure between two regions is determined.

Current:
Previously the outliner only checked that assignment to a value matched what was already known, this patch makes sure that it matches what has already been found, and creates a mapping between the two values where it is a one-to-one mapping.

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

19 months ago[clang][ASTImport] Add support for import of empty records
Pavel Kosov [Mon, 20 Mar 2023 14:24:12 +0000 (17:24 +0300)]
[clang][ASTImport] Add support for import of empty records

Patch represents the clang part of changes in D143347

Reviewed By: balazske

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

19 months ago[libc][NFC] Add some missing comments to the RPC implementation
Joseph Huber [Mon, 20 Mar 2023 14:29:43 +0000 (09:29 -0500)]
[libc][NFC] Add some missing comments to the RPC implementation

Summary:
These comments were accidentally dropped from the committed version. Add
them back in.

19 months ago[mlir][Bazel] Adjust BUILD file for 930744fcdad7b326dd0337622b6e8dc99efcfa60
Adrian Kuegel [Mon, 20 Mar 2023 14:10:12 +0000 (15:10 +0100)]
[mlir][Bazel] Adjust BUILD file for 930744fcdad7b326dd0337622b6e8dc99efcfa60

19 months agoRevert "[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unneces...
Nicolas Vasilache [Mon, 20 Mar 2023 14:06:57 +0000 (07:06 -0700)]
Revert "[mlir][Linalg][Transform] Avoid FunctionalStyleTransformOpTrait where unnecesseary to improve usability"

This reverts commit 31aa8ea252c0b6acdcb362c1d0f01cc4b810d6d0.

This is currently not in a good state as we have some footguns due to missing listeners.

19 months ago[clangd] Fix AddUsing in the face of typo-correction
Kadir Cetinkaya [Mon, 20 Mar 2023 11:12:10 +0000 (12:12 +0100)]
[clangd] Fix AddUsing in the face of typo-correction

Fixes https://github.com/clangd/clangd/issues/559

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

19 months agoFix MLIR build with shared library enabled
Mehdi Amini [Mon, 20 Mar 2023 13:03:32 +0000 (14:03 +0100)]
Fix MLIR build with shared library enabled

Broken by f406adf134c2f

19 months ago[libcxxabi] Fix for c9d36bd80760db14f14b33789e6cbc6cb8c64830
Dmitry Chernenkov [Mon, 20 Mar 2023 12:59:05 +0000 (12:59 +0000)]
[libcxxabi] Fix for c9d36bd80760db14f14b33789e6cbc6cb8c64830

Otherwise fails with LIBCPP_REMOVE_TRANSITIVE_INCLUDES

19 months agoAdd capture of "IRUnits" as context for an MLIR Action
Mehdi Amini [Mon, 20 Mar 2023 12:40:37 +0000 (13:40 +0100)]
Add capture of "IRUnits" as context for an MLIR Action

IRUnit is defined as:

  using IRUnit = PointerUnion<Operation *, Region *, Block *, Value>;

The tracing::Action is extended to take an ArrayRef<IRUnit> as context to
describe an Action. It is demonstrated in the "ActionLogging" observer.

Reviewed By: rriddle, Mogball

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

19 months agoAdd a `skipRegion()` feature to the OpPrintingFlags for MLIR ASM printer
Mehdi Amini [Mon, 13 Mar 2023 13:33:31 +0000 (14:33 +0100)]
Add a `skipRegion()` feature to the OpPrintingFlags for MLIR ASM printer

This is a convenient flag for context where we intend to summarize a top-level
operation without the full-blown regions it may hold.

Reviewed By: rriddle

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

19 months agoAdd an Observer for logging actions application to a stream
Mehdi Amini [Mon, 20 Mar 2023 11:56:30 +0000 (12:56 +0100)]
Add an Observer for logging actions application to a stream

Integrate the `tracing::ExecutionContext()` into mlir-opt with a new
--log-action-to=<file> option to demonstrate the feature.

Reviewed By: rriddle

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

19 months ago[mlir][Transform] Fix support for mapping to GPU warps and to linear ids
Nicolas Vasilache [Mon, 20 Mar 2023 12:17:39 +0000 (05:17 -0700)]
[mlir][Transform] Fix support for mapping to GPU warps and to linear ids

c59465e1203dd78d06e15f7ddf62141807dbd5a7 introduced mapping to warps and
linear GPU ids.

In the implementation, the delinearization basis is reversed from [x, y, z]
to [z, y x] order to properly compute the strides and allow delinearization.

Prior to this commit, we forgot to reverse it back to [x, y, z] order
before materializing the indices.

Fix this oversight.

19 months ago[lldb] Implement CrashReason using UnixSignals
David Spickett [Tue, 14 Mar 2023 11:52:36 +0000 (11:52 +0000)]
[lldb] Implement CrashReason using UnixSignals

By adding signal codes to UnixSignals and adding a new function
where you can get a string with optional address and bounds.

Added signal codes to the Linux, FreeBSD and NetBSD signal sets.
I've checked the numbers against the relevant sources.

Each signal code has a code number, description and printing options.
By default you just get the descripton, you can opt into adding either
a fault address or bounds information.

Bounds signals we'll use the description, unless we have the bounds
values in which case we say whether it is an upper or lower bound
issue.

GetCrashReasonString remains in CrashReason because we need it to
be compiled only for platforms with siginfo_t. Ideally it would
move into NativeProcessProtocol, but that is also used
by NativeRegisterContextWindows, where there would be no siginfo_t.

Reviewed By: JDevlieghere

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

19 months ago[DAG] visitTRUNCATE - use FoldConstantArithmetic to perform constant folding.
Simon Pilgrim [Mon, 20 Mar 2023 11:06:47 +0000 (11:06 +0000)]
[DAG] visitTRUNCATE - use FoldConstantArithmetic to perform constant folding.

Avoid needing to perform extra isConstantIntBuildVectorOrConstantInt checks

19 months ago[DAG] foldBinOpIntoSelect - remove !CanFoldNonConst check. NFC.
Simon Pilgrim [Mon, 20 Mar 2023 10:20:44 +0000 (10:20 +0000)]
[DAG] foldBinOpIntoSelect - remove !CanFoldNonConst check. NFC.

These checks are in an if-else chain where CanFoldNonConst is already guaranteed to be false.

19 months ago[llvm][Demangle][NFC] Fix demangle to work with LIBCPP_REMOVE_TRANSITIVE_INCLUDES
Dmitry Chernenkov [Mon, 20 Mar 2023 11:05:55 +0000 (11:05 +0000)]
[llvm][Demangle][NFC] Fix demangle to work with LIBCPP_REMOVE_TRANSITIVE_INCLUDES

19 months ago[NFC] Regenerate test file InstCombine/bit-checks.ll
luxufan [Mon, 20 Mar 2023 11:03:18 +0000 (19:03 +0800)]
[NFC] Regenerate test file InstCombine/bit-checks.ll