Commit Graph

426364 Commits

Author SHA1 Message Date
Paul Kirth acfeb1a6c2 [compiler-rt] Avoid truncating Symbolizer output
Repalce the fixed buffer in SymbolizerProcess with InternalScopedString,
and simply append to it when reading data.

Fixes #55460

Reviewed By: vitalybuka, leonardchan

Differential Revision: https://reviews.llvm.org/D126580
2022-06-07 21:50:39 +00:00
Wolfgang Pieb e3f6eda8c6 [Metadata] Add a resize capability to MDNodes and add a push_back interface to MDNodes
A change to the allocation characteristics of MDNodes, introducing the ability
to add operands one at a time. This functionality is restricted to MDTuples.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D125998
2022-06-07 14:34:38 -07:00
Jason Molenda d572fc3b49 Skip TestConcurrentWatchBreak.py on Darwin arm64
This test depends on multiple threads with one of them
hitting a watchpoint at the same time as a breakpoint, and
can fail because of the way arm64 watchpoints are handled.
I added skips to most of these via

```
commit bef4da4a6a
Author: Jason Molenda <jason@molenda.com>
Date:   Wed May 25 16:05:16 2022 -0700

    Skip testing of watchpoint hit-count/ignore-count on multithreaded
```

but missed that this test is susceptable to the same issue.
2022-06-07 14:33:40 -07:00
Aart Bik 7482cd6869 [mlir][sparse] updated our sparse dialect doc with some recent changes
The `init` and `tensor` ops are renamed (and one moved to another dialect).

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D127169
2022-06-07 14:27:57 -07:00
Vitaly Buka d7df3f0a4b [NFC] Exctract getNoSanitizeMask lambda 2022-06-07 14:08:43 -07:00
Vitaly Buka f32ad5703e [NFC] Move part of SanitizerMetadata into private method 2022-06-07 14:08:43 -07:00
Mitch Phillips 5d9de5f446 [NFC] Clang-format parts of D126929 and D126100 2022-06-07 14:08:43 -07:00
Mitch Phillips f49a5844b6 [NFC][CodeGen] Rename method
Extracted from D84652.
2022-06-07 14:08:42 -07:00
Christopher Bate 53fe155b3f Revert "[mlir][vector] Allow unroll of contraction in arbitrary order"
Reverts commit 1469ebf838 (original commit)
Reverts commit a392a39f75 (build fix for above commit)

The commit broke tests in out-of-tree projects, indicating that some logical
error was made in the previous change but not covered by current tests.
2022-06-07 14:54:01 -06:00
Jason Molenda 8d5a6007f9 Track transition from launch dyld to shared-cache dyld
On macOS, a process will be launched with /usr/lib/dyld (the
dynamic linker) and the main binary by the kernel.  The
first thing the standalone dyld will do is call into the dyld
in the shared cache image.  This patch tracks the transition
between the dyld's at the very beginning of process startup.

In DynamicLoaderMacOS::NotifyBreakpointHit() there are two new
cases handled:

`dyld_image_dyld_moved` which is the launch /usr/lib/dyld indicating
that it is about call into the shared cache dyld ane evict itself.
lldb will remove the notification breakpoint it set, clear the binary
image list entirely, get the notification function pointer value out
of the dyld_all_image_infos struct (which is the notification fptr
in the to-be-run shared-cache dyld) and put an address breakpoint
there.

`dyld_notify_adding` is then called by shared-cache dyld, and we
detect this case by noticing that we have an empty binary image list,
normally impossibe, and treating this as if we'd just started a
process attach/launch.

Differential Revision: https://reviews.llvm.org/D127247
rdar://84222158
2022-06-07 13:34:30 -07:00
Louis Dionne f3966eaf86 [libc++] Make the Debug mode a configuration-time only option
The debug mode has been broken pretty much ever since it was shipped
because it was possible to enable the debug mode in user code without
actually enabling it in the dylib, leading to ODR violations that
caused various kinds of failures.

This commit makes the debug mode a knob that is configured when
building the library and which can't be changed afterwards. This is
less flexible for users, however it will actually work as intended
and it will allow us, in the future, to add various kinds of checks
that do not assume the same ABI as the normal library. Furthermore,
this will make the debug mode more robust, which means that vendors
might be more tempted to support it properly, which hasn't been the
case with the current debug mode.

This patch shouldn't break any user code, except folks who are building
against a library that doesn't have the debug mode enabled and who try
to enable the debug mode in their code. Such users will get a compile-time
error explaining that this configuration isn't supported anymore.

In the future, we should further increase the granularity of the debug
mode checks so that we can cherry-pick which checks to enable, like we
do for unspecified behavior randomization.

Differential Revision: https://reviews.llvm.org/D122941
2022-06-07 16:33:53 -04:00
Philip Reames 89c4b29e8d [GuardWidening] Fix a nasty cast bug in c2eccc6
c2eccc6 introduced a call to etHasNoUnsignedWrap which implicitly assumes that Inst is a OverflowingBinaryOperator.  This is frequently untrue, but was not caught because cast<Ty>(X) has been broken, see https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.

I considered reverting this, but since doing so re-introduces a nasty miscompile of its own, I decided to fix forward instead.

I'll note that this is a particularly nasty form of the cast<Ty>(X) issue.  Because the cast was succeeding unexpected, we were writing data to instructions which weren't OBOs.  This could result in near arbitrary data or memory corruption.  I'm a bit shocked that the sanitizers didn't find this TBH.
2022-06-07 13:27:13 -07:00
Philip Reames 8a0cd23326 Revert "[MemDep][NFCI] Remove redundant dyn_cast, replace with cast"
This reverts commit 180d3f251d.  This commit is simply wrong.  IsLoad is set within the same file based on modref state, not whether the instruction is a LoadInst.

This went uncaught because cast<Ty>(X) has been broken.  See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.
2022-06-07 13:21:31 -07:00
Sunho Kim 9f29916169 [JITLink][AArch64] Refactor isLoadStoreImm12 check out of getPageOffset12Shift.
The separate isLoadStoreImm12 predicate will be used for validating ELF/aarch64
ldst relocation types.

Reviewed By: lhames, sgraenitz

Differential Revision: https://reviews.llvm.org/D126628
2022-06-07 13:18:12 -07:00
Florian Hahn b0c9a71be0
[VPlan] Handle VPInst without underlying instr in VPInterleavedAccess.
This violation is hidden while `cast` is missing an isa assertion after
D123901.
2022-06-07 21:00:49 +01:00
Joseph Huber f06731e3c3 [Binary] Make the OffloadingImage type own the memory
Summary:
The OffloadingBinary uses a convenience struct to help manage the memory
that will be serialized using the binary format. This currently uses a
reference to an existing buffer, but this should own the memory instead
so it is easier to work with seeing as its only current use requires
saving the buffer anyway.
2022-06-07 15:56:09 -04:00
Joseph Huber 9db2f32336 [Binary] Align the image offset in OffloadBinary
Summary:
The OffloadBinary wraps around an embedded device image, commonly an ELF
or LLVM BC file. These file formats have alignment requirements for
parsing, so if the image is stored at an un-aligned offset from the
beginning of the file we will be unable to parse the embeded image
without copying the image buffer. This patch adds alignment padding
before the binary image is appended to ensure we can parse the symbolic
file it contains in-place without copying memory.
2022-06-07 15:56:08 -04:00
Aaron Ballman d46e7aecb4 Update the C2x status page from latest working draft
This adds the papers for the Jun, Sep, and Dec 2021 meetings. 2022
papers will be handled in a follow-up.
2022-06-07 15:53:47 -04:00
Philip Reames 781de11f42 Revert "[LLVM][Casting.h] Add trivial self-cast"
This reverts commit 0809f63826.  The patch appears not to have included corresponding isa<Ty> support.

This was revealed when reintroducing the required isa<Ty> asserts in cast<Ty>.  See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.

Here's the template instantiation error:
In file included from /home/preames/llvm-repo/llvm-project/llvm/unittests/Support/Casting.cpp:9:
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h: In instantiation of ‘static bool llvm::isa_impl<To, From, Enabler>::doit(const From&) [with To = llvm::bar*; From = llvm::bar; Enabler = void]’:
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:110:36:   required from ‘static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::bar*; From = llvm::bar]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:137:41:   required from ‘static bool llvm::isa_impl_wrap<To, FromTy, FromTy>::doit(const FromTy&) [with To = llvm::bar*; FromTy = const llvm::bar*]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:129:13:   required from ‘static bool llvm::isa_impl_wrap<To, From, SimpleFrom>::doit(const From&) [with To = llvm::bar*; From = const llvm::bar* const; SimpleFrom = const llvm::bar*]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:263:62:   required from ‘static bool llvm::CastIsPossible<To, From, Enable>::isPossible(const From&) [with To = llvm::bar*; From = const llvm::bar*; Enable = void]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:517:38:   required from ‘static bool llvm::CastInfo<To, From, typename std::enable_if<(! llvm::is_simple_type<From>::value), void>::type>::isPossible(From&) [with To = llvm::bar*; From = llvm::bar* const]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:556:46:   required from ‘bool llvm::isa(const From&) [with To = llvm::bar*; From = llvm::bar*]’
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:585:3:   required from ‘decltype(auto) llvm::cast(From*) [with To = llvm::bar*; From = llvm::bar]’
/home/preames/llvm-repo/llvm-project/llvm/unittests/Support/Casting.cpp:181:27:   required from here
/home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:64:64: error: ‘classof’ is not a member of ‘llvm::bar*’
   64 |   static inline bool doit(const From &Val) { return To::classof(&Val); }
2022-06-07 12:50:40 -07:00
Martin Sebor dd2a6d78ee [InstCombine] Fold memchr of sequences of same characters
Enhance memchr libcall folder to handle constant arrays consisting
of one or two sequences of cosecutive equal characters.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126515
2022-06-07 13:45:10 -06:00
Martin Sebor fb6627fa0c [InstCombine] Add substr helper function (NFC).
Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126515
2022-06-07 13:27:36 -06:00
Sam Estep dcb4950d5b [clang][dataflow][NFC] Fix filename typos in tests
Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D127008
2022-06-07 19:20:20 +00:00
Joe Nash e243ead6fc Reland [AMDGPU] gfx11 vop3dpp instructions
There was an issue with encoding wide (>64 bit) instructions on
BigEndian hosts, which is fixed in D127195. Therefore reland this.

gfx11 adds the ability to use dpp modifiers on vop3 instructions.
This patch adds machine code layer support for that. The MCCodeEmitter
is changed to use APInt instead of uint64_t to support these wider
instructions.

Patch 16/N for upstreaming of AMDGPU gfx11 architecture

Differential Revision: https://reviews.llvm.org/D126483
2022-06-07 14:49:13 -04:00
Derek Schuff 2ae385e560 [WebAssembly] Add WASM_SEC_LAST_KNOWN to BinaryFormat section types list [NFC]
There are 3 places where we were using WASM_SEC_TAG as the "last" known
section type, which requires updating (or leaves a bug) when a new known
section type is added. Instead add a "last type" to the enum for this
purpose.

Differential Revision: https://reviews.llvm.org/D127164
2022-06-07 12:05:23 -07:00
Sunho Kim b6553f592a [JITLink][ELF][AArch64] Lift MachO/arm64 edges into aarch64.h, reuse for ELF.
This patch moves the aarch64 fixup logic from the MachO/arm64 backend to
aarch64.h header so that it can be re-used in the ELF/aarch64 backend. This
significantly expands relocation support in the ELF/aarch64 backend.

Reviewed By: lhames, sgraenitz

Differential Revision: https://reviews.llvm.org/D126286
2022-06-07 12:01:43 -07:00
William Huang ba26e45ca9 [ValueTracking] Add support to deduce a PHI node being a power of 2 if each incoming value is a power of 2.
Reviewed By: davidxl

Differential Revision: https://reviews.llvm.org/D124889
2022-06-07 18:52:31 +00:00
Reid Kleckner 570e76bb6c [config] Remove vestigial LLVM_VERSION_INFO
This has been superseded by the llvm/Support/VCSRevision.h header. So
far as I can tell, nothing in the CMake build sets LLVM_VERSION_INFO. It
was always undefined, and the ifdefs using it were dead. However, CMake
is very flexible, so it's possible that I missed some ways to set this
variable. One could, for example, probably pass -DLLVM_VERSION_INFO=x on
the command line and get that through to configure_file, or set the
variable in an obscure way (`set(${proj}_VERSION_INFO "x")`). I'm
reasonably confident that isn't happening, but I'd like a second
opinion.

Update the Bazel and gn builds accordingly.

Differential Revision: https://reviews.llvm.org/D126977
2022-06-07 11:36:26 -07:00
Reid Kleckner b1c7889f32 [config] Remove RETSIGTYPE from config.h.cmake, NFC
This doesn't need to be configurable. It was hardcoded to void in all
LLVM build systems.
2022-06-07 11:35:25 -07:00
Erich Keane 5c3bde9625 [CodeGen] Fix an issue when the 'extern C' replacement names broke
Originally broken by me in D122608, this is a regression where we
attempt to replace an extern-C thing with 'itself'.  The problem is that
we end up deleting it, causing the value to fail when it gets put into
llvm.used.
2022-06-07 11:30:59 -07:00
Philip Reames 4f5648adc5 [PointerUnionTest] Fix an incorrectly written test
The test being change appears to have been intended to exercise PointerUnion, but what it actually did was cast<> a double to a double*.  This only worked because cast<> was missing the required assertion.  Adding the assertion reveals a template error where isa<const double*>(double) fails to compile.
2022-06-07 11:26:28 -07:00
Kaining Zhong e80748ff88 [clang-diff] Fix assertion error when dealing with wide strings
Directly using StringLiteral::getString for wide string is not
currently supported; therefore in ASTDiff, getStmtValue will fail when
asserting that the StringLiteral has a width of 1. This patch also
covers cases for UTF16 and UTF32 encoding, along with corresponding
test cases.

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

Reviewed By: johannes

Differential Revision: https://reviews.llvm.org/D126651
2022-06-07 20:24:34 +02:00
Jay Foad 4561352f7b [CodeEmitter] Fix encoding wide instructions on big-endian hosts
For instructions wider than 64 bits the InstBits table is initialized in
64-bit chunks from APInt::getRawData, but it was being read with
LoadIntFromMemory which is byte-based.

Fix this by reading the table with the APInt constructor that takes an
ArrayRef to the raw data instead.

This is currently NFC for in-tree targets but fixes AMDGPU failures on
big-endian hosts that were caused by D126483 until it was reverted.

Differential Revision: https://reviews.llvm.org/D127195
2022-06-07 19:06:28 +01:00
David Green bccbf5276e [AArch64] Remove isDef32
isDef32 would attempt to make a guess at which SelectionDag nodes were
32bit sources, and use the nature of 32bit AArch64 instructions
implicitly zeroing the upper register half to not emit zext that were
expected to already be zero. This was a bit fragile though, needing to
guess at the correct opcodes that do not become 32bit defs later in
ISel.

This patch removed isDef32, relying on the AArch64MIPeephole optimizer
to remove redundant SUBREG_TO_REG nodes. A part of
SelectArithExtendedRegister was left with the same logic as a heuristic
to prevent some regressions from it picking less optimal sequences.
The AArch64MIPeepholeOpt pass also needs to be taught that a COPY from a
FPR will become a FMOVSWr, which it lowers immediately to make sure that
remains true through register allocation.

Fixes #55833

Differential Revision: https://reviews.llvm.org/D127154
2022-06-07 18:57:59 +01:00
Vince Bridgers c7fa4e8a8b [analyzer] Fix null pointer deref in CastValueChecker
A crash was seen in CastValueChecker due to a null pointer dereference.

The fix uses QualType::getAsString to avoid the null dereference
when a CXXRecordDecl cannot be obtained. A small reproducer is added,
and cast value notes LITs are updated for the new debug messages.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D127105
2022-06-07 13:34:06 -04:00
Sanjay Patel 82040d414b [InstCombine] reduce right-shift-of-left-shifted constant via demanded bits
If we don't demand high bits (zeros) and it is valid to pre-shift a constant:
(C2 << X) >> C1 --> (C2 >> C1) << X

https://alive2.llvm.org/ce/z/P3dWDW

There are a variety of related patterns, but I haven't found a single solution
that gets all of the motivating examples - so pulling this piece out of
D126617 along with more tests.

We should also handle the case where we shift-right followed by shift-left,
but I'll make that a follow-on patch assuming this one is ok. It seems likely
that we would want to add this to the SDAG version of the code too to keep it
on par with IR.

Differential Revision: https://reviews.llvm.org/D127122
2022-06-07 13:28:18 -04:00
Sanjay Patel 8956f80e4b [InstCombine] add vector tests for shift-shift; NFC
D127122
2022-06-07 13:28:18 -04:00
Groverkss 445e2b2aa0 [MLIR][Presburger] Fix subtract processing extra inequalities
This patch fixes a bug in PresburgeRelation::subtract that made it process the
inequality at index 0, multiple times. This was caused by allocating memory
instead of reserving memory in llvm::SmallVector.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D127228
2022-06-07 22:51:03 +05:30
Alan Zhao ae38e4880e [llvm-ml] Remove all file extension restrictions
After D126425 was submitted, hans@ observed that MSVC's ml.exe doesn't
care about the file's extension at all. Now, we check if the file exists
to determine whether an input filename is a valid assembly file.

To keep things consistent with clang-cl and lld-link, llvm-ml will treat
everything that's not a flag as a filename.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D126931
2022-06-07 13:03:19 -04:00
Mark de Wever b968c3452b [libc++] Removes _LIBCPP_AVAILABILITY_TO_CHARS.
After moving the std::to_chars base 10 implementation from the dylib to
the header the integral overloads of std::to_chars are available on all
platforms.

Remove the _LIBCPP_AVAILABILITY_TO_CHARS availability macro and update
the tests.

Depends on D125704

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D125745
2022-06-07 18:59:19 +02:00
Philip Reames d20f3fb6a2 Add initial coverage for invalid instruction costs in LoopRotate
Once extended with a case which requires duplication, will serve as test for crash being fixed in D127131.
2022-06-07 09:55:41 -07:00
Mark de Wever f2f0dba818 [libc++][CI] Updates Docker image.
- Updates the image to use Ubuntu Jammy.
- Installs GCC-12 as preparation to migrate to that GCC version.

Reviewed By: ldionne, #libc, jloser

Differential Revision: https://reviews.llvm.org/D126666
2022-06-07 18:52:31 +02:00
Mark de Wever dea7a8e616 [libc++] Don't use static constexpr in headers.
This was noticed in the review of D125704. In that commit only the new
table has been adapted. This adapts the existing tables.

Note since libc++'s charconv is backported to C++11 it's not possible to
use inline constexpr variables. The were introduced in C++17.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D126887
2022-06-07 18:47:44 +02:00
David Penry 907aedbb3d [NFC] Fix spelling/newlines in comments/debug messages
Just a few spelling mistakes and missing newlines

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D127162
2022-06-07 09:38:53 -07:00
Benjamin Kramer 1fd6f06b9e [format] Fix an uninitialized variable
parseBlock may decide to leave it unchanged. Found by msan.
2022-06-07 18:18:29 +02:00
Joseph Huber 421b1f55c6 [Libomptarget] Do not use retaining attributes for the static library
When we build the libomptarget device runtime library targeting bitcode,
we need special care to make sure that certain functions are not
optimized out. This is because we manually internalize and optimize
these definitions, ignoring their standard linkage semantics. When we
build with the static library, we can maintain these semantics and we do
not need these to be kept-alive. Furthermore, if they are kept-alive it
prevents them from being removed during LTO. This prevents us from
completely internalizing `IsSPMDMode` and removing several other
functions. This patch removes these for the static library target by
using a macro definition to enable them.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D126701
2022-06-07 12:16:34 -04:00
Simon Pilgrim a083f3caa1 [DAG] combineShuffleOfSplatVal - fold shuffle(splat,undef) -> splat, iff the splat contains no UNDEF elements
As noticed on D127115 - we were missing this fold, instead just having the shuffle(shuffle(x,undef,splatmask),undef) fold. We should be able to merge these into one using SelectionDAG::isSplatValue, but we'll need to match the shuffle's undef handling first.

This also exposed an issue in SelectionDAG::isSplatValue which was incorrectly propagating the undef mask across a bitcast (it was trying to just bail with a APInt::isSubsetOf if it found any undefs but that was actually the wrong way around so didn't fire for partial undef cases).
2022-06-07 16:42:24 +01:00
Muhammad Omair Javaid 7daa9a9b40 [LLDB] Remove decorator from XPASSes AArch64/Windows
This patch remove XFAIL decorator from tests which as passing on AArch64
Windows. This is tested on surface pro x using tot llvm and clang 14.0.3
as compiler with visual studio 2019 x86_arm64 environment.
2022-06-07 19:30:26 +04:00
Muhammad Omair Javaid d3d9bbd104 [LLDB] Fix TestBase.generateSource for AArch64/Windows
This patch adds a minor fix in lldbtest.py TestBase.generateSource
function. Generated Python source with directory paths was not being
escaped properly. This fix makes sure we treat dir path as raw string.
2022-06-07 19:25:35 +04:00
Craig Topper d73684e223 [LoopFlatten] Fix crash if the inner loop trip count comes from a sext instruction.
If we look through a truncate in matchLinearIVUser, it's possible
we find a sext/zext instruction that didn't come from widening.
This will fail the MatchedItCount->getType() == InnerInductionPHI->getType()
assertion.

Fix this by checking that we did not look through a truncate already.

Reviewed By: SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D127149
2022-06-07 08:21:21 -07:00
Craig Topper fdd5843572 [LoopFlatten] Replace unchecked dyn_cast with cast.
Spotted while reading through the code.

Reviewed By: SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D127146
2022-06-07 08:21:00 -07:00