platform/upstream/llvm.git
19 months ago[clang][dataflow] Fix crash when RHS of `&&` or `||` calls `noreturn` func.
Martin Braenne [Thu, 23 Mar 2023 07:45:40 +0000 (07:45 +0000)]
[clang][dataflow] Fix crash when RHS of `&&` or `||` calls `noreturn` func.

The crash happened because the transfer fucntion for `&&` and `||`
unconditionally tried to retrieve the value of the RHS. However, if the RHS
is unreachable, there is no environment for it, and trying to retrieve the
operand's value causes an assertion failure.

See also the comments in the code for further details.

Reviewed By: xazax.hun, ymandel, sgatev, gribozavr2

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

19 months ago[NFC] Fix typo lld::wasm in comment
Congcong Cai [Thu, 23 Mar 2023 07:40:55 +0000 (15:40 +0800)]
[NFC] Fix typo lld::wasm in comment

19 months ago[mlir][llvm] Switch rountrip tests to opaque pointers.
Tobias Gysi [Thu, 23 Mar 2023 07:13:54 +0000 (08:13 +0100)]
[mlir][llvm] Switch rountrip tests to opaque pointers.

The revision switches all remaining LLVM dialect roundtrip
tests to opaque pointers. Selected tests are copied to a
postfixed test file for the time being.

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

Reviewed By: zero9178

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

19 months ago[clang][Sema][NFC] Make local variable const
Timm Bäder [Thu, 23 Mar 2023 07:22:23 +0000 (08:22 +0100)]
[clang][Sema][NFC] Make local variable const

19 months ago[mlir][llvm] Add poison constant.
Théo Degioanni [Thu, 23 Mar 2023 06:58:37 +0000 (07:58 +0100)]
[mlir][llvm] Add poison constant.

This patch introduces the poison constant from LLVM in the LLVM IR dialect. It also adds import and export support for it, along with roundtrip tests.

Reviewed By: gysit

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

19 months ago[InstCombine] Precommit tests
Kazu Hirata [Thu, 23 Mar 2023 06:27:59 +0000 (23:27 -0700)]
[InstCombine] Precommit tests

This patch precommits tests for:

https://github.com/llvm/llvm-project/issues/61183

19 months ago[TableGen] Change push_back back to emplace_back.
Craig Topper [Thu, 23 Mar 2023 06:17:15 +0000 (23:17 -0700)]
[TableGen] Change push_back back to emplace_back.

This was a mistake I made in 021edda0b20468e20a72b1788721b2b70228bffb.

19 months ago[TableGen] Simplify CodeGenHwModes constructor. NFC
Craig Topper [Thu, 23 Mar 2023 06:00:06 +0000 (23:00 -0700)]
[TableGen] Simplify CodeGenHwModes constructor. NFC

Remove the loop that erases the DefaultMode from the Record vector.
Instead we can skip over in the loop that creates HwMode objects.

19 months ago[libfuzzer] add test of cov file-id in control file
Wu, Yingcong [Thu, 23 Mar 2023 04:49:19 +0000 (21:49 -0700)]
[libfuzzer] add test of cov file-id in control file

There is test for ft file-id in control file, but no test for cov line.
Without the test, a invalid cov file-id would cause crash.

Reviewed By: vitalybuka

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

19 months ago[Pseudo Probe] Use the name from debug info to compute GUID in probe desc
wlei [Wed, 22 Mar 2023 20:13:27 +0000 (13:13 -0700)]
[Pseudo Probe] Use the name from debug info to compute GUID in probe desc

This is to fix a GUID mismatch while decoding pseudo probe, a GUID from the inline tree is not in the GUID2FuncDescMap. It turned out that frontend could change the function name making it different from the one in debug info(https://reviews.llvm.org/D111009). Here change to use the function name from debug info to be consistent with the probe name from the inline stack.

Reviewed By: hoy, wenlei

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

19 months ago[llvm] Skip getAPIntValue (NFC)
Kazu Hirata [Thu, 23 Mar 2023 05:10:25 +0000 (22:10 -0700)]
[llvm] Skip getAPIntValue (NFC)

ConstantSDNode provides some convenience functions like isZero,
getZExtValue, and isMinSignedValue that are named identically to those
provided by APInt, so we can "skip" getAPIntValue.

19 months ago[ARM] Use isNullConstant (NFC)
Kazu Hirata [Thu, 23 Mar 2023 05:10:23 +0000 (22:10 -0700)]
[ARM] Use isNullConstant (NFC)

19 months ago[InstCombine] Precommit a test
Kazu Hirata [Thu, 23 Mar 2023 05:10:22 +0000 (22:10 -0700)]
[InstCombine] Precommit a test

This patch precommits a test for:

https://github.com/llvm/llvm-project/issues/61183

19 months ago[InstCombine] Precommit tests
Kazu Hirata [Thu, 23 Mar 2023 05:10:20 +0000 (22:10 -0700)]
[InstCombine] Precommit tests

This patch precommits tests for:

https://github.com/llvm/llvm-project/issues/60802

19 months ago[TLI] Fold ~X >/< ~Y --> Y >/< X
Jun Zhang [Thu, 23 Mar 2023 04:49:05 +0000 (12:49 +0800)]
[TLI] Fold ~X >/< ~Y --> Y >/< X

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

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D146512

19 months agoPrecommit test for #61120
Jun Zhang [Thu, 23 Mar 2023 04:48:59 +0000 (12:48 +0800)]
Precommit test for #61120

Signed-off-by: Jun Zhang <jun@junz.org>
19 months ago[-Wunsafe-buffer-usage] Add [[fallthrough]] after D143206
Fangrui Song [Thu, 23 Mar 2023 04:02:00 +0000 (21:02 -0700)]
[-Wunsafe-buffer-usage] Add [[fallthrough]] after D143206

19 months agoRecommit [Modules] Remove unnecessary check when generating name lookup table in...
Chuanqi Xu [Thu, 23 Mar 2023 03:21:35 +0000 (11:21 +0800)]
Recommit [Modules] Remove unnecessary check when generating name lookup table in ASTWriter

Close https://github.com/llvm/llvm-project/issues/61065.

We will avoid writing the names from external AST naturally. But
currently its check is often false positive since we may have already
marked the declarations as external but
DeclContext::hasNeedToReconcileExternalVisibleStorage would be false
after reconciling.

Tested with libcxx's modular build.

This patch can improve 8% compilation time in an internal workloads.

See the discussion in
https://reviews.llvm.org/rG1e0709167f5edd330889f51bb203c458bdb5e359
to see the information for recommitting.

19 months ago[mlir][tosa] TosaToLinalg: Lower TOSA.Cast via RoundEven according to TOSA spec 0...
Matthias Gehre [Thu, 23 Mar 2023 01:08:43 +0000 (01:08 +0000)]
[mlir][tosa] TosaToLinalg: Lower TOSA.Cast via RoundEven according to TOSA spec 0.60.0

TOSA now specifies rounding of ties to even in section 1.8.2., "Main Inference Profile"

Reviewed By: eric-k256, rsuderman

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

19 months ago[mlir][affine] Prevent vectorizer test from crash without any map
Kai Sasaki [Thu, 23 Mar 2023 00:59:29 +0000 (09:59 +0900)]
[mlir][affine] Prevent vectorizer test from crash without any map

If the vectorizer test pass does not get any affine map, it should output nothing instead of crash.

Issue: https://github.com/llvm/llvm-project/issues/61534

Reviewed By: nicolasvasilache, dcaballe

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

19 months ago[libc] Adjust NVPTX startup code
Joseph Huber [Thu, 23 Mar 2023 00:58:08 +0000 (19:58 -0500)]
[libc] Adjust NVPTX startup code

Summary:
The startup code needs to include the environment pointer so we add this
to the arguments. Also we need to ensure that the `crt1.o` file is made
with `-fgpu-rdc` set so we can actually use it without undefined
reference errors.

19 months ago[RISCV][NFC] Add more tests for SLP vectorization (binops on load/store)
Ben Shi [Tue, 14 Mar 2023 09:27:47 +0000 (17:27 +0800)]
[RISCV][NFC] Add more tests for SLP vectorization (binops on load/store)

Reviewed By: reames

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

19 months ago[mlir] Fix typo for unknown operation
Kai Sasaki [Thu, 23 Mar 2023 00:50:40 +0000 (09:50 +0900)]
[mlir] Fix typo for unknown operation

Reviewed By: rriddle

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

19 months agoAdd "REQUIRES: asserts" to test that uses --debug-only flag
Amy Huang [Wed, 22 Mar 2023 22:55:18 +0000 (15:55 -0700)]
Add "REQUIRES: asserts" to test that uses --debug-only flag

19 months ago[NVPTX] Port GenericToNVVM to the new PM.
Pavel Kopyl [Thu, 16 Mar 2023 20:53:14 +0000 (21:53 +0100)]
[NVPTX] Port GenericToNVVM to the new PM.

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

19 months ago[mlir][arith] Fix typos in WIE. NFC.
Jakub Kuderski [Wed, 22 Mar 2023 23:15:12 +0000 (19:15 -0400)]
[mlir][arith] Fix typos in WIE. NFC.

19 months ago[mlir][arith] Add `sitofp` support to WIE
Jakub Kuderski [Wed, 22 Mar 2023 23:09:48 +0000 (19:09 -0400)]
[mlir][arith] Add `sitofp` support to WIE

This depends on the handling of `uitofp` in D146606.

Reviewed By: antiagainst

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

19 months ago[mlir][arith] Add `uitofp` support to WIE
Jakub Kuderski [Wed, 22 Mar 2023 23:04:09 +0000 (19:04 -0400)]
[mlir][arith] Add `uitofp` support to WIE

This includes standard LIT tests and integration tests with the LLVM CPU
runner.

I plan to use this to implement `sitofp` in D146597.

Reviewed By: antiagainst

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

19 months ago[-Wunsafe-buffer-usage] Add Fixable for simple pointer dereference
MalavikaSamak [Wed, 22 Mar 2023 22:31:00 +0000 (15:31 -0700)]
[-Wunsafe-buffer-usage] Add Fixable for simple pointer dereference

This patch introduces PointerDereferenceGadget, a FixableGadget that emits
fixits to handle cases where a pointer that is identified as unsafe is
dereferenced. The current implementation only handles cases where the strategy
is to change the type of the raw pointer to std::span. The fixit for this
strategy is to fetch the first element from the corresponding span instance.

For example for the code below, the PointerDereferenceGadget emits a fixit for
S3 (S1, S2 are to be handled by other gadgets):

  S1: int *ptr = new int[10];
  S2: int val1 = ptr[k]; // Unsafe operation
  S3: int val2 = *ptr; => Fixit: int val2 = ptr[0];

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

19 months agolibclang: Pass Clang install directory to driver via argv[0].
Peter Collingbourne [Tue, 21 Mar 2023 01:38:04 +0000 (18:38 -0700)]
libclang: Pass Clang install directory to driver via argv[0].

Various driver features, such as the sysroot path detection for Android
targets, rely on being able to find the Clang install directory (look
for callers of `getDriver().getInstalledDir()`). However, the install
directory isn't currently being plumbed through to the driver, which is
conventionally done via the argv[0] passed to the Driver constructor.

It looks like D14695 attempted to fix this by adding another API that
allows specifying the argv[0]. However, rather than requiring every
user of libclang to switch to this API for correct behavior, let's have
the other existing APIs work by default, by using the existing logic in
libclang for finding the install directory.

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

19 months ago[MemProf] Context disambiguation cloning pass [patch 1b/3]
Teresa Johnson [Thu, 29 Dec 2022 20:11:38 +0000 (12:11 -0800)]
[MemProf] Context disambiguation cloning pass [patch 1b/3]

Adds support for building the graph in ThinLTO from MemProf summaries.

Follow-on patches will contain the support for cloning on the graph and
in the IR.

Depends on D140908.

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

19 months ago[scudo] Early exit from the case can't do page release.
Chia-hung Duan [Wed, 22 Mar 2023 21:46:23 +0000 (21:46 +0000)]
[scudo] Early exit from the case can't do page release.

There are heuristics to avoid marking blocks if there's little chance
to release pages. So far, those logics only exist in block-marking
section and we didn't leverage the results of those logics. For example,
in a round of releaseToOS try, we know it's still 128 KB away from the
release threshold. In the next round of releaseToOS, we can early exit
if the number of pushed bytes is smaller than 128 KB without looping
each memory group. This CL adds this heuristic and has reduced amount of
time in checking the status of each memory group.

This CL only applies this heuristic on SizeClassAllocator64.
SizeClassAllocator32 has a smaller region/group size and has little
impact on the default value.

Reviewed By: cferris

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

19 months ago[lldb] Fix dwim-print error message for missing expr
Dave Lee [Thu, 9 Mar 2023 19:10:32 +0000 (11:10 -0800)]
[lldb] Fix dwim-print error message for missing expr

19 months ago[libc++] Remove __mutex_base header
Nikolas Klauser [Wed, 22 Mar 2023 21:20:10 +0000 (22:20 +0100)]
[libc++] Remove __mutex_base header

This header should have been removed in
https://reviews.llvm.org/D146228, but there was a merge conflict.

19 months ago[libc++] Qualifies intptr_t and uintptr_t.
Mark de Wever [Wed, 22 Mar 2023 16:39:27 +0000 (17:39 +0100)]
[libc++] Qualifies intptr_t and uintptr_t.

This has been done using the following command

  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)(?<!::u)u?intptr_t)|\1std::\2|' \{} \;

The std module doesn't export declarations in the global namespaace.
This is a preparation for that module.

Reviewed By: #libc, ldionne

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

19 months ago[JITLink] Deterministic JITDylib symbol table dumps
Stefan Gränitz [Wed, 22 Mar 2023 21:11:26 +0000 (22:11 +0100)]
[JITLink] Deterministic JITDylib symbol table dumps

Sort symbols before dumping so we get a deterministic order and can check them in tests.

Reviewed By: lhames

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

19 months ago[MSAN] Update vector load/store tests to use proper attribute
Philip Reames [Wed, 22 Mar 2023 21:01:39 +0000 (14:01 -0700)]
[MSAN] Update vector load/store tests to use proper attribute

I had made a mistake when pre-committing the tests; caught in review of D146157.

19 months agoRevert "[flang] Feature list plugin" due to failing build
Ethan Luis McDonough [Wed, 22 Mar 2023 20:49:50 +0000 (15:49 -0500)]
Revert "[flang] Feature list plugin" due to failing build

This reverts commit 823ddba1b325f30fc3fb2e9d695c211b856a4d5d.

19 months ago[docs][scudo] Add information about M_PURGE_ALL.
Christopher Ferris [Fri, 17 Mar 2023 22:25:48 +0000 (15:25 -0700)]
[docs][scudo] Add information about M_PURGE_ALL.

Add information about M_PURGE_ALL

Reviewed By: Chia-hungDuan

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

19 months ago[libc++] Remove availability markup for std::format
Louis Dionne [Thu, 16 Mar 2023 17:09:44 +0000 (13:09 -0400)]
[libc++] Remove availability markup for std::format

std::format is currently experimental, so there is technically no
deployment target requirement for it (since the only symbols required
for it are in `libc++experimental.a`).

However, some parts of std::format depend indirectly on the floating
point std::to_chars implementation, which does have deployment target
requirements.

This patch removes all the availability format for std::format and
updates the XFAILs in the tests to properly explain why they fail
on old deployment targets, when they do. It also changes a couple
of tests to avoid depending on floating-point std::to_chars when
it isn't fundamental to the test.

Finally, some tests are marked as XFAIL but I added a comment saying

   TODO FMT This test should not require std::to_chars(floating-point)

These tests do not fundamentally depend on floating-point std::to_chars,
however they end up failing because calling std::format even without a
floating-point argument to format will end up requiring floating-point
std::to_chars. I believe this is an implementation artifact that could
be avoided in all cases where we know the format string at compile-time.
In the tests, I added the TODO comment only to the places where we could
do better and actually avoid relying on floating-point std::to_chars
because we know the format string at compile-time.

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

19 months ago[test] Add tools/llvm-dwarfdump/ARM/lit.local.cfg after D143513
Fangrui Song [Wed, 22 Mar 2023 19:56:13 +0000 (12:56 -0700)]
[test] Add tools/llvm-dwarfdump/ARM/lit.local.cfg after D143513

19 months ago[JITLink] Introduce target flags for Symbol and prepare ObjectLinkingLayer to account...
Stefan Gränitz [Wed, 22 Mar 2023 19:21:59 +0000 (20:21 +0100)]
[JITLink] Introduce target flags for Symbol and prepare ObjectLinkingLayer to account for them

AArch32 branch offsets explicitly encode the target instruction subset (Arm/Thumb) in their least significant bit. We want this bit set (or clear) in addreses we hand out, but the addresses in the LinkGraph should be the real/physical addresses.

This patch allows ELFLinkGraphBuilder's to set target-specific flags in jitlink::Symbol and prepares ObjectLinkingLayer to account for them.

Reviewed By: lhames

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

19 months ago[gn build] Port e655d8a54880
LLVM GN Syncbot [Wed, 22 Mar 2023 19:30:55 +0000 (19:30 +0000)]
[gn build] Port e655d8a54880

19 months agoPrecommit tests for D146327
Jeff Byrnes [Wed, 22 Mar 2023 19:19:00 +0000 (12:19 -0700)]
Precommit tests for D146327

19 months ago[LFTR] Simplify integer case for genLoopLimit [nfc-ish]
Philip Reames [Wed, 22 Mar 2023 19:07:08 +0000 (12:07 -0700)]
[LFTR] Simplify integer case for genLoopLimit [nfc-ish]

The integer case in genLoopLimit reduces down to a special case for narrowing the bitwidth of the limit, and then performing the same expansion we would for a pointer IV.

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

19 months ago[libc++] Granularize __mutex_base
Nikolas Klauser [Thu, 9 Mar 2023 00:14:03 +0000 (01:14 +0100)]
[libc++] Granularize __mutex_base

This also updates the moved code to the current style. (i.e. `_VSTD` -> `std`, `_LIBCPP_INLINE_VISIBILITY` -> `_LIBCPP_HIDE_FROM_ABI`, clang-format).

Reviewed By: Mordante, #libc, EricWF

Spies: arichardson, libcxx-commits, mikhail.ramalho

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

19 months ago[SCEV] Infer no-self-wrap via constant ranges
Philip Reames [Wed, 22 Mar 2023 16:51:58 +0000 (09:51 -0700)]
[SCEV] Infer no-self-wrap via constant ranges

Without this, pointer IVs in loops with small constant trip counts couldn't be proven no-self-wrap. This came up in a new LSR transform, but may also benefit other SCEV consumers as well.

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

19 months ago[clang-tidy][NFC] Move avoid-underscore-in-googletest-name to google folder
Carlos Galvez [Wed, 22 Mar 2023 18:38:10 +0000 (18:38 +0000)]
[clang-tidy][NFC] Move avoid-underscore-in-googletest-name to google folder

Since the check belongs to the google module, it makes sense
that the corresponding test also belongs to the google module.

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

19 months ago[CodeGen] Fix type of MachineRegisterInfo::RegAllocHints. NFC.
Jay Foad [Wed, 22 Mar 2023 16:56:05 +0000 (16:56 +0000)]
[CodeGen] Fix type of MachineRegisterInfo::RegAllocHints. NFC.

The first member of the pair should be unsigned instead of Register
because it is the hint type, 0 for simple (target independent) hints and
other values for target dependent hints.

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

19 months ago[Driver][test] Fix avr-ld.c for -DCLANG_DEFAULT_LINKER=lld after D145646
Fangrui Song [Wed, 22 Mar 2023 18:36:02 +0000 (11:36 -0700)]
[Driver][test] Fix avr-ld.c for -DCLANG_DEFAULT_LINKER=lld after D145646

19 months ago[lldb] Update some uses of Python2 API in typemaps.
Jorge Gorbe Moya [Tue, 21 Mar 2023 22:30:32 +0000 (15:30 -0700)]
[lldb] Update some uses of Python2 API in typemaps.

Python 3 doesn't have a distinction between PyInt and PyLong, it's all
PyLong now.

This also fixes a bug in SetNumberFromObject. This used to crash LLDB:
```
lldb -o "script data=lldb.SBData(); data.SetDataFromUInt64Array([2**63])"
```

The problem happened in the PyInt path:
```
  if (PyInt_Check(obj))
      number = static_cast<T>(PyInt_AsLong(obj));
```
when obj doesn't fit in a signed long, `PyInt_AsLong` would fail with
"OverflowError: Python int too large to convert to C long".

The existing long path does the right thing, as it will call
`PyLong_AsUnsignedLongLong` for uint64_t.

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

19 months ago[clang-format] Annotate noexcept, explicit specifiers as containing expressions
Emilia Dreamer [Wed, 22 Mar 2023 18:26:38 +0000 (20:26 +0200)]
[clang-format] Annotate noexcept, explicit specifiers as containing expressions

The noexcept specifier and explicit specifier can optionally include a
boolean expression to make these specifiers apply conditionally,
however, clang-format didn't set the context for the parenthesized
content of these specifiers, meaning they inherited the parent context,
which usually isn't an expressions, leading to misannotated binary
operators.

This patch applies expression context to the content of these
specifiers, making them similar to the static_assert keyword.

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

Reviewed By: owenpan, MyDeveloperDay

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

19 months agoSymbolFile: ensure that we have a value before invoking `getBitWidth`
Saleem Abdulrasool [Tue, 21 Mar 2023 16:03:54 +0000 (12:03 -0400)]
SymbolFile: ensure that we have a value before invoking `getBitWidth`

Ensure that the variant returned by `member->getValue()` has a value and
is not `Empty`.  Failure to do so will trigger an assertion failure in
`llvm::pdb::Variant::getBitWidth()`.  This can occur when the `static`
member is a forward declaration.

Differential Revision: https://reviews.llvm.org/D146536
Reviewed By: sgraenitz

19 months ago[TSan] Avoid deadlock between ReportRace() and dlopen() interceptor
Julian Lettner [Tue, 21 Mar 2023 23:20:22 +0000 (16:20 -0700)]
[TSan] Avoid deadlock between ReportRace() and dlopen() interceptor

This change prevents rare deadlocks observed for specific macOS/iOS GUI
applications which issue many `dlopen()` calls from multiple different
threads at startup and where TSan finds and reports a race during
startup.  Providing a reliable test for this has been deemed infeasible.

Although I've only observed this deadlock on Apple platforms,
conceptually the cause is not confined to Apple code so the fix lives in
platform-independent code.

Deadlock scenario:
```
Thread 2                    | Thread 4
ReportRace()                |
Lock internal TSan mutexes  |
  &ctx->slot_mtx            |
                            | dlopen() interceptor
                            | OnLibraryLoaded()
                            | MemoryMappingLayout::DumpListOfModules()
                            | calls dyld API, which takes internal lock
                            | lock() interceptor
                            | TSan tries to take internal mutexes again
                            |   &ctx->slot_mtx
call into symbolizer        |
MemoryMappingLayout::DumpListOfModules()
calls dyld API, which hangs on trying to take lock
```
Resulting in:
* Thread 2 has internal TSan mutex, blocked on dyld lock
* Thread 4 has dyld lock, blocked on internal TSan mutex

The fix prevents this situation by not intercepting any of the calls
originating from `MemoryMappingLayout::DumpListOfModules()`.

Stack traces for deadlock between ReportRace() and dlopen() interceptor:
```
thread #2, queue = 'com.apple.root.default-qos'
  frame #0: libsystem_kernel.dylib
  frame #1: libclang_rt.tsan_osx_dynamic.dylib`::wrap_os_unfair_lock_lock_with_options(lock=<unavailable>, options=<unavailable>) at tsan_interceptors_mac.cpp:306:3
  frame #2: dyld`dyld4::RuntimeLocks::withLoadersReadLock(this=0x000000016f21b1e0, work=0x00000001814523c0) block_pointer) at DyldRuntimeState.cpp:227:28
  frame #3: dyld`dyld4::APIs::_dyld_get_image_header(this=0x0000000101012a20, imageIndex=614) at DyldAPIs.cpp:240:11
  frame #4: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::MemoryMappingLayout::CurrentImageHeader(this=<unavailable>) at sanitizer_procmaps_mac.cpp:391:35
  frame #5: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::MemoryMappingLayout::Next(this=0x000000016f2a2800, segment=0x000000016f2a2738) at sanitizer_procmaps_mac.cpp:397:51
  frame #6: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::MemoryMappingLayout::DumpListOfModules(this=0x000000016f2a2800, modules=0x00000001011000a0) at sanitizer_procmaps_mac.cpp:460:10
  frame #7: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::ListOfModules::init(this=0x00000001011000a0) at sanitizer_mac.cpp:610:18
  frame #8: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::Symbolizer::FindModuleForAddress(unsigned long) [inlined] __sanitizer::Symbolizer::RefreshModules(this=0x0000000101100078) at sanitizer_symbolizer_libcdep.cpp:185:12
  frame #9: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::Symbolizer::FindModuleForAddress(this=0x0000000101100078, address=6465454512) at sanitizer_symbolizer_libcdep.cpp:204:5
  frame #10: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::Symbolizer::SymbolizePC(this=0x0000000101100078, addr=6465454512) at sanitizer_symbolizer_libcdep.cpp:88:15
  frame #11: libclang_rt.tsan_osx_dynamic.dylib`__tsan::SymbolizeCode(addr=6465454512) at tsan_symbolize.cpp:106:35
  frame #12: libclang_rt.tsan_osx_dynamic.dylib`__tsan::SymbolizeStack(trace=StackTrace @ 0x0000600002d66d00) at tsan_rtl_report.cpp:112:28
  frame #13: libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedReportBase::AddMemoryAccess(this=0x000000016f2a2a90, addr=4381057136, external_tag=<unavailable>, s=<unavailable>, tid=<unavailable>, stack=<unavailable>, mset=0x00000001012fc310) at tsan_rtl_report.cpp:190:16
  frame #14: libclang_rt.tsan_osx_dynamic.dylib`__tsan::ReportRace(thr=0x00000001012fc000, shadow_mem=0x000008020a4340e0, cur=<unavailable>, old=<unavailable>, typ0=1) at tsan_rtl_report.cpp:795:9
  frame #15: libclang_rt.tsan_osx_dynamic.dylib`__tsan::DoReportRace(thr=0x00000001012fc000, shadow_mem=0x000008020a4340e0, cur=Shadow @ x22, old=Shadow @ 0x0000600002d6b4f0, typ=1) at tsan_rtl_access.cpp:166:3
  frame #16: libclang_rt.tsan_osx_dynamic.dylib`::__tsan_read8(void *) at tsan_rtl_access.cpp:220:5
  frame #17: libclang_rt.tsan_osx_dynamic.dylib`::__tsan_read8(void *) [inlined] __tsan::MemoryAccess(thr=0x00000001012fc000, pc=<unavailable>, addr=<unavailable>, size=8, typ=1) at tsan_rtl_access.cpp:442:3
  frame #18: libclang_rt.tsan_osx_dynamic.dylib`::__tsan_read8(addr=<unavailable>) at tsan_interface.inc:34:3
  <call into TSan from from instrumented code>

thread #4, queue = 'com.apple.dock.fullscreen'
  frame #0:  libsystem_kernel.dylib
  frame #1:  libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::FutexWait(p=<unavailable>, cmp=<unavailable>) at sanitizer_mac.cpp:540:3
  frame #2:  libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::Semaphore::Wait(this=<unavailable>) at sanitizer_mutex.cpp:35:7
  frame #3:  libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::Mutex::Lock(this=0x0000000102992a80) at sanitizer_mutex.h:196:18
  frame #4:  libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor() [inlined] __sanitizer::GenericScopedLock<__sanitizer::Mutex>::GenericScopedLock(this=<unavailable>, mu=0x0000000102992a80) at sanitizer_mutex.h:383:10
  frame #5:  libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor() [inlined] __sanitizer::GenericScopedLock<__sanitizer::Mutex>::GenericScopedLock(this=<unavailable>, mu=0x0000000102992a80) at sanitizer_mutex.h:382:77
  frame #6:  libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor() at tsan_rtl.h:708:10
  frame #7:  libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor() [inlined] __tsan::TryTraceFunc(thr=0x000000010f084000, pc=0) at tsan_rtl.h:751:7
  frame #8:  libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor() [inlined] __tsan::FuncExit(thr=0x000000010f084000) at tsan_rtl.h:798:7
  frame #9:  libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor(this=0x000000016f3ba280) at tsan_interceptors_posix.cpp:300:5
  frame #10: libclang_rt.tsan_osx_dynamic.dylib`__tsan::ScopedInterceptor::~ScopedInterceptor(this=<unavailable>) at tsan_interceptors_posix.cpp:293:41
  frame #11: libclang_rt.tsan_osx_dynamic.dylib`::wrap_os_unfair_lock_lock_with_options(lock=0x000000016f21b1e8, options=OS_UNFAIR_LOCK_NONE) at tsan_interceptors_mac.cpp:310:1
  frame #12: dyld`dyld4::RuntimeLocks::withLoadersReadLock(this=0x000000016f21b1e0, work=0x00000001814525d4) block_pointer) at DyldRuntimeState.cpp:227:28
  frame #13: dyld`dyld4::APIs::_dyld_get_image_vmaddr_slide(this=0x0000000101012a20, imageIndex=412) at DyldAPIs.cpp:273:11
  frame #14: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::MemoryMappingLayout::Next(__sanitizer::MemoryMappedSegment*) at sanitizer_procmaps_mac.cpp:286:17
  frame #15: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::MemoryMappingLayout::Next(this=0x000000016f3ba560, segment=0x000000016f3ba498) at sanitizer_procmaps_mac.cpp:432:15
  frame #16: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::MemoryMappingLayout::DumpListOfModules(this=0x000000016f3ba560, modules=0x000000016f3ba618) at sanitizer_procmaps_mac.cpp:460:10
  frame #17: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::ListOfModules::init(this=0x000000016f3ba618) at sanitizer_mac.cpp:610:18
  frame #18: libclang_rt.tsan_osx_dynamic.dylib`__sanitizer::LibIgnore::OnLibraryLoaded(this=0x0000000101f3aa40, name="<some library>") at sanitizer_libignore.cpp:54:11
  frame #19: libclang_rt.tsan_osx_dynamic.dylib`::wrap_dlopen(filename="<some library>", flag=<unavailable>) at sanitizer_common_interceptors.inc:6466:3
  <library code>
```

rdar://106766395

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

19 months agoRevert "Remove the LINK_COMPONENTS entry from lldb-instr CMakery"
Heejin Ahn [Thu, 2 Mar 2023 20:04:27 +0000 (12:04 -0800)]
Revert "Remove the LINK_COMPONENTS entry from lldb-instr CMakery"

This reverts commit e12a950d90f88aeddaa97d6e7c8fd0bfedc42f73.

D142241 broke `-sBUILD_SHARED_LIBS=ON` build. After investigations in
https://github.com/llvm/llvm-project/issues/60314, the issue that
prompted D142441 now seems gone.

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

Reviewed By: JDevlieghere

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

19 months ago[RISCV] Remove AnyReg RegisterClass used by .insn instructions. Use custom operand...
Craig Topper [Wed, 22 Mar 2023 17:24:57 +0000 (10:24 -0700)]
[RISCV] Remove AnyReg RegisterClass used by .insn instructions. Use custom operand instead.

The fake register class interferes too much with the autogenerated
register class tables. Especially the fake spill size.

I'm working on .insn support for compressed instructions and adding
AnyRegC broke CodeGen.

19 months ago[CMake] Build runtimes for riscv64-unknown-fuchsia
Petr Hosek [Wed, 22 Mar 2023 04:57:08 +0000 (04:57 +0000)]
[CMake] Build runtimes for riscv64-unknown-fuchsia

This is necessary to have a complete RISC-V toolchain for Fuchsia.

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

19 months ago[gn build] Port 700cd99061ed
LLVM GN Syncbot [Wed, 22 Mar 2023 17:21:25 +0000 (17:21 +0000)]
[gn build] Port 700cd99061ed

19 months agoRestore "[MemProf] Context disambiguation cloning pass [patch 1a/3]"
Teresa Johnson [Wed, 22 Mar 2023 17:01:45 +0000 (10:01 -0700)]
Restore "[MemProf] Context disambiguation cloning pass [patch 1a/3]"

This restores commit d6ad4f01c3dafcab335bca66dac6e36d9eac8421, which was
reverted in commit 883dbb9c86be87593a58ef10b070b3a0564c7fee, along with
a fix for gcc 12.2 build errors in the original commit.

Support for building, printing, and displaying CallsiteContextGraph
which represents the MemProf metadata contexts. Uses CRTP to enable
support for both IR (regular LTO) and summary (ThinLTO). This patch
includes the support for building it in regular LTO mode (from
memprof and callsite metadata), and the next patch will add the
handling for building it from ThinLTO summaries.

Also includes support for dumping the graph to text and to dot files.

Follow-on patches will contain the support for cloning on the graph and
in the IR.

The graph represents the call contexts in all memprof metadata on
allocation calls, with nodes for the allocations themselves, as well as
for the calls in each context. The graph is initially built from the
allocation memprof metadata (or summary) MIBs. It is then updated to
match calls with callsite metadata onto the nodes, updating it to
reflect any inlining performed on those calls.

Each MIB (representing an allocation's call context with allocation
behavior) is assigned a unique context id during the graph build. The
edges and nodes in the graph are decorated with the context ids they
carry. This is used to correctly update the graph when cloning is
performed so that we can uniquify the context for a single (possibly
cloned) allocation.

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

19 months ago[RISCV] Add FallbackRegAltNameIndex to ABIRegAltName.
Craig Topper [Wed, 22 Mar 2023 17:07:18 +0000 (10:07 -0700)]
[RISCV] Add FallbackRegAltNameIndex to ABIRegAltName.

Remove now redundant fake ABI names from vector registers.

This also fixes a crash that occurs if you use fflags as an instruction
operand in the assembly and use -debug. It's not a valid register
for any instruction since this wouldn't be common. It doesn't have
an ABI name so it crashes the register printing in the debug output.

19 months ago[RISCV] Convert segment registers to VR registers in RISCVMCInstLower.
Craig Topper [Wed, 22 Mar 2023 17:01:17 +0000 (10:01 -0700)]
[RISCV] Convert segment registers to VR registers in RISCVMCInstLower.

Similar to what we do for the LMUL>1 register classes. The printing
is only working today because the segment registers have "ABI" names
set to their base register name.

19 months ago[mlir][tosa] Canonicalize concatenate->slice sequence
Luke Hutton [Wed, 22 Mar 2023 00:54:15 +0000 (00:54 +0000)]
[mlir][tosa] Canonicalize concatenate->slice sequence

Adds a canonicalizer for the concatenate->slice sequence where
an output of slice can be replaced with an input of concatenate.

This is useful in the context of operations with complex inputs
and outputs that are legalized from a framework such as TFL.
For example, a TFL graph (FFT->FFT) will be legalized to the
following TOSA graph:

     <complex input>
         /     \
     slice    slice
         \     /
           FFT
          /   \     -+
       concatenate   |
         /     \     |  Redundant
     slice    slice  |
         \     /    -+
           FFT
         /     \
       concatenate
            |
     <complex output>

Concatenate and slice operations at the boundaries of the graph are
useful as they maintain the correct correspondance of input/output
tensors to the original TFL graph. However, consecutive
complex operations will result in redundant concatenate->slice
sequences which should be removed from the final TOSA graph.

The canonicalization does not currently handle dynamic types.

Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Reviewed By: rsuderman

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

19 months ago[Constant] Inline ConstantInt::getSigned
Craig Topper [Wed, 22 Mar 2023 16:31:51 +0000 (09:31 -0700)]
[Constant] Inline ConstantInt::getSigned

ConstantInt::getSigned calls ConstantInt::get with the IsSigned flag set to true.
That flag normally defaults to false.

For always signed constants the code base is not consistent about whether
it uses ConstantInt::getSigned or ConstantInt::get with IsSigned set to true.
And it's not clear how to decide which way to use.

By making getSigned inline, both ways should generate the same code in
the end.

Reviewed By: nikic

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

19 months ago[DebugInfo] Allow parsing line tables aligned to 4 or 8-byte boundaries
Benjamin Maxwell [Wed, 22 Mar 2023 14:48:28 +0000 (14:48 +0000)]
[DebugInfo] Allow parsing line tables aligned to 4 or 8-byte boundaries

This allows the DWARFDebugLine::SectionParser to try parsing line tables
at 4 or 8-byte boundaries if the unaligned offset appears invalid. If
aligning the offset does not reduce errors the offset is used unchanged.

This is needed for llvm-dwarfdump to be able to extract the line tables
(with --debug-lines) from binaries produced by certain compilers that
like to align each line table in the .debug_line section. Note that this
alignment does not seem to be invalid since the units do point to the
correct line table offsets via the DW_AT_stmt_list attribute.

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

19 months ago[WebAssembly] Fix epilogue insertion for indirect tail calls
Thomas Lively [Wed, 22 Mar 2023 16:28:47 +0000 (09:28 -0700)]
[WebAssembly] Fix epilogue insertion for indirect tail calls

Previously epilogues were incorrectly inserted after indirect tail calls because
they did not have the `isTerminator` property. Add that property and test that
they get correct epilogues. To be safe, also add other properties that were
defined for direct tail calls.

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

19 months ago[libc++] Qualifies ptrdiff_t and max_align_t.
Mark de Wever [Tue, 21 Mar 2023 18:01:12 +0000 (19:01 +0100)]
[libc++] Qualifies ptrdiff_t and max_align_t.

This has been done using the following commands
  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)ptrdiff_t)|\1std::\2|' \{} \;
  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)max_align_t)|\1std::\2|' \{} \;

The std module doesn't export declarations in the global namespaace.,
This is a preparation for that module.

Reviewed By: #libc, ldionne

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

19 months ago[InstSimplify] Actually use NewOps for calls in simplifyInstructionWithOperands
Arthur Eubanks [Wed, 22 Mar 2023 01:00:08 +0000 (18:00 -0700)]
[InstSimplify] Actually use NewOps for calls in simplifyInstructionWithOperands

Resolves a TODO.

Reviewed By: nikic

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

19 months ago[NFC][WebAssembly] Autogenerate test expectations for tailcall.ll
Thomas Lively [Wed, 22 Mar 2023 16:21:12 +0000 (09:21 -0700)]
[NFC][WebAssembly] Autogenerate test expectations for tailcall.ll

A follow-on commit will add tests to this file and using the
update_llc_test_checks script will make that easier.

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

19 months ago[AArch64] Add asm aliases for MOV, LDR, STR with predicate-as-counter
Caroline Concatto [Wed, 22 Mar 2023 14:57:18 +0000 (14:57 +0000)]
[AArch64] Add asm aliases for MOV, LDR, STR with predicate-as-counter

In the 2022-12 release of the A64 ISA it was updated that the assembler must
also accept predicate-as-counter register names for the source predicate
register and the destination predicate register for:
 * *MOV: Move predicate (unpredicated)*
 * *LDR (predicate): Load predicate register*
 * *STR (predicate): Store predicate register*

Reviewed By: sdesmalen

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

19 months ago[RISCV][NFC] Make interleaved access test more vectorizable
Luke Lau [Mon, 20 Mar 2023 17:31:40 +0000 (17:31 +0000)]
[RISCV][NFC] Make interleaved access test more vectorizable

The previous test case stored the result of a deinterleaved load and add
into the same source address, which resulted in some scatters which we
weren't testing for and made the tests harder to understand.
Store it at a separate address, which will make the tests easier to read
when the cost model is changed after D145085 is landed

Reviewed By: reames

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

19 months ago[ARM] Improve min/max vector reductions on Arm
Caleb Zulawski [Wed, 22 Mar 2023 16:00:19 +0000 (16:00 +0000)]
[ARM] Improve min/max vector reductions on Arm

This patch adds some more efficient lowering for vecreduce.min/max under NEON,
using sequences of pairwise vpmin/vpmax to reduce to a single value.

This nearly resolves issues such as #50466, #40981, #38190.

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

19 months ago[X86] Extend all_of(icmp_eq()) / any_of(icmp_ne()) -> scalar integer fold to AVX512...
Simon Pilgrim [Wed, 22 Mar 2023 15:56:23 +0000 (15:56 +0000)]
[X86] Extend all_of(icmp_eq()) / any_of(icmp_ne()) -> scalar integer fold to AVX512 targets

Extends 1bb95a3a99cb44f2b8b801e5137d3ac529253f3b to combine on AVX512 targets where the vXi1 type is legal

Continues work on addressing Issue #53419

19 months agoRegenerate checks for bswap.ll, NFC
Jun Zhang [Wed, 22 Mar 2023 15:41:53 +0000 (23:41 +0800)]
Regenerate checks for bswap.ll, NFC

Signed-off-by: Jun Zhang <jun@junz.org>
19 months agoFix accessing of aligned arrays in offloaded target regions
Doru Bercea [Wed, 22 Feb 2023 16:58:48 +0000 (11:58 -0500)]
Fix accessing of aligned arrays in offloaded target regions

19 months ago[gn build] Port 883dbb9c86be
LLVM GN Syncbot [Wed, 22 Mar 2023 14:45:00 +0000 (14:45 +0000)]
[gn build] Port 883dbb9c86be

19 months agoRevert "[MemProf] Context disambiguation cloning pass [patch 1a/3]"
Nikita Popov [Wed, 22 Mar 2023 14:43:46 +0000 (15:43 +0100)]
Revert "[MemProf] Context disambiguation cloning pass [patch 1a/3]"

This reverts commit d6ad4f01c3dafcab335bca66dac6e36d9eac8421.

Fails to build on at least gcc 12.2:

/home/npopov/repos/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:482:1: error: no declaration matches ‘ContextNode<DerivedCCG, FuncTy, CallTy>* CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::getNodeForInst(const CallInfo&)’
  482 | CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::getNodeForInst(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/npopov/repos/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:393:16: note: candidate is: ‘CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::ContextNode* CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::getNodeForInst(const CallInfo&)’
  393 |   ContextNode *getNodeForInst(const CallInfo &C);
      |                ^~~~~~~~~~~~~~
/home/npopov/repos/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:99:7: note: ‘class CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>’ defined here
   99 | class CallsiteContextGraph {
      |       ^~~~~~~~~~~~~~~~~~~~

19 months ago[MLIR][LLVM] Copy byval attributes during inlining.
Johannes de Fine Licht [Wed, 22 Mar 2023 14:22:11 +0000 (15:22 +0100)]
[MLIR][LLVM] Copy byval attributes during inlining.

Support inlining of function calls with the byval attribute on function
arguments by copying the pointee into a newly alloca'ed pointer at the
callsite before inlining.

The alignment attribute is not yet taken into account.

Reviewed By: ftynse, gysit

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

19 months ago[gn build] Port e4ceb5a7bb9b
LLVM GN Syncbot [Wed, 22 Mar 2023 14:28:29 +0000 (14:28 +0000)]
[gn build] Port e4ceb5a7bb9b

19 months ago[GVN] Fix change reporting when removing assume (PR61574)
Nikita Popov [Wed, 22 Mar 2023 14:22:33 +0000 (15:22 +0100)]
[GVN] Fix change reporting when removing assume (PR61574)

Report a change when removing a true/false assume.

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

19 months ago[X86] Create extra prolog/epilog for stack realignment
Luo, Yuanke [Wed, 22 Mar 2023 12:41:36 +0000 (20:41 +0800)]
[X86] Create extra prolog/epilog for stack realignment

Fix some bugs and reland e4c1dfed38370b4 and 614c63bec6d67c.
1. Run argument stack rebase pass before the reserved physical register
   is finalized.
2. Add LEA pseudo instruction to prevent the instruction being
   eliminated.
3. Don't support X32.

19 months ago[Assignment Tracking] Fix mem2reg misidentifying unlinked stores
OCHyams [Wed, 22 Mar 2023 13:29:46 +0000 (13:29 +0000)]
[Assignment Tracking] Fix mem2reg misidentifying unlinked stores

updateForDeletedStore updates the assignment tracking debug info for a store
that is about to be deleted by mem2reg. For each variable backed by the target
alloca, if a dbg.assign exists it is kept (well - it's downgraded to a
dbg.value). A dbg.value is inserted if there's not a linked dbg.assign for a
variable which is backed by the target alloca. This patch fixes a bug whereby a
store with a linked dbg.assign that describes a fragment different to the one
linked to the alloca was not counted for the variable, leading to both keeping
the dbg.assign (downgrading it) and inserting a new dbg.value.

Reviewed By: StephenTozer

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

19 months ago[NFC] Add DebugVariableAggregate class
OCHyams [Wed, 22 Mar 2023 13:27:35 +0000 (13:27 +0000)]
[NFC] Add DebugVariableAggregate class

A DebugVariableAggregate is a DebugVariable that discards FragmentInfo; it
represents a whole variable instance.

Reviewed By: StephenTozer

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

19 months ago[gn build] Port d6ad4f01c3da
LLVM GN Syncbot [Wed, 22 Mar 2023 14:06:06 +0000 (14:06 +0000)]
[gn build] Port d6ad4f01c3da

19 months ago[MemProf] Context disambiguation cloning pass [patch 1a/3]
Teresa Johnson [Thu, 29 Dec 2022 20:11:38 +0000 (12:11 -0800)]
[MemProf] Context disambiguation cloning pass [patch 1a/3]

Support for building, printing, and displaying CallsiteContextGraph
which represents the MemProf metadata contexts. Uses CRTP to enable
support for both IR (regular LTO) and summary (ThinLTO). This patch
includes the support for building it in regular LTO mode (from
memprof and callsite metadata), and the next patch will add the
handling for building it from ThinLTO summaries.

Also includes support for dumping the graph to text and to dot files.

Follow-on patches will contain the support for cloning on the graph and
in the IR.

The graph represents the call contexts in all memprof metadata on
allocation calls, with nodes for the allocations themselves, as well as
for the calls in each context. The graph is initially built from the
allocation memprof metadata (or summary) MIBs. It is then updated to
match calls with callsite metadata onto the nodes, updating it to
reflect any inlining performed on those calls.

Each MIB (representing an allocation's call context with allocation
behavior) is assigned a unique context id during the graph build. The
edges and nodes in the graph are decorated with the context ids they
carry. This is used to correctly update the graph when cloning is
performed so that we can uniquify the context for a single (possibly
cloned) allocation.

Depends on D140786.

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

19 months ago[Dexter] Add timeout options
Stephen Tozer [Wed, 1 Mar 2023 13:05:11 +0000 (13:05 +0000)]
[Dexter] Add timeout options

Adds a pair of options for Dexter that allow the user to specify a
timeout duration. These options are:

* --timeout-total: Times out if the total run-time of the debugger session
  exceeds <timeout-total> seconds.
* --timeout-breakpoint: Times out if the time without hitting a
  breakpoint exceeds <timeout-breakpoint> seconds.

Reviewed By: Orlando

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

19 months agodocs: add some documentation on Windows SDK search
Saleem Abdulrasool [Wed, 15 Mar 2023 20:06:56 +0000 (13:06 -0700)]
docs: add some documentation on Windows SDK search

Add some documentation on the flags and the process by which clang
identifies the headers and libraries for the Windows environment.  It
should identify the flags and their interactions as well as the order in
which the various sources of information are consulted.

Differential Revision: https://reviews.llvm.org/D146165
Reviewed By: hans, mstorjo

19 months ago[flang] add -flang-experimental-hlfir flag to flang-new
Tom Eccles [Tue, 14 Mar 2023 13:27:30 +0000 (13:27 +0000)]
[flang] add -flang-experimental-hlfir flag to flang-new

This flag instructs flang-new to use the new HLFIR lowering. It is
marked as experimental and not included in --help.

This was added to make it more convenient to test the performance of
code generated by the HLFIR lowering.

Extra diffs are from running clang-format on CLOptions.inc (which was
being forced by CI).

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

19 months ago[SimplifyCFG][LICM] Add metadata speculation tests (NFC)
Nikita Popov [Wed, 22 Mar 2023 13:21:51 +0000 (14:21 +0100)]
[SimplifyCFG][LICM] Add metadata speculation tests (NFC)

19 months ago[ConstraintElim] Add tests with GEP constant expressions.
Florian Hahn [Wed, 22 Mar 2023 13:12:49 +0000 (13:12 +0000)]
[ConstraintElim] Add tests with GEP constant expressions.

19 months ago[libc][Bazel] Bazel fix for 494734b06d62b
Dmitry Chernenkov [Wed, 22 Mar 2023 12:50:22 +0000 (12:50 +0000)]
[libc][Bazel] Bazel fix for 494734b06d62b

19 months ago[mlir][AffineMap] NFC - Refactor getProjectedMap and split into projectDims and proje...
Nicolas Vasilache [Wed, 22 Mar 2023 09:19:20 +0000 (02:19 -0700)]
[mlir][AffineMap] NFC - Refactor getProjectedMap and split into projectDims and projectSymbols

The default behavior of getProjectedMap may be surprising as it implicitly compresses the dims and
the unused symbols.

Make these explicit in the API and refactor to more idiomatic implementations with better reuse.

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

19 months ago[mlir] Add a pattern to fold tensor.cast into scf.forall.
Alexander Belyaev [Wed, 22 Mar 2023 11:50:24 +0000 (12:50 +0100)]
[mlir] Add a pattern to fold tensor.cast into scf.forall.

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

19 months ago[InstCombine] enhance icmp with sub folds
Zhongyunde [Wed, 22 Mar 2023 11:52:41 +0000 (19:52 +0800)]
[InstCombine] enhance icmp with sub folds

The new IR with And removes a use of the input variable, which is better for analysis.
Fix https://github.com/llvm/llvm-project/issues/60818

Reviewed By: nikic, spatel

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

19 months ago[tests] precommit tests for D145846
Zhongyunde [Wed, 22 Mar 2023 11:47:35 +0000 (19:47 +0800)]
[tests] precommit tests for D145846

19 months ago[LV] Set inbounds flag using CreateGEP in vectorizeInterleaveGroup(NFC).
Florian Hahn [Wed, 22 Mar 2023 11:28:49 +0000 (11:28 +0000)]
[LV] Set inbounds flag using CreateGEP in vectorizeInterleaveGroup(NFC).

This avoids having to cast the result of the builder to
GetElementPtrInst.

19 months ago[LoopPredication] Add a test demonstrating bug.
Serguei Katkov [Wed, 22 Mar 2023 10:19:48 +0000 (17:19 +0700)]
[LoopPredication] Add a test demonstrating bug.

LoopPredication may introduce undefined behavior.

19 months ago[MLIR][Affine] Fix assumption on int type in memref elt size method
Uday Bondhugula [Wed, 22 Mar 2023 01:46:35 +0000 (07:16 +0530)]
[MLIR][Affine] Fix assumption on int type in memref elt size method

Fix assumption on memref element type being int/float in memref elt size
related method and affine data copy generate.

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

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

19 months ago[GVN] Regenerate test checks (NFC)
Nikita Popov [Wed, 22 Mar 2023 10:40:07 +0000 (11:40 +0100)]
[GVN] Regenerate test checks (NFC)

19 months ago[IR] Rename dropUndefImplying to dropUBImplying (NFC)
Nikita Popov [Wed, 22 Mar 2023 09:48:26 +0000 (10:48 +0100)]
[IR] Rename dropUndefImplying to dropUBImplying (NFC)

Clarify that this is only about immediate undefined behavior,
not about undef or poison.

19 months ago[dataflow] Log flow condition to the correct stream.
Sam McCall [Tue, 21 Mar 2023 14:34:31 +0000 (15:34 +0100)]
[dataflow] Log flow condition to the correct stream.

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