Nikita Popov [Sat, 13 Mar 2021 14:59:09 +0000 (15:59 +0100)]
[SROA] Regenerate test checks (NFC)
Martin Storsjö [Thu, 11 Mar 2021 20:17:48 +0000 (22:17 +0200)]
[compiler-rt] Use arm-specific builtins sources for arm/mingw builds
Previously, that configuration only used the generic sources, in
addition to the couple specifically chosen arm/mingw files.
Differential Revision: https://reviews.llvm.org/D98547
Nikita Popov [Sat, 13 Mar 2021 19:28:53 +0000 (20:28 +0100)]
[MemCpyOpt] Handle read from lifetime.start with offset
This fixes a regression from the MemDep-based implementation:
MemDep completely ignores lifetime.start intrinsics that aren't
MustAlias -- this is probably unsound, but it does mean that the
MemDep based implementation successfully eliminated memcpy's from
lifetime.start if the memcpy happens at an offset, rather than
the base address of the alloca.
Add a special case for the case where the lifetime.start spans the
whole alloca (which is pretty much the only kind of lifetime.start
that frontends ever emit), as we don't need to figure out our exact
aliasing relationship in that case, the whole alloca is dead prior
to the call.
If this doesn't cover all practically relevant cases, then it
would be possible to make use of the recently added PartialAlias
clobber offsets to make this more precise.
Nikita Popov [Sat, 13 Mar 2021 17:51:46 +0000 (18:51 +0100)]
[MemCpyOpt] Add additional tests for memcpy of undef (NFC)
Craig Topper [Sat, 13 Mar 2021 17:39:33 +0000 (09:39 -0800)]
[DAGCombiner] Optimize 1-bit smulo to AND+SETNE.
A 1-bit smulo overflows is both inputs are -1 since the result
should be +1 which can't be represented in a signed 1 bit value.
We can detect this with an AND and a setcc. The multiply result
can also use the same AND.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D97634
Stefan Gränitz [Sat, 13 Mar 2021 15:25:41 +0000 (16:25 +0100)]
[Orc] Deallocate debug objects properly when removing resources from DebugObjectManagerPlugin
kuterd [Sat, 13 Mar 2021 14:46:38 +0000 (17:46 +0300)]
[Attributor][fix] Remove problematic EXPENSIVE_CHECK
Remove the check that is causing compilation issues in
some build configurations.
Sanjay Patel [Sat, 13 Mar 2021 13:26:27 +0000 (08:26 -0500)]
[InstCombine] avoid creating an extra instruction in zext fold and possible inf-loop
The structure of this fold is suspect vs. most of instcombine
because it creates instructions and tries to delete them
immediately after.
If we don't have the operand types for the icmps, then we are
not behaving as assumed. And as shown in PR49475, we can inf-loop.
Roman Lebedev [Sat, 13 Mar 2021 06:12:26 +0000 (09:12 +0300)]
Reland [SCEV] Improve modelling for (null) pointer constants
This reverts commit
329aeb5db43f5e69df038fb20d2def77fe6f8595,
and relands commit
61f006ac655431bd44b9e089f74c73bec0c1a48c.
This is a continuation of D89456.
As it was suggested there, now that SCEV models `PtrToInt`,
we can try to improve SCEV's pointer handling.
In particular, i believe, i will need this in the future
to further fix `SCEVAddExpr`operation type handling.
This removes special handling of `ConstantPointerNull`
from `ScalarEvolution::createSCEV()`, and add constant folding
into `ScalarEvolution::getPtrToIntExpr()`.
This way, `null` constants stay as such in SCEV's,
but gracefully become zero integers when asked.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98147
Roman Lebedev [Sat, 13 Mar 2021 12:11:12 +0000 (15:11 +0300)]
[LSR] Don't try to fixup uses in 'EH pad' instructions
The added test case crashes before this fix:
```
opt: /repositories/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5172: BasicBlock::iterator (anonymous namespace)::LSRInstance::AdjustInsertPositionForExpand(BasicBlock::iterator, const (anonymous namespace)::LSRFixup &, const (anonymous namespace)::LSRUse &, llvm::SCEVExpander &) const: Assertion `!isa<PHINode>(LowestIP) && !LowestIP->isEHPad() && !isa<DbgInfoIntrinsic>(LowestIP) && "Insertion point must be a normal instruction"' failed.
```
This is fully analogous to the previous commit,
with the pointer constant replaced to be something non-null.
The comparison here can be strength-reduced,
but the second operand of the comparison happens to be identical
to the constant pointer in the `catch` case of `landingpad`.
While LSRInstance::CollectLoopInvariantFixupsAndFormulae()
already gave up on uses in blocks ending up with EH pads,
it didn't consider this case.
Eventually, `LSRInstance::AdjustInsertPositionForExpand()`
will be called, but the original insertion point it will get
is the user instruction itself, and it doesn't want to
deal with EH pads, and asserts as much.
It would seem that this basically never happens in-the-wild,
otherwise it would have been reported already,
so it seems safe to take the cautious approach,
and just not deal with such users.
Roman Lebedev [Sat, 13 Mar 2021 08:27:48 +0000 (11:27 +0300)]
[NFC][LSR] Add test case that from https://reviews.llvm.org/D98147#2623549
With that patch, this test fails with an assertion
```
opt: /repositories/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5169: BasicBlock::iterator (anonymous namespace)::LSRInstance::AdjustInsertPositionForExpand(BasicBlock::iterator, const (anonymous namespace)::LSRFixup &, const (anonymous namespace)::LSRUse &, llvm::SCEVExpander &) const: Assertion `!isa<PHINode>(LowestIP) && !LowestIP->isEHPad() && !isa<DbgInfoIntrinsic>(LowestIP) && "Insertion point must be a normal instruction"' failed.
```
George Rokos [Wed, 3 Mar 2021 19:48:32 +0000 (11:48 -0800)]
[libomptarget] Add allocator support for target memory
This patch adds the infrastructure for allocator support for target memory.
Three allocators are introduced for device, host and shared memory.
The corresponding API functions have the llvm_ prefix temporarily, until they become part of the OpenMP standard.
Differential Revision: https://reviews.llvm.org/D97883
Nikita Popov [Sat, 13 Mar 2021 10:37:31 +0000 (11:37 +0100)]
[MemCpyOpt] Use AA to check for MustAlias between memset and memcpy
Rather than checking for simple equality, check for MustAlias, as
we do in other transforms. This catches equivalent GEPs.
Nikita Popov [Sat, 13 Mar 2021 10:34:58 +0000 (11:34 +0100)]
[MemCpyOpt] Don't generate zero-size memset
If a memset destination is overwritten by a memcpy and the sizes
are exactly the same, then the memset is simply dead. We can
directly drop it, instead of replacing it with a memset of zero
size, which is particularly ugly for the case of a dynamic size.
Nikita Popov [Sat, 13 Mar 2021 10:32:24 +0000 (11:32 +0100)]
[MemCpyOpt] Add additional tests for memset+memcpy overwrite (NFC)
Nikita Popov [Fri, 12 Mar 2021 22:03:36 +0000 (23:03 +0100)]
[MemorySSA] Don't bail on phi starting access
When calling getClobberingMemoryAccess() with MemoryLocation on a
MemoryPHI starting access, the walker currently immediately bails
and returns the starting access. This makes sense for the API that
does not accept a location (as we wouldn't know what clobber we
should be checking for), but doesn't make sense for the
MemoryLocation-based API. This means that it can't look through
a MemoryPHI if it's the starting access, but can if there is one
more non-clobbering def in between. This patch removes the limitation.
Differential Revision: https://reviews.llvm.org/D98557
luxufan [Sat, 20 Feb 2021 06:02:56 +0000 (14:02 +0800)]
change rvv frame layout
This patch change the rvv frame layout that proposed in D94465. In patch D94465, In the eliminateFrameIndex function,
to eliminate the rvv frame index, create temp virtual register is needed. This virtual register should be scavenged by class
RegsiterScavenger. If the machine function has other unused registers, there is no problem. But if there isn't unused registers,
we need a emergency spill slot. Because of the emergency spill slot belongs to the scalar local variables field, to access emergency
spill slot, we need a temp virtual register again. This makes the compiler report the "Incomplete scavenging after 2nd pass" error.
So I change the rvv frame layout as follows:
```
|--------------------------------------|
| arguments passed on the stack |
|--------------------------------------|<--- fp
| callee saved registers |
|--------------------------------------|
| rvv vector objects(local variables |
| and outgoing arguments |
|--------------------------------------|
| realignment field |
|--------------------------------------|
| scalar local variable(also contains|
| emergency spill slot) |
|--------------------------------------|<--- bp
| variable-sized local variables |
|--------------------------------------|<--- sp
```
Differential Revision: https://reviews.llvm.org/D97111
luxufan [Mon, 22 Feb 2021 05:46:46 +0000 (13:46 +0800)]
[RISCV] Remove redundancy -mattr=+d in test file
Differential Revision: https://reviews.llvm.org/D97177
Roman Lebedev [Sat, 13 Mar 2021 06:10:28 +0000 (09:10 +0300)]
Temporairly evert "[SCEV] Improve modelling for (null) pointer constants"
This appears to have broken ubsan bot:
https://lab.llvm.org/buildbot/#/builders/85/builds/3062
https://reviews.llvm.org/D98147#2623549
It looks like LSR needs some kind of a change around insertion point handling.
Reverting until i have a fix.
This reverts commit
61f006ac655431bd44b9e089f74c73bec0c1a48c.
George Balatsouras [Thu, 11 Mar 2021 22:22:15 +0000 (14:22 -0800)]
[dfsan] Update shadow-args-zext.ll test
Remove hard-coded shadow width references.
Reviewed By: stephan.yichao.zhao
Differential Revision: https://reviews.llvm.org/D98454
xling-Liao [Fri, 12 Mar 2021 21:19:43 +0000 (15:19 -0600)]
[NFC] Adjust SmallVector.h header to workaround XL build compiler issue
In order to prevent further building issues related to the usage of SmallVector
in other compilation unit, this patch adjusts the llvm.h header as a workaround
instead.
Besides, this patch reverts previous workarounds:
1. Revert "[NFC] Use llvm::SmallVector to workaround XL compiler problem on AIX"
This reverts commit
561fb7f60ab631e712c3fb6bbeb47061222c6818.
2.Revert "[clang][cli] Fix build failure in CompilerInvocation"
This reverts commit
8dc70bdcd0fe4efb65876dce0144d9c3386a2f07.
Differential Revision: https://reviews.llvm.org/D98552
Lang Hames [Sat, 13 Mar 2021 03:13:42 +0000 (19:13 -0800)]
[ORC] Fix some comments in the LLJITWithObjectLinkingLayerPlugin example.
Lang Hames [Sat, 13 Mar 2021 01:02:01 +0000 (17:02 -0800)]
[JITLink][ORC] Make the LinkGraph available to modifyPassConfig.
This makes the target triple, graph name, and full graph content available
when making decisions about how to populate the linker pass pipeline.
Also updates the LLJITWithObjectLinkingLayerPlugin example to show more
API use, including use of the API changes in this patch.
Petr Hosek [Sat, 13 Mar 2021 02:29:20 +0000 (18:29 -0800)]
[Fuchsia] Add check-polly to CLANG_BOOTSTRAP_TARGETS
This is necessary so we can run Polly tests in 2 stage build.
Differential Revision: https://reviews.llvm.org/D98572
peter klausler [Sat, 13 Mar 2021 01:17:00 +0000 (17:17 -0800)]
[flang] Fix static build of flang
An older version of a function (Fortran::semantics::FindFunctionResult) was
left in flang/lib/Semantics/tools.cpp, and this breaks the static library
build due to a conflict with the intended final version in another
file and library. Remove the old code.
Differential Revision: https://reviews.llvm.org/D98568
Giorgis Georgakoudis [Sat, 20 Feb 2021 04:22:14 +0000 (20:22 -0800)]
Replace func name with regex for update test scripts
The patch adds an argument to update test scripts, such as update_cc_test_checks, for replacing a function name matching a regex. This functionality is needed to match generated function signatures that include file hashes. Example:
The function signature for the following function:
`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`
with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will become:
`CHECK-LABEL: @{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D97107
Jason Molenda [Sat, 13 Mar 2021 01:18:56 +0000 (17:18 -0800)]
Don't load kexts/kernels without dSYMs present
One of the backup schemes I use for finding kexts and kernels
on the local filesystem is to load a solitary binary when I don't
find any with a dSYM. This usually is a more confusing behavior
than helpful; people expect to get no binary loaded, or a binary
with debug information. This change stops loading kexts and
kernels that do not have an associated dSYM.
rdar://
74291888
Giorgis Georgakoudis [Sat, 13 Mar 2021 01:20:00 +0000 (17:20 -0800)]
Revert "Replace func name with regex for update test scripts"
This reverts commit
5eaf70afb5f8ae6789587e60d51c60f56caf18b0.
Giorgis Georgakoudis [Sat, 20 Feb 2021 04:22:14 +0000 (20:22 -0800)]
Replace func name with regex for update test scripts
The patch adds an argument to update test scripts, such as update_cc_test_checks, for replacing a function name matching a regex. This functionality is needed to match generated function signatures that include file hashes. Example:
The function signature for the following function:
`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`
with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will become:
`CHECK-LABEL: @{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D97107
Aart Bik [Fri, 12 Mar 2021 22:56:23 +0000 (14:56 -0800)]
[mlir][sparse] disable nonunit stride dense vectorization
This is a temporary work-around to get our all-annotations-all-flags
stress testing effort run clean. In the long run, we want to provide
efficient implementations of strided loads and stores though
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D98563
Matheus Izvekov [Sat, 6 Mar 2021 01:50:36 +0000 (02:50 +0100)]
[clang] Fix ICE on invalid type parameters for concepts
See PR48593.
Constraints with invalid type parameters were causing a null pointer
dereference.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D98095
Matheus Izvekov [Tue, 9 Mar 2021 02:02:09 +0000 (03:02 +0100)]
[clang] Improve diagnostics on implicitly deleted defaulted comparisons
This patch just makes the error message clearer by reinforcing the cause
was a lack of viable **three-way** comparison function for the
**complete object**.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D97990
peter klausler [Fri, 12 Mar 2021 21:51:33 +0000 (13:51 -0800)]
[flang] Ensure pointer function results are acceptable variables
Fortran permits a reference to a function whose result is a pointer
to be used as a definable variable in any context where a
designator could appear. This patch wrings out remaining bugs
with such usage and adds more testing.
The utility predicate IsProcedurePointer(expr) had a misleading
name which has been corrected to IsProcedurePointerTarget(expr).
Differential Revision: https://reviews.llvm.org/D98555
Jez Ng [Fri, 12 Mar 2021 23:43:33 +0000 (18:43 -0500)]
[lld-macho] Make range-check.s test more tolerant
Summary: The exact out-of-range value seems to differ by 8 bytes on the
buildbots compared to my local machine. I'm guessing it has something to
do with what inputs we are getting from llvm-mc. Not sure why, but I
don't think it's super important -- let's just ignore the number, the
out-of-range message is the important thing here
peter klausler [Fri, 12 Mar 2021 21:33:50 +0000 (13:33 -0800)]
[flang] Update DE/ALLOCATE statement runtime message processing
Make error message descriptors on runtime DE/ALLOCATE API calls constant.
Fix a bug in error message truncation/padding.
Differential Revision: https://reviews.llvm.org/D98551
Fangrui Song [Fri, 12 Mar 2021 23:10:12 +0000 (15:10 -0800)]
[gcov] Delete ancient MSVC workaround
Fangrui Song [Fri, 12 Mar 2021 23:07:58 +0000 (15:07 -0800)]
[gcov] Delete FreeBSD<10 (reached end of life for years) workaround
Stanislav Mekhanoshin [Fri, 12 Mar 2021 21:28:51 +0000 (13:28 -0800)]
[AMDGPU] Fix getAlignedAGPRClassID
Not all register classes were listed.
Differential Revision: https://reviews.llvm.org/D98550
Matt Morehouse [Fri, 12 Mar 2021 22:36:57 +0000 (14:36 -0800)]
[libFuzzer] Use macro instead of __attribute__.
This should fix the Windows buildbot errors.
Jez Ng [Fri, 12 Mar 2021 22:26:14 +0000 (17:26 -0500)]
[lld-macho] Only codesign by default on arm64 macOS
instead of doing it on all arm64 platforms.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D98446
Jez Ng [Fri, 12 Mar 2021 22:26:12 +0000 (17:26 -0500)]
[lld-macho][nfc] Give every SyntheticSection a fake InputSection
Previously, it was difficult to write code that handled both synthetic
and regular sections generically. We solve this problem by creating a
fake InputSection at the start of every SyntheticSection.
This refactor allows us to handle DSOHandle like a regular Defined
symbol (since Defined symbols must be attached to an InputSection), and
paves the way for supporting `__mh_*header` symbols. Additionally, it
simplifies our binding/rebase code.
I did have to extend Defined a little -- it now has a `linkerInternal`
flag, to indicate that `___dso_handle` should not be in the final symbol
table.
I've also added some additional testing for `___dso_handle`.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D98545
Jez Ng [Fri, 12 Mar 2021 22:26:11 +0000 (17:26 -0500)]
[lld-macho] Check address ranges when applying relocations
This diff required fixing `getEmbeddedAddend` to apply sign
extension to 32-bit values. We were previously passing around wrong
64-bit addend values that became "right" after being truncated back to
32-bit.
I've also made `getEmbeddedAddend` return a signed int, which is similar
to what LLD-ELF does for its `getImplicitAddend`.
`reportRangeError`, `checkUInt`, and `checkInt` are counterparts of similar
functions in LLD-ELF.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D98387
Siva Chandra Reddy [Fri, 12 Mar 2021 21:56:52 +0000 (13:56 -0800)]
[libc][Obvious] Add string tests to non-full-build mode.
Jordan Rupprecht [Fri, 12 Mar 2021 21:58:37 +0000 (13:58 -0800)]
Revert "[CodeGenPrepare] Fix isIVIncrement (PR49466)"
This reverts commit
cf82700af8c658ae09b14c3d01bb1e73e48d3bd3 due to a compile timeout when building the following with `clang -O2`:
```
template <class, class = int> class a;
struct b {
using d = int *;
};
struct e {
using f = b::d;
};
class g {
public:
e::f h;
e::f i;
};
template <class, class> class a : g {
public:
long j() const { return i - h; }
long operator[](long) const noexcept;
};
template <class c, class k> long a<c, k>::operator[](long l) const noexcept {
return h[l];
}
template <typename m, typename n> int fn1(m, n, const char *);
int o, p;
class D {
void q(const a<long> &);
long r;
};
void D::q(const a<long> &l) {
int s;
if (l[0])
for (; l.j(); ++s) {
if (l[s])
while (fn1(o, 0, ""))
;
r = l[s] / p;
}
}
```
Nikita Popov [Fri, 12 Mar 2021 21:53:49 +0000 (22:53 +0100)]
[MemCpyOpt] Add test for memcpy in loop (NFC)
This is currently not being optimized.
Siva Chandra [Fri, 12 Mar 2021 21:50:09 +0000 (13:50 -0800)]
[libc] Adjust full build entrypoints for aarch64.
Wei Mi [Fri, 12 Mar 2021 19:34:56 +0000 (11:34 -0800)]
[IndirectCallPromotion] Recommit "Don't strip ".__uniq." suffix when it strips
".llvm." suffix".
The recommit fixed a bug that symbols with "." at the beginning is not
properly handled in the last commit.
Original commit message:
Currently IndirectCallPromotion simply strip everything after the first "."
in LTO mode, in order to match the symbol name and the name with ".llvm."
suffix in the value profile. However, if -funique-internal-linkage-names
and thinlto are both enabled, the name may have both ".__uniq." suffix and
".llvm." suffix, and the current mechanism will strip them both, which is
unexpected. The patch fixes the problem.
Differential Revision: https://reviews.llvm.org/D98389
Siva Chandra Reddy [Thu, 11 Mar 2021 23:25:24 +0000 (15:25 -0800)]
[libc] Introduce a full build mode CMake option.
This option will build LLVM libc as a full libc by itself. In this mode,
it is not expected that it will be mixed with other libcs. The
non-full-build mode will be the default LLVM libc build mode. In a future
where LLVM libc is complete enough, the full libc build will be made the
default mode.
Philip Reames [Fri, 12 Mar 2021 21:11:25 +0000 (13:11 -0800)]
[tests] Cover a case brought up in review of D98222
Muiez Ahmed [Fri, 12 Mar 2021 20:22:03 +0000 (15:22 -0500)]
[SystemZ][z/OS] Missing wchar functions libc++
The aim is to add the missing z/OS specific implementations for mbsnrtowcs and wcsnrtombs, as part of libc++.
Differential Revision: https://reviews.llvm.org/D98207
Amy Huang [Tue, 16 Feb 2021 21:13:52 +0000 (13:13 -0800)]
[DebugInfo] Add an attribute to force type info to be emitted for types that are required to be complete.
This was motivated by the fact that constructor type homing (debug info
optimization that we want to turn on by default) drops some libc++ types,
so an attribute would allow us to override constructor homing and emit
them anyway. I'm currently looking into the particular libc++ issue, but
even if we do fix that, this issue might come up elsewhere and it might be
nice to have this.
As I've implemented it now, the attribute isn't specific to the
constructor homing optimization and overrides all of the debug info
optimizations.
Open to discussion about naming, specifics on what the attribute should do, etc.
Differential Revision: https://reviews.llvm.org/D97411
Sanjay Patel [Fri, 12 Mar 2021 19:15:27 +0000 (14:15 -0500)]
[InstCombine] add test for zext-of-icmps; NFC
PR49475 shows an infinite loop outcome, but this
tries to show the root cause with a minimal test.
Craig Topper [Fri, 12 Mar 2021 20:07:46 +0000 (12:07 -0800)]
[DAGCombiner] Use isConstantSplatVectorAllZeros/Ones instead of isBuildVectorAllZeros/Ones in visitMSTORE and visitMLOAD.
This allows us to optimize when the mask is a splat_vector in
addition to build_vector.
Craig Topper [Fri, 12 Mar 2021 20:05:00 +0000 (12:05 -0800)]
[RISCV] Add test cases for masked load/store with all ones/zeros mask. NFC
These should be removed for all zeros mask or optimized to
unmasked for all ones.
Anastasia Stulova [Fri, 12 Mar 2021 20:11:26 +0000 (20:11 +0000)]
[OpenCL] Use spir target for CIndex tests for OpenCL.
This fixes failing bots.
Patch by azabaznov (Anton Zabaznov)!
Differential Revision: https://reviews.llvm.org/D98539
Nico Weber [Fri, 12 Mar 2021 20:04:20 +0000 (15:04 -0500)]
Arnamoy Bhattacharyya [Fri, 12 Mar 2021 20:00:47 +0000 (15:00 -0500)]
[flang][OpenMP][FIX] Fix function to check nesting level of current directive.
Nikita Popov [Thu, 11 Mar 2021 17:59:49 +0000 (18:59 +0100)]
[OpaquePtrs] Remove some uses of type-less CreateGEP() (NFC)
This removes some (but not all) uses of type-less CreateGEP()
and CreateInBoundsGEP() APIs, which are incompatible with opaque
pointers.
There are a still a number of tricky uses left, as well as many
more variation APIs for CreateGEP.
Craig Topper [Fri, 12 Mar 2021 19:46:22 +0000 (11:46 -0800)]
[RISCV] Teach normaliseSetCC to canonicalize X > -1 to X >= 0 and X < 1 to 0 >= X.
This allows the use of BGE with X0 instead of puting -1/1 in a
register.
Reviewed By: jrtc27
Differential Revision: https://reviews.llvm.org/D98542
Hubert Tong [Fri, 12 Mar 2021 19:48:00 +0000 (14:48 -0500)]
Revert "[AsmParser][SystemZ][z/OS] Introducing HLASM Comment Syntax"
This reverts commit
bcdd40f802a5dfd7b3ac11304e6099bfcdd25b1e.
See https://reviews.llvm.org/D98543.
Nico Weber [Fri, 12 Mar 2021 19:37:37 +0000 (14:37 -0500)]
Revert "[Clang][ARM] Reenable arm_acle.c test."
This reverts commit
5ae949a9276542b46f41374fbe7aee01e480d9d6.
Test fails everywhere.
Eugene Zhulenev [Fri, 12 Mar 2021 18:39:16 +0000 (10:39 -0800)]
[mlir] Annotate functions used only in debug mode with LLVM_ATTRIBUTE_UNUSED
Functions used only in `assert` cause warnings in release mode
Reviewed By: mehdi_amini, dcaballe, ftynse
Differential Revision: https://reviews.llvm.org/D98476
David Green [Fri, 12 Mar 2021 19:21:21 +0000 (19:21 +0000)]
[Clang][ARM] Reenable arm_acle.c test.
This test was apparently disabled in
6fcd4e080f09c9765d6, without any
sign of how it was going to be reenabled. This patch rewrites the test
to use update_cc_test_checks, with midend optimizations other that
mem2reg disabled.
Craig Topper [Fri, 12 Mar 2021 19:05:45 +0000 (11:05 -0800)]
[RISCV] Add test cases for failure to optimize select_cc with X < 1 or X > -1. NFC
We can use BGE with X0 to implement these, but we currently put
1 or -1 into a register.
Roman Lebedev [Fri, 12 Mar 2021 19:05:55 +0000 (22:05 +0300)]
[SCEV] Improve modelling for (null) pointer constants
This is a continuation of D89456.
As it was suggested there, now that SCEV models `PtrToInt`,
we can try to improve SCEV's pointer handling.
In particular, i believe, i will need this in the future
to further fix `SCEVAddExpr`operation type handling.
This removes special handling of `ConstantPointerNull`
from `ScalarEvolution::createSCEV()`, and add constant folding
into `ScalarEvolution::getPtrToIntExpr()`.
This way, `null` constants stay as such in SCEV's,
but gracefully become zero integers when asked.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98147
Peter Steinfeld [Wed, 10 Mar 2021 16:23:26 +0000 (08:23 -0800)]
[flang] Make the symbol count used for collating symbols static
I changed the declaration of symbolCount_ in the type Symbols to be
static to avoid possible problems in the future when we might have
multiple objects of type Symbols. Thanks to Peter for pointing out the
need for this change.
Differential Revision: https://reviews.llvm.org/D98357
Craig Topper [Fri, 12 Mar 2021 18:25:43 +0000 (10:25 -0800)]
[RISCV] Add support for scalable vector masked load/store.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98460
Zahira Ammarguellat [Fri, 12 Mar 2021 18:23:19 +0000 (10:23 -0800)]
[NFC] Fix "unused parameter" error revealed in the Linux self-build.
Stanislav Mekhanoshin [Fri, 12 Mar 2021 17:19:46 +0000 (09:19 -0800)]
[AMDGPU] Fix -amdgpu-inline-arg-alloca-cost
Before D94153 this threshold was in a pre-scaled units.
After D94153 inlining threshold multiplier is not applied
to this portion of the threshold anymore. Restore the
threshold by applying the multiplier.
Differential Revision: https://reviews.llvm.org/D98362
Thomas Preud'homme [Thu, 11 Jun 2020 15:14:24 +0000 (16:14 +0100)]
[FileCheck] Add support for hex alternate form in FileCheck
Add printf-style alternate form flag to prefix hex number with 0x when
present. This works on both empty numeric expression (e.g. variable
definition from input) and when matching a numeric expression. The
syntax is as follows:
[[#%#<precision specifier><format specifier>, ...]
where <precision specifier> and <format specifier> are optional and ...
can be a variable definition or not with an empty expression or not.
This feature was requested in https://reviews.llvm.org/D81144#2075532
for llvm/test/MC/ELF/gen-dwarf64.s
Reviewed By: jdenny
Differential Revision: https://reviews.llvm.org/D97845
Alex Zinenko [Fri, 12 Mar 2021 11:19:47 +0000 (12:19 +0100)]
[mlir] fix a memory leak in NestedPattern
NestedPattern uses a BumpPtrAllocator to store child (nested) pattern
objects to decrease the overhead of dynamic allocation. This assumes all
allocations happen inside the allocator that will be freed as a whole.
However, NestedPattern contains `std::function` as a member, which
allocates internally using `new`, unaware of the BumpPtrAllocator. Since
NestedPattern only holds pointers to the nested patterns allocated in
the BumpPtrAllocator, it never calls their destructors, so the
destructor of the `std::function`s they contain are never called either,
leaking the allocated memory.
Make NestedPattern explicitly call destructors of nested patterns. This
additionally requires to actually copy the nested patterns in
copy-construction and copy-assignment instead of just sharing the
pointer to the arena-allocated list of children to avoid double-free. An
alternative solution would be to add reference counting to the list of
arena-allocated list of children.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D98485
serge-sans-paille [Fri, 12 Mar 2021 17:42:17 +0000 (18:42 +0100)]
[NFC] Use llvm::raw_string_ostream instead of std::stringstream
That's more efficient and we don't loose any valuable feature when doing so.
Yashaswini [Fri, 12 Mar 2021 17:22:21 +0000 (22:52 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.15.3.6 Reduction clause
Implementation of Reduction clause restriction checks.
Files:
flang/lib/Semantics/check-directive-structure.h
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/check-omp-structure.h
flang/lib/Semantics/resolve-directives.cpp
Testcases:
flang/test/Semantics/omp-reduction01.f90
flang/test/Semantics/omp-reduction02.f90
flang/test/Semantics/omp-reduction03.f90
flang/test/Semantics/omp-reduction04.f90
flang/test/Semantics/omp-reduction05.f90
flang/test/Semantics/omp-reduction06.f90
flang/test/Semantics/omp-reduction07.f90
flang/test/Semantics/omp-reduction08.f90
flang/test/Semantics/omp-reduction09.f90
flang/test/Semantics/omp-reduction10.f90
flang/test/Semantics/omp-symbol08.f90
Reviewed by: Kiran Chandramohan @kiranchandramohan and Valentin Clement @clementval.
Differential Revision: https://reviews.llvm.org/D90697
Kadir Cetinkaya [Fri, 12 Mar 2021 08:36:06 +0000 (09:36 +0100)]
[clang] Mark re-injected tokens appropriately during pragma handling
This hides such tokens from TokenWatcher, preventing crashes in clients
trying to match spelled and expanded tokens.
Fixes https://github.com/clangd/clangd/issues/712
Differential Revision: https://reviews.llvm.org/D98483
Nico Weber [Fri, 12 Mar 2021 17:15:52 +0000 (12:15 -0500)]
[gn build] (manually) port
bcdd40f802a5
Anirudh Prasad [Fri, 12 Mar 2021 16:39:03 +0000 (11:39 -0500)]
[AsmParser][SystemZ][z/OS] Introducing HLASM Comment Syntax
- This patch adds in support for the ordinary HLASM comment syntax asm
statements (Reference - Chapter 7, Comment Statements, Ordinary Comment
Statements)
- In brief, the ordinary comment syntax if used, must begin with the "*"
character
- To achieve this, this patch makes use of the CommentString attribute
provided in the base MCAsmInfo class
- In the SystemZMCAsmInfo class, the CommentString attribute was set to
"*" based on the assembler dialect
- Furthermore, a new attribute RestrictCommentString, is provided to only
treat a string as a comment if it appears at the start of the asm
statement. Example: "jo *-4" is valid in HLASM (jump back 4 bytes from
current point - similar to jo -4 in gnu asm) and we don't want "*-4" to
be treated as a comment.
- RFC for HLASM Parser support implementation: https://lists.llvm.org/pipermail/llvm-dev/2021-January/147686.html
Reviewed By: scott.linder, Kai
Differential Revision: https://reviews.llvm.org/D97703
Nico Weber [Sun, 7 Mar 2021 02:13:52 +0000 (21:13 -0500)]
[lit] rewrap a few lines to 80 columns
No behavior change.
Christopher Di Bella [Fri, 12 Mar 2021 07:46:37 +0000 (23:46 -0800)]
[libcxx] adds concept std::regular
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Depends on D97911
Reviewed By: EricWF, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D98154
Nemanja Ivanovic [Fri, 12 Mar 2021 15:19:58 +0000 (09:19 -0600)]
[PowerPC] Add more missing overloads to altivec.h
We are missing more predicate forms for 'vector double' and some
tests. This adds the missing overloads and completes the set of
test cases for them.
Dave Lee [Fri, 12 Mar 2021 16:47:55 +0000 (08:47 -0800)]
[lldb] Remove unused StackFrame::TrackGlobalVariable
Last used by the Go plugin which was removed in https://reviews.llvm.org/D54057.
Vy Nguyen [Fri, 12 Mar 2021 16:35:50 +0000 (11:35 -0500)]
Revert "Revert "[compiler-rt][asan] Make wild-pointer crash error more useful""
This reverts commit
c578508b5bb20ccce5e2a43dd2afc41a49afec74.
Reland now that unrelated crash has been resolved.
Simon Pilgrim [Fri, 12 Mar 2021 15:13:42 +0000 (15:13 +0000)]
[clang] Use Constant::getAllOnesValue helper. NFCI.
Avoid -1ULL which MSVC tends to complain about
Simon Pilgrim [Fri, 12 Mar 2021 14:42:20 +0000 (14:42 +0000)]
[X86][AVX] Insert zeros byte elements into 256/512-bit vectors using shuffle/and
Avoid extracting/inserting subvectors which makes it more difficult for shuffle combining to merge them together.
Simon Pilgrim [Fri, 12 Mar 2021 12:51:36 +0000 (12:51 +0000)]
[X86] Provide lighter weight getTargetShuffleMask wrapper. NFCI.
Most callers to getTargetShuffleMask don't use the IsUnary flag.
Nico Weber [Fri, 12 Mar 2021 15:02:17 +0000 (10:02 -0500)]
Revert "[IndirectCallPromotion] Don't strip ".__uniq." suffix when it strips"
This reverts commit
90dfbeef5982ecfb5523b48f3c301bea033e5c3d.
Causes PR49554. Also see comments on https://reviews.llvm.org/D98389
Simonas Kazlauskas [Wed, 10 Mar 2021 13:05:36 +0000 (15:05 +0200)]
Test cases for rem-seteq fold with illegal types
This also briefly tests a larger set of architectures than the more
exhaustive functionality tests for AArch64 and x86.
As requested in D88785
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D98339
Matt Arsenault [Sat, 6 Mar 2021 16:49:30 +0000 (11:49 -0500)]
GlobalISel: Fix marking byval arguments as immutable
byval arguments need to be assumed writable. Only implicitly stack
passed arguments which aren't addressable in the IR can be assumed
immutable.
Mips is still broken since for some reason its doing its own thing
with the ValueHandlers (and x86 doesn't actually handle byval
arguments now, although some of the code is there).
Matt Arsenault [Fri, 5 Mar 2021 22:28:32 +0000 (17:28 -0500)]
GlobalISel: Partially fix handling of byval arguments
This was essentially ignoring byval and treating them as a pointer
argument which needed to be loaded from. This should copy the frame
index value to the virtual register, not insert a load from the frame
index into the pointer value.
For AMDGPU, this was producing a load from the byval pointer argument,
to a pointer used for the byval arguments. I do not understand how
AArch64 managed to work before since it appears to be similarly
broken.
We could also change the ValueHandler API to avoid the extra copy from
the frame index, since currently it returns a new register.
I believe there is still an issue with outgoing byval arguments. These
should have a copy inserted in case the callee decided to overwrite
the memory.
Matt Arsenault [Sat, 6 Mar 2021 13:54:38 +0000 (08:54 -0500)]
AArch64/GlobalISel: Don't use common prefix in test
Unlike update_llc_test_checks, update_mir_test_checks isn't actually
smart enough to common functions with identical output.
Matt Arsenault [Wed, 3 Mar 2021 21:57:24 +0000 (16:57 -0500)]
AMDGPU/GlobalISel: Cleanup call lowering sequence
Now that handleAssignments is handling all of the argument splitting,
we don't have to move the insert point around.
serge-sans-paille [Fri, 12 Mar 2021 13:27:15 +0000 (14:27 +0100)]
[NFC] Use StringRef instead of const char* for AsmPrinter
This avoids calling strlen to repeatedly compute some string size.
Florian Hahn [Fri, 12 Mar 2021 13:31:48 +0000 (13:31 +0000)]
[LV] Fix name in CHECK pattern after
fb3ca7076
Florian Hahn [Fri, 12 Mar 2021 13:22:29 +0000 (13:22 +0000)]
[LV] Account IV recipes being uniform in VPTransformState::get().
This patch fixes a crash when trying to get a scalar value using
VPTransformState::get() for uniform induction values or truncated
induction values. IVs and truncated IVs can be uniform and the updated
code accounts for that, fixing the crash.
This should fix
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31981
Christian Sigg [Thu, 11 Mar 2021 07:34:53 +0000 (08:34 +0100)]
[mlir] Remove mlir-cuda-runner
Change CUDA integration tests to use mlir-opt + mlir-cpu-runner instead.
Depends On D98203
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D98396
Sanjay Patel [Fri, 12 Mar 2021 12:56:54 +0000 (07:56 -0500)]
[SimplifyCFG] avoid sinking insts within an infinite-loop
The test is reduced from a C source example in:
https://llvm.org/PR49541
It's possible that the test could be reduced further or
the predicate generalized further, but it seems to require
a few ingredients (including the "late" SimplifyCFG options
on the RUN line) to fall into the infinite-loop trap.
Stefan Gränitz [Fri, 12 Mar 2021 12:51:44 +0000 (13:51 +0100)]
[Orc] Fix race condition in DebugObjectManagerPlugin
During finalization the debug object is registered with the target. Materialization must wait for this process to finish. Otherwise we might start running code before the debugger finished processing the corresponding debug info.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D98417
Valeriy Savchenko [Wed, 10 Mar 2021 13:50:34 +0000 (16:50 +0300)]
[analyzer][solver] Prevent infeasible states (PR49490)
This patch fixes the situation when our knowledge of disequalities
can help us figuring out that some assumption is infeasible, but
the solver still produces a state with inconsistent constraints.
Additionally, this patch adds a couple of assertions to catch this
type of problems easier.
Differential Revision: https://reviews.llvm.org/D98341
Hans Wennborg [Fri, 12 Mar 2021 12:43:36 +0000 (13:43 +0100)]
Revert "[InstrProfiling] Don't generate __llvm_profile_runtime_user"
This broke the check-profile tests on Mac, see comment on the code
review.
> This is no longer needed, we can add __llvm_profile_runtime directly
> to llvm.compiler.used or llvm.used to achieve the same effect.
>
> Differential Revision: https://reviews.llvm.org/D98325
This reverts commit
c7712087cbb505d324e1149fa224f607c91a8c6a.
Also reverting the dependent follow-up commit:
Revert "[InstrProfiling] Generate runtime hook for ELF platforms"
> When using -fprofile-list to selectively apply instrumentation only
> to certain files or functions, we may end up with a binary that doesn't
> have any counters in the case where no files were selected. However,
> because on Linux and Fuchsia, we pass -u__llvm_profile_runtime, the
> runtime would still be pulled in and incur some non-trivial overhead,
> especially in the case when the continuous or runtime counter relocation
> mode is being used. A better way would be to pull in the profile runtime
> only when needed by declaring the __llvm_profile_runtime symbol in the
> translation unit only when needed.
>
> This approach was already used prior to
9a041a75221ca, but we changed it
> to always generate the __llvm_profile_runtime due to a TAPI limitation.
> Since TAPI is only used on Mach-O platforms, we could use the early
> emission of __llvm_profile_runtime there, and on other platforms we
> could change back to the earlier approach where the symbol is generated
> later only when needed. We can stop passing -u__llvm_profile_runtime to
> the linker on Linux and Fuchsia since the generated undefined symbol in
> each translation unit that needed it serves the same purpose.
>
> Differential Revision: https://reviews.llvm.org/D98061
This reverts commit
87fd09b25f8892e07b7ba11525baa9c3ec3e5d3f.
Aaron Ballman [Fri, 12 Mar 2021 12:21:03 +0000 (07:21 -0500)]
Add support for digit separators in C2x.
WG14 adopted N2626 at the meetings this week. This commit adds support
for using ' as a digit separator in a numeric literal which is
compatible with the C++ feature.
Simon Pilgrim [Fri, 12 Mar 2021 12:03:36 +0000 (12:03 +0000)]
[PPC] Fix UBSAN warning about out of range shift. NFCI.