Douglas Yung [Tue, 7 Jun 2022 21:58:10 +0000 (14:58 -0700)]
Revert "[clang-diff] Fix assertion error when dealing with wide strings"
This reverts commit
e80748ff8840a10bd7c7336eb5e98664480ba1ba.
This was causing a test failure on a buildbot: https://lab.llvm.org/buildbot/#/builders/139/builds/22964
Paul Kirth [Mon, 6 Jun 2022 18:14:20 +0000 (18:14 +0000)]
[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
Wolfgang Pieb [Mon, 16 May 2022 18:22:46 +0000 (11:22 -0700)]
[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
Jason Molenda [Tue, 7 Jun 2022 21:31:56 +0000 (14:31 -0700)]
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
bef4da4a6aef8196f007f44e3e9c8e3419ffb623
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.
Aart Bik [Tue, 7 Jun 2022 00:27:27 +0000 (17:27 -0700)]
[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
Vitaly Buka [Tue, 7 Jun 2022 16:37:53 +0000 (09:37 -0700)]
[NFC] Exctract getNoSanitizeMask lambda
Vitaly Buka [Tue, 7 Jun 2022 04:43:47 +0000 (21:43 -0700)]
[NFC] Move part of SanitizerMetadata into private method
Mitch Phillips [Tue, 7 Jun 2022 04:21:15 +0000 (21:21 -0700)]
[NFC] Clang-format parts of D126929 and D126100
Mitch Phillips [Tue, 7 Jun 2022 04:18:33 +0000 (21:18 -0700)]
[NFC][CodeGen] Rename method
Extracted from D84652.
Christopher Bate [Tue, 7 Jun 2022 20:42:42 +0000 (14:42 -0600)]
Revert "[mlir][vector] Allow unroll of contraction in arbitrary order"
Reverts commit
1469ebf8382107e0344173f362b690d19e24029d (original commit)
Reverts commit
a392a39f75af586e3d3cd046a8361939277e067f (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.
Jason Molenda [Tue, 7 Jun 2022 20:27:16 +0000 (13:27 -0700)]
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
Louis Dionne [Fri, 1 Apr 2022 20:38:30 +0000 (16:38 -0400)]
[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
Philip Reames [Tue, 7 Jun 2022 20:27:13 +0000 (13:27 -0700)]
[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.
Philip Reames [Tue, 7 Jun 2022 20:09:48 +0000 (13:09 -0700)]
Revert "[MemDep][NFCI] Remove redundant dyn_cast, replace with cast"
This reverts commit
180d3f251d1ad5473705d3f00e6d426b5f8162e6. 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.
Sunho Kim [Tue, 7 Jun 2022 19:29:12 +0000 (12:29 -0700)]
[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
Florian Hahn [Tue, 7 Jun 2022 20:00:49 +0000 (21:00 +0100)]
[VPlan] Handle VPInst without underlying instr in VPInterleavedAccess.
This violation is hidden while `cast` is missing an isa assertion after
D123901.
Joseph Huber [Mon, 6 Jun 2022 17:08:01 +0000 (13:08 -0400)]
[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.
Joseph Huber [Sat, 4 Jun 2022 20:56:45 +0000 (16:56 -0400)]
[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.
Aaron Ballman [Tue, 7 Jun 2022 19:52:28 +0000 (15:52 -0400)]
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.
Philip Reames [Tue, 7 Jun 2022 19:23:43 +0000 (12:23 -0700)]
Revert "[LLVM][Casting.h] Add trivial self-cast"
This reverts commit
0809f63826d36c89574d6ac056ebf46a4b6f29ff. 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); }
Martin Sebor [Tue, 7 Jun 2022 19:45:10 +0000 (13:45 -0600)]
[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
Martin Sebor [Tue, 7 Jun 2022 18:54:31 +0000 (12:54 -0600)]
[InstCombine] Add substr helper function (NFC).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D126515
Sam Estep [Tue, 7 Jun 2022 19:17:00 +0000 (19:17 +0000)]
[clang][dataflow][NFC] Fix filename typos in tests
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D127008
Joe Nash [Wed, 18 May 2022 19:01:20 +0000 (15:01 -0400)]
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
Derek Schuff [Mon, 6 Jun 2022 22:42:24 +0000 (15:42 -0700)]
[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
Sunho Kim [Tue, 7 Jun 2022 18:39:05 +0000 (11:39 -0700)]
[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
William Huang [Tue, 7 Jun 2022 18:48:24 +0000 (18:48 +0000)]
[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
Reid Kleckner [Fri, 3 Jun 2022 17:27:02 +0000 (10:27 -0700)]
[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
Reid Kleckner [Fri, 3 Jun 2022 23:21:42 +0000 (16:21 -0700)]
[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.
Erich Keane [Tue, 7 Jun 2022 18:29:03 +0000 (11:29 -0700)]
[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.
Philip Reames [Tue, 7 Jun 2022 14:43:00 +0000 (07:43 -0700)]
[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.
Kaining Zhong [Tue, 7 Jun 2022 17:39:46 +0000 (19:39 +0200)]
[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
Jay Foad [Tue, 7 Jun 2022 09:41:50 +0000 (10:41 +0100)]
[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
David Green [Tue, 7 Jun 2022 17:57:59 +0000 (18:57 +0100)]
[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
Vince Bridgers [Mon, 6 Jun 2022 12:23:08 +0000 (08:23 -0400)]
[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
Sanjay Patel [Tue, 7 Jun 2022 16:42:12 +0000 (12:42 -0400)]
[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
Sanjay Patel [Tue, 7 Jun 2022 12:54:38 +0000 (08:54 -0400)]
[InstCombine] add vector tests for shift-shift; NFC
D127122
Groverkss [Tue, 7 Jun 2022 17:19:34 +0000 (22:49 +0530)]
[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
Alan Zhao [Thu, 2 Jun 2022 23:42:37 +0000 (19:42 -0400)]
[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
Mark de Wever [Tue, 31 May 2022 16:58:54 +0000 (18:58 +0200)]
[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
Philip Reames [Tue, 7 Jun 2022 16:54:23 +0000 (09:54 -0700)]
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.
Mark de Wever [Mon, 30 May 2022 16:34:15 +0000 (18:34 +0200)]
[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
Mark de Wever [Thu, 2 Jun 2022 06:16:40 +0000 (08:16 +0200)]
[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
David Penry [Tue, 29 Mar 2022 17:13:55 +0000 (10:13 -0700)]
[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
Benjamin Kramer [Tue, 7 Jun 2022 16:17:40 +0000 (18:17 +0200)]
[format] Fix an uninitialized variable
parseBlock may decide to leave it unchanged. Found by msan.
Joseph Huber [Tue, 31 May 2022 14:08:25 +0000 (10:08 -0400)]
[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
Simon Pilgrim [Tue, 7 Jun 2022 15:42:15 +0000 (16:42 +0100)]
[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).
Muhammad Omair Javaid [Tue, 7 Jun 2022 15:30:24 +0000 (19:30 +0400)]
[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.
Muhammad Omair Javaid [Tue, 7 Jun 2022 13:47:50 +0000 (17:47 +0400)]
[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.
Craig Topper [Tue, 7 Jun 2022 15:21:20 +0000 (08:21 -0700)]
[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
Craig Topper [Tue, 7 Jun 2022 15:20:59 +0000 (08:20 -0700)]
[LoopFlatten] Replace unchecked dyn_cast with cast.
Spotted while reading through the code.
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D127146
Craig Topper [Tue, 7 Jun 2022 15:07:49 +0000 (08:07 -0700)]
[RISCV] Scalarize gather/scatter on RV64 with Zve32* extension.
i64 indices aren't supported on Zve32*. Scalarize gathers to prevent
generating illegal instructions.
Since InstCombine will aggressively canonicalize GEP indices to
pointer size, we're pretty much always going to have an i64 index.
Trying to predict when SelectionDAG will find a smaller index from
the TTI hook used by the ScalarizeMaskedMemIntrinPass seems fragile.
To optimize this we probably need an IR pass to rewrite it earlier.
Test RUN lines have also been added to make sure the strided load/store
optimization still works.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D127179
Alexey Bataev [Tue, 7 Jun 2022 15:02:14 +0000 (08:02 -0700)]
[SLP]Add a test for geps with non-const indeces in scatter vectorize
nodes, NFC.
LLVM GN Syncbot [Tue, 7 Jun 2022 14:38:58 +0000 (14:38 +0000)]
[gn build] Port
47c8ec811f78
David Truby [Mon, 6 Jun 2022 11:15:38 +0000 (12:15 +0100)]
[clang][AArch64][SVE] Improve diagnostics for SVE operators
This patch corrects some diagnostics for the SVE sizeless vector
operators, including correctly diagnosing when the vectors are
different sizes.
Differential Revision: https://reviews.llvm.org/D126377
Benjamin Kramer [Tue, 7 Jun 2022 14:29:06 +0000 (16:29 +0200)]
[DX][ObjYAML] Zero out unused fields that get written to the output file
Found by msan
Matt Arsenault [Mon, 6 Jun 2022 13:17:55 +0000 (09:17 -0400)]
llvm-reduce: Add -abort-on-invalid-reduction to MIR tests
Ideally reductions would never produce invalid IR, and we shouldn't
regress on cases that already avoid doing so.
Matt Arsenault [Mon, 6 Jun 2022 13:21:02 +0000 (09:21 -0400)]
llvm-reduce: Don't set generic instruction operands to undef
The intention is that these should never have undef operands. It turns
out the restriction the verifier enforces is too lax. The verifier
enforces that registers without a register class cannot be undef, but
it's valid to use a register with a register class and type. The
verifier needs to change to be based on the opcode.
Matt Arsenault [Fri, 22 Apr 2022 15:44:37 +0000 (11:44 -0400)]
llvm-reduce: Add pass to remove register uses
Try to delete implicit uses, and add undef flags to explicit ones.
Jay Foad [Mon, 6 Jun 2022 14:51:18 +0000 (15:51 +0100)]
[AMDGPU] Add support for the .reloc directive
Differential Revision: https://reviews.llvm.org/D127117
Matt Arsenault [Sat, 16 Apr 2022 02:35:53 +0000 (22:35 -0400)]
llvm-reduce: Add cloning of target MachineFunctionInfo
MIR support is totally unusable for AMDGPU without this, since the set
of reserved registers is set from fields here.
Add a clone method to MachineFunctionInfo. This is a subtle variant of
the copy constructor that is required if there are any MIR constructs
that use pointers. Specifically, at minimum fields that reference
MachineBasicBlocks or the MachineFunction need to be adjusted to the
values in the new function.
Matt Arsenault [Mon, 18 Apr 2022 15:01:19 +0000 (11:01 -0400)]
AMDGPU: Make PSV instances static members
Louis Dionne [Tue, 7 Jun 2022 14:01:01 +0000 (10:01 -0400)]
[libc++] Forgot to bump the CI timeout everywhere
Louis Dionne [Tue, 7 Jun 2022 14:00:25 +0000 (10:00 -0400)]
[libc++] Bump timeout to avoid spurious failures on AIX
Matt Arsenault [Sat, 4 Jun 2022 22:31:18 +0000 (18:31 -0400)]
llvm-reduce: Fix crashes on unreachable blocks for MIR instructions
Matt Arsenault [Wed, 13 Apr 2022 21:26:42 +0000 (17:26 -0400)]
llvm-reduce: Don't assert on functions which don't track liveness
Use the query that doesn't assert if TracksLiveness isn't set, which
needs to always be available. We also need to start printing liveins
regardless of TracksLiveness.
Matt Arsenault [Mon, 6 Jun 2022 22:27:11 +0000 (18:27 -0400)]
AMDGPU: Fix not checking liveness in test
Guillaume Chatelet [Fri, 3 Jun 2022 16:37:45 +0000 (16:37 +0000)]
[Alignment][NFC] Remove usage of MemSDNode::getAlignment
I can't remove the function just yet as it is used in the generated .inc files.
I would also like to provide a way to compare alignment with TypeSize since it came up a few times.
Differential Revision: https://reviews.llvm.org/D126910
Simon Pilgrim [Tue, 7 Jun 2022 13:27:06 +0000 (14:27 +0100)]
[X86] getFauxShuffleMask - add VSELECT/BLENDV handling
First step towards enabling shuffle combining starting from VSELECT/BLENDV nodes - this should eventually help improve the codegen reported at Issue #54819
Simon Pilgrim [Tue, 7 Jun 2022 13:17:23 +0000 (14:17 +0100)]
[X86] x86-interleaved-access.ll - use nounwind to remove cfi noise from tests
Pengxuan Zheng [Tue, 7 Jun 2022 13:42:22 +0000 (06:42 -0700)]
[clang-cl] Add support for /kernel
MSVC defines _KERNEL_MODE when /kernel is passed.
Also, /kernel disables RTTI and C++ exception handling.
https://docs.microsoft.com/en-us/cpp/build/reference/kernel-create-kernel-mode-binary?view=msvc-170
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D126719
David Green [Tue, 7 Jun 2022 13:36:04 +0000 (14:36 +0100)]
[ARM] Fix MVE getShuffleCost legalized type check
The MVE shuffle costing for VREV instructions was making incorrect
assumptions as to legalized vector types remaining as vectors. Add a
quick check to ensure they are indeed vectors before attempting to get
the number of elements.
David Green [Tue, 7 Jun 2022 12:55:53 +0000 (13:55 +0100)]
[AArch64] Regenerate arm64-shifted-sext.ll and add a test from #55833. NFC
Simon Pilgrim [Tue, 7 Jun 2022 11:38:05 +0000 (12:38 +0100)]
[X86] X86SpeculativeLoadHardening.cpp - pass DebugLoc by const reference not value.
Simon Pilgrim [Tue, 7 Jun 2022 11:36:30 +0000 (12:36 +0100)]
[X86] foldMaskedMergeImpl - pass SDLoc by const reference not value.
Guillaume Chatelet [Tue, 7 Jun 2022 11:20:44 +0000 (11:20 +0000)]
Fix change of variable name in test
J. Ryan Stinnett [Wed, 1 Jun 2022 10:04:46 +0000 (11:04 +0100)]
[DebugInfo][Docs] Improve code formatting in instruction referencing doc
This adds code blocks and inline code formatting to improve the readability of
the instruction referencing doc.
Reviewed By: Orlando
Differential Revision: https://reviews.llvm.org/D126767
Martin Boehme [Tue, 7 Jun 2022 11:03:56 +0000 (13:03 +0200)]
[clang-tidy] Fix syntax error in release notes.
Introduced by
https://github.com/llvm/llvm-project/commit/
1b664460fa4cb507e2af87c48cd269964f3ad747
Sorry for the breakage.
Gabor Marton [Thu, 2 Jun 2022 13:05:45 +0000 (15:05 +0200)]
[analyzer] Remove NotifyAssumeClients
Depends on D126560.
Differential Revision: https://reviews.llvm.org/D126878
Martin Boehme [Tue, 7 Jun 2022 09:00:24 +0000 (11:00 +0200)]
[clang-tidy] `bugprone-use-after-move`: Don't warn on self-moves.
Reviewed By: sammccall, njames93
Differential Revision: https://reviews.llvm.org/D126853
Gabor Marton [Tue, 7 Jun 2022 08:29:54 +0000 (10:29 +0200)]
[analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl
Aligned with the measures we had in D124674, this condition seems to be
unlikely.
Nevertheless, I've made some new measurments with stats just for this,
and data confirms this is indeed unlikely.
Differential Revision: https://reviews.llvm.org/D127190
Yuki Okushi [Sun, 5 Jun 2022 03:30:50 +0000 (12:30 +0900)]
[clang] Remove some `U+C2AD`s in `__cpp_multidimensional_subscript`
The `Builder.defineMacro("__cpp_multidimensional_subscript", "202110L");` line has
some `U+C2AD`s that shouldn't necessary here. So removed them.
Differential Revision: https://reviews.llvm.org/D127066
David Sherwood [Tue, 7 Jun 2022 10:00:33 +0000 (11:00 +0100)]
[NFC][InstCombine] Add two more tests to select-binop-foldable-floating-point.ll
Pre-commit some tests as part of https://reviews.llvm.org/D126774
Kiran Chandramohan [Tue, 7 Jun 2022 09:57:38 +0000 (09:57 +0000)]
[Flang] Add flag dependent code to execute the loop-body atleast once
Given the flag `--always-execute-loop-body` the compiler emits code
to execute the body of the loop atleast once.
Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.
Reviewed By: awarzynski, schweitz
Differential Revision: https://reviews.llvm.org/D127128
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Sameeran Joshi <sameeranjayant.joshi@amd.com>
owenca [Fri, 3 Jun 2022 21:19:00 +0000 (14:19 -0700)]
[clang-format][NFC] Clean up the unwrapped line parser
Change the signatures of parseBlock(), parseLevel(), and
parseStructuralElement() to support combining else and if when
removing braces. See #55663.
Differential Revision: https://reviews.llvm.org/D127005
Simon Pilgrim [Tue, 7 Jun 2022 09:50:21 +0000 (10:50 +0100)]
[X86] LowerGC_TRANSITION - remove redundant SDLoc().
Kiran Chandramohan [Tue, 7 Jun 2022 09:44:20 +0000 (09:44 +0000)]
[Flang,MLIR,OpenMP] Fix a few tests that were not converting to LLVM
A few OpenMP tests were retaining the FIR operands even after running
the LLVM conversion pass. To fix these tests the legality checkes for
OpenMP conversion are made stricter to include operands and results.
The Flush, Single and Sections operations are added to conversions or
legality checks. The RegionLessOpConversion is appropriately renamed
to clarify that it works only for operations with Variable operands.
The operands of the flush operation are changed to match those of
Variable Operands.
Fix for an OpenMP issue mentioned in
https://github.com/llvm/llvm-project/issues/55210.
Reviewed By: shraiysh, peixin, awarzynski
Differential Revision: https://reviews.llvm.org/D127092
Alex Zinenko [Tue, 7 Jun 2022 09:51:24 +0000 (11:51 +0200)]
[mlir] fix documentation format in SCF
Four leading spaces are interpreted as a code block in markdown. Unless
used consistently in ODS op description, they cannot be stripped away by
the tablegen backend, which results in malformed markdown being
generated.
Guillaume Chatelet [Tue, 7 Jun 2022 09:49:36 +0000 (09:49 +0000)]
Cleanup sema checking for buitlin_memcpy_inline
David Sherwood [Wed, 1 Jun 2022 13:01:37 +0000 (14:01 +0100)]
[LoopVectorize] Add FastMathFlags to the select used for reductions with tail-folding
Based on reviewer comments on https://reviews.llvm.org/D126692 I've
added FastMathFlags to the select instruction used when tail-folding
with reductions. These flags can then be used by InstCombine to
decide upon the most optimal floating point identity value for
fadd/fsub. Doing so unlocks further optimisations, such as folding
selects into masked loads.
Differential Revision: https://reviews.llvm.org/D126778
Alexander Batashev [Tue, 7 Jun 2022 09:13:59 +0000 (12:13 +0300)]
[mlir][spirv] Correctly deduce PhysicalStorageBuffer64 addressing model
According to the SPIR-V specification[1], PhysicalStorageBuffer storage
class can only be used iff addressing model is PhysicalStorageBuffer64.
[1]: https://www.khronos.org/registry/SPIR-V/specs/unified1/SPIRV.html#_addressing_model
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D127067
Jay Foad [Wed, 6 Oct 2021 11:14:55 +0000 (12:14 +0100)]
[APInt] Remove truncOrSelf, zextOrSelf and sextOrSelf
Differential Revision: https://reviews.llvm.org/D125559
Haojian Wu [Tue, 7 Jun 2022 08:51:45 +0000 (10:51 +0200)]
[pseudo]Pull out the operator< test, NFC
Fix the review comment in https://reviews.llvm.org/D125479.
Haojian Wu [Tue, 7 Jun 2022 08:44:30 +0000 (10:44 +0200)]
[pseudo] Fix the incorrect parameters-and-qualifiers rule.
The parenthese body should be parameter-declaration-clause, rather
than parameter-declaration-list.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D125479
Muhammad Omair Javaid [Tue, 7 Jun 2022 08:09:13 +0000 (12:09 +0400)]
[LLDB] Avoid using -fno-builtin for building API tests
This patch removes use of -fno-builtin flag for building LLDB API
tests.
LLDB API tests are built using Makefile.rules where we were using
-fno-builtin flag to avoid gcc intrinsic optimization conflicting
with Android runtime in past.
Now that we no longer use gcc for building testsuite and compiling
LLDB API tests on AArch64/Windows require clang to optimize certain
calls like _setjmp to setjmpex as former is not implemented by
AArch64 windows runtime.
Haojian Wu [Fri, 3 Jun 2022 20:01:36 +0000 (22:01 +0200)]
[pseudo] Fix the type-parameter rule.
The IDENTIFIER should be optional.
Differential Revision: https://reviews.llvm.org/D126998
Haojian Wu [Fri, 3 Jun 2022 19:47:11 +0000 (21:47 +0200)]
[pseudo] Handle the language predefined identifier __func__
The clang lexer lexes it as a dedicated token kind (rather than
identifier), we extend the grammar to handle it.
Differential Revision: https://reviews.llvm.org/D126996
lorenzo chelini [Thu, 2 Jun 2022 13:56:01 +0000 (15:56 +0200)]
[MLIR][LLVMIR] Add round intrinsic
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D126879
Haojian Wu [Fri, 3 Jun 2022 19:13:26 +0000 (21:13 +0200)]
[pseudo] Fix noptr-abstract-declarator rule.
The const-expression in the [] can be empty.
Differential Revision: https://reviews.llvm.org/D126992
Nikita Popov [Mon, 30 May 2022 13:05:04 +0000 (15:05 +0200)]
[SCCP] Don't mark ranges from branch conditions as potentially undef
Now that transforms introducing branch on poison have been removed,
we can stop marking ranges that have been derived from branch
conditions as containing undef. The existing comment explains why
this is legal. I've checked that alive2 is happy with SCCP tests
after this change.
Differential Revision: https://reviews.llvm.org/D126647