Andrew Browne [Fri, 25 Jun 2021 05:16:36 +0000 (22:16 -0700)]
[DFSan] Change shadow and origin memory layouts to match MSan.
Previously on x86_64:
+--------------------+ 0x800000000000 (top of memory)
| application memory |
+--------------------+ 0x700000008000 (kAppAddr)
| |
| unused |
| |
+--------------------+ 0x300000000000 (kUnusedAddr)
| origin |
+--------------------+ 0x200000008000 (kOriginAddr)
| unused |
+--------------------+ 0x200000000000
| shadow memory |
+--------------------+ 0x100000008000 (kShadowAddr)
| unused |
+--------------------+ 0x000000010000
| reserved by kernel |
+--------------------+ 0x000000000000
MEM_TO_SHADOW(mem) = mem & ~0x600000000000
SHADOW_TO_ORIGIN(shadow) = kOriginAddr - kShadowAddr + shadow
Now for x86_64:
+--------------------+ 0x800000000000 (top of memory)
| application 3 |
+--------------------+ 0x700000000000
| invalid |
+--------------------+ 0x610000000000
| origin 1 |
+--------------------+ 0x600000000000
| application 2 |
+--------------------+ 0x510000000000
| shadow 1 |
+--------------------+ 0x500000000000
| invalid |
+--------------------+ 0x400000000000
| origin 3 |
+--------------------+ 0x300000000000
| shadow 3 |
+--------------------+ 0x200000000000
| origin 2 |
+--------------------+ 0x110000000000
| invalid |
+--------------------+ 0x100000000000
| shadow 2 |
+--------------------+ 0x010000000000
| application 1 |
+--------------------+ 0x000000000000
MEM_TO_SHADOW(mem) = mem ^ 0x500000000000
SHADOW_TO_ORIGIN(shadow) = shadow + 0x100000000000
Reviewed By: stephan.yichao.zhao, gbalats
Differential Revision: https://reviews.llvm.org/D104896
Siva Chandra Reddy [Fri, 25 Jun 2021 05:43:47 +0000 (05:43 +0000)]
[libc] Use __builtin_ctzll instead of __builtin_ctzl in elements_x86.h.
__builtin_ctzl takes an unsigned long argument which need not be 64-bit
long on all platforms. Using __builtin_ctzll, which takes an unsigned
long long argument, ensures that 64-bit values will be handled on a
wider range of platforms.
Without this change, the test corresponding to M512 fails in Windows.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D104897
Nikita Popov [Fri, 25 Jun 2021 22:32:59 +0000 (00:32 +0200)]
Revert "[InstCombine] Make indexed compare fold opaque ptr compatible"
This reverts commit
5cb20ef8a235c2027489a196bba27630ca21a00b.
Assertion failures with this patch were reported on
https://reviews.llvm.org/rG5cb20ef8a235, revert for now.
Duncan P. N. Exon Smith [Fri, 25 Jun 2021 18:53:27 +0000 (11:53 -0700)]
OpaquePtr: Reject 'ptr*' again when parsing textual IR
Bring back the testcase dropped in
1e6303e60ca5af4fbe7ca728572fd65666a98271 and get it passing by checking
explicitly for `ptr*` in LLParser. Uses `Type::isOpaquePointerTy()` from
ad4bb8280952c2cacf497e30560ee94c119b36e0.
Differential Revision: https://reviews.llvm.org/D104938
Aart Bik [Fri, 25 Jun 2021 19:02:08 +0000 (12:02 -0700)]
[mlir][sparse] add print methods to Merger (for debugging)
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D104939
Matheus Izvekov [Tue, 22 Jun 2021 01:48:51 +0000 (03:48 +0200)]
[clang] Stop providing builtin overload candidate for relational function pointer comparisons
Word on the grapevine was that the committee had some discussion that
ended with unanimous agreement on eliminating relational function pointer comparisons.
We wanted to be bold and just ban all of them cold turkey.
But then we chickened out at the last second and are going for
eliminating just the spaceship overload candidate instead, for now.
See D104680 for reference.
This should be fine and "safe", because the only possible semantic change this
would cause is that overload resolution could possibly be ambiguous if
there was another viable candidate equally as good.
But to save face a little we are going to:
* Issue an "error" for three-way comparisons on function pointers.
But all this is doing really is changing one vague error message,
from an "invalid operands to binary expression" into an
"ordered comparison of function pointers", which sounds more like we mean business.
* Otherwise "warn" that comparing function pointers like that is totally
not cool (unless we are told to keep quiet about this).
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D104892
Jonas Devlieghere [Fri, 25 Jun 2021 19:57:36 +0000 (12:57 -0700)]
[lldb] Use the non-locking variant of objc_copyRealizedClassList
Avoid standing the Objective-C runtime lock by calling
objc_copyRealizedClassList_nolock instead of objc_copyRealizedClassList.
We already guarantee that no other threads can run while we're running
this utility expression, similar to when we parse the data ourselves
from the gdb_objc_realized_classes struct.
Worst case this will crash if the list is getting edited, which won't do
any harm and we'll just try again later.
Differential revision: https://reviews.llvm.org/D104951
Jim Ingham [Fri, 25 Jun 2021 01:58:21 +0000 (18:58 -0700)]
Add support for the NSMutableDictionary variant: "__NSFrozenDictionaryM"
This was an oversight of the commit:
bb93483c119b92c1ec2b7a58505e21b9dce6a333 that
added support for the Frozen variants. Also added a test case for the way that
currently produces one of these variants (a copy).
Eli Friedman [Fri, 25 Jun 2021 21:43:13 +0000 (14:43 -0700)]
[NFC] Prefer ConstantRange::makeExactICmpRegion over makeAllowedICmpRegion
The implementation is identical, but it makes the semantics a bit more
obvious.
Eric Astor [Fri, 25 Jun 2021 21:19:39 +0000 (17:19 -0400)]
[ms] [llvm-ml] Add support for ALIGN, EVEN, and ORG directives
Match ML.EXE's behavior for ALIGN, EVEN, and ORG directives both at file level and in STRUCTs.
We currently reject negative offsets passed to ORG inside STRUCTs (in ML.EXE and ML64.EXE, they wrap around as for an unsigned 32-bit integer).
Also, if a STRUCT is declared using an ORG directive, no value of that type can be defined.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D92507
Adrian Prantl [Fri, 25 Jun 2021 20:49:01 +0000 (13:49 -0700)]
Change PathMappingList::RemapPath to return an optional result (NFC)
This is an NFC modernization refactoring that replaces the combination
of a bool return + reference argument, with an Optional return value.
Differential Revision: https://reviews.llvm.org/D104404
Juneyoung Lee [Fri, 25 Jun 2021 08:56:10 +0000 (17:56 +0900)]
[SimplifyLibCalls] Fix memchr opt to use CreateLogicalAnd
This fixes a bug at LibCallSimplifier::optimizeMemChr which does the following transformation:
```
// memchr("\r\n", C, 2) != nullptr -> (1 << C & ((1 << '\r') | (1 << '\n')))
// != 0
// after bounds check.
```
As written above, a bounds check on C (whether it is less than integer bitwidth) is done before doing `1 << C` otherwise 1 << C will overflow.
If the bounds check is false, the result of (1 << C & ...) must not be used at all, otherwise the result of shift (which is poison) will contaminate the whole results.
A correct way to encode this is `select i1 (bounds check), (1 << C & ...), false` because select does not allow the unused operand to contaminate the result.
However, this optimization was introducing `and (bounds check), (1 << C & ...)` which cannot do that.
The bug was found from compilation of this C++ code: https://reviews.llvm.org/rG2fd3037ac615#1007197
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D104901
Joseph Huber [Thu, 24 Jun 2021 21:11:54 +0000 (17:11 -0400)]
[OpenMP] Change OpenMPOpt to check openmp metadata
The metadata added in D102361 introduces a module flag that we can check
to determine if the module was compiled with `-fopenmp` enables. We can
now check for the precense of this instead of scanning the call graph
for OpenMP runtime functions.
Depends on D102361
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D102423
Joseph Huber [Thu, 24 Jun 2021 18:39:12 +0000 (14:39 -0400)]
[OpenMP] Add Module metadata for OpenMP compilation
This patch adds a module level metadata flag indicating that the module
was compiled with the `-fopenmp` flag. This will make it easier for
passes like OpenMPOpt to determine if it should be run.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D102361
Nemanja Ivanovic [Fri, 25 Jun 2021 20:09:02 +0000 (15:09 -0500)]
[PowerPC] Disable combine 64-bit bswap(load) without LDBRX
This causes failures on the big endian bootstrap bot.
Disabling this combine temporarily until I can get a proper fix.
Valeriy Savchenko [Tue, 22 Jun 2021 13:04:15 +0000 (16:04 +0300)]
[analyzer] Fix assertion failure on code with transparent unions
rdar://
76948312
Differential Revision: https://reviews.llvm.org/D104716
Martin Storsjö [Fri, 18 Jun 2021 19:59:58 +0000 (22:59 +0300)]
[llvm-rc] Don't rewrite the arch in the default triple unless necessary
When the default target arch isn't one that is supported as a
windows target, we want to set a suitable architecture (so that
Clang tests that run plain 'llvm-rc' succeed checks for e.g.
"#ifdef _WIN32" even for llvm builds that default to e.g. ppc64).
But if the default target architecture is usable, don't rewrite it.
(Rewriting it, by e.g. "T.setArch(T.getArch())", normalizes the
spelling of the architecture, e.g. changing i686 to i386. Such a
change can make clang unable to find the right sysroot.)
This can't, unfortunately, practically be tested very well because
it is entirely dependent on the default triple of the llvm build.
Differential Revision: https://reviews.llvm.org/D104589
Fangrui Song [Fri, 25 Jun 2021 19:52:39 +0000 (12:52 -0700)]
[ELF] --sysroot: change sysrooted script to not fall back for an absolute path
Modify the D13209 logic: for a script inside the sysroot, if an absolute path
does not exist, report an error instead of falling back to the path without the
sysroot prefix.
This matches GNU ld, which makes sense to me: we don't want to find an arbitrary
file in the host.
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D104894
Ulrich Weigand [Fri, 25 Jun 2021 19:49:07 +0000 (21:49 +0200)]
[SystemZ] Add support for .reloc assembler directive
Add support for the .reloc directive along the lines of
other back-ends.
This fixes a regression after https://reviews.llvm.org/D104080
was merged, since that patch presupposed support for .reloc.
Hongtao Yu [Fri, 25 Jun 2021 18:35:02 +0000 (11:35 -0700)]
[Coroutines] Define __coro_frame_ty in function scope
Types should be defined in function scope instead of a local lexical scope. Field types should be defined inside in its parent type scope.
We were seeing a type defined in a local scope causing trouble to the dwarf emitter where a context is required to be a funciton scope, a namespace or a global scope.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D104937
Eugene Zhulenev [Fri, 25 Jun 2021 19:14:51 +0000 (12:14 -0700)]
[mlir:Async] Submit accidentally omitted changes
Accidentally pushed old branches that did not include all the changes discussed in the PRs.
https://reviews.llvm.org/rGd43b23608ad664f02f56e965ca78916bde220950
https://reviews.llvm.org/rG86ad0af87054c3cccd68d32e103a6f1f6c6194c7
Differential Revision: https://reviews.llvm.org/D104943
Nikita Popov [Fri, 25 Jun 2021 19:19:08 +0000 (21:19 +0200)]
[OpaquePtr] Enumerate GlobalAlias value type
The type is no longer implicitly enumerated through the pointer
type.
Arthur O'Dwyer [Tue, 15 Jun 2021 16:57:05 +0000 (12:57 -0400)]
[libc++] Enable the rvalue overloads of operator<< and operator>> even in C++03.
Continuing to eliminate no-longer-needed uses of _LIBCPP_CXX03_LANG.
Differential Revision: https://reviews.llvm.org/D104725
Nikita Popov [Fri, 25 Jun 2021 18:55:09 +0000 (20:55 +0200)]
[IR] Add Type::isOpaquePointerTy() helper (NFC)
Shortcut to check for opaque pointers without a cast to PointerType.
peter klausler [Fri, 25 Jun 2021 17:35:03 +0000 (10:35 -0700)]
[flang] Fix generic/specific procedure confusion
A recent change that extended semantic analysis for actual arguments
that associate with procedure dummy arguments exposed some bugs in
regression test suites due to points of confusion in symbol table
handling in situations where a generic interface contains a specific
procedure of the same name. When passing that name as an actual
argument, for example, it's necessary to take this possibility into
account because the symbol for the generic interface shadows the
symbol of the same name for the specific procedure, which is
what needs to be checked. So add a small utility that bypasses
the symbol for a generic interface in this case, and use it
where needed.
Differential Revision: https://reviews.llvm.org/D104929
David Green [Fri, 25 Jun 2021 18:53:29 +0000 (19:53 +0100)]
[DAG] Fold neg(splat(neg(x)) -> splat(x)
This add as a fold of sub(0, splat(sub(0, x))) -> splat(x). This can
come up in the lowering of right shifts under AArch64, where we generate
a shift left of a negated number.
Differential Revision: https://reviews.llvm.org/D103755
Craig Topper [Fri, 25 Jun 2021 17:58:23 +0000 (10:58 -0700)]
[X86] Simplify part of the isel for X86ISD::FCMP/STRICT_FCMP/STRICT_FCMPS.
We don't need to have the compare output a value and then copy it
to FPSW for use by FNSTSW. Instead we can just have the compare
output Glue and glue the FNSTSW to it. InstrEmitter effectively
performed this optimization when emitting the Machine IR. Doing
it directly simplifies the codes and reduces the work in
InstrEmitter. There's no change in the machine IR at the end of
isel before and after this change.
Joel E. Denny [Fri, 25 Jun 2021 18:06:52 +0000 (14:06 -0400)]
[UpdateCCTestChecks] Fix new test from
9eaf0d120d32
`clang/test/utils/update_cc_test_checks/check-globals.test` from
9eaf0d120d32 broke at:
* <https://lab.llvm.org/buildbot/#/builders/110/builds/4415>
* <https://lab.llvm.org/buildbot/#/builders/5/builds/9076>
The problem is non-deterministic test order because the
`.lit_test_times.txt` from one run of a sample test suite affects the
other.
David Green [Fri, 25 Jun 2021 18:17:31 +0000 (19:17 +0100)]
[AArch64] Extra negated shift tests. NFC
Jon Chesterfield [Fri, 25 Jun 2021 18:02:02 +0000 (19:02 +0100)]
[libomptarget][amdgpu] Build openmp for two more targets
[libomptarget][amdgpu] Build openmp for two more targets
The 4800U APU is a gfx902 and the MI100 accelerator is a gfx908.
Both numbers are listed in ROCT topology.c
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D104922
Nico Weber [Fri, 25 Jun 2021 18:01:21 +0000 (14:01 -0400)]
[clang] Make fewer assumptions about path to lit.site.cfg after
9eaf0d120d32
Philip Reames [Fri, 25 Jun 2021 17:44:53 +0000 (10:44 -0700)]
[test] Add coverage for existing overflow rule with uadd.with.overflow
Florian Hahn [Fri, 25 Jun 2021 14:57:25 +0000 (15:57 +0100)]
[LV] Doxygenize VectorizationFactor member comments (NFC).
Minor cleanup for follow-up patch.
Eugene Zhulenev [Thu, 24 Jun 2021 12:27:42 +0000 (05:27 -0700)]
[mlir:Async] Implement recursive async work splitting for scf.parallel operation (async-parallel-for pass)
Depends On D104780
Recursive work splitting instead of sequential async tasks submission gives ~20%-30% speedup in microbenchmarks.
Algorithm outline:
1. Collapse scf.parallel dimensions into a single dimension
2. Compute the block size for the parallel operations from the 1d problem size
3. Launch parallel tasks
4. Each parallel task reconstructs its own bounds in the original multi-dimensional iteration space
5. Each parallel task computes the original parallel operation body using scf.for loop nest
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D104850
Eugene Zhulenev [Wed, 23 Jun 2021 13:24:09 +0000 (06:24 -0700)]
[mlir:Async] Add the size parameter to the async.group
Specify the `!async.group` size (the number of tokens that will be added to it) at construction time. `async.await_all` operation can potentially race with `async.execute` operations that keep updating the group, for this reason it is required to know upfront how many tokens will be added to the group.
Reviewed By: ftynse, herhut
Differential Revision: https://reviews.llvm.org/D104780
Philip Reames [Fri, 25 Jun 2021 17:24:10 +0000 (10:24 -0700)]
[instcombine] Fold overflow check using umulo to comparison
If we have a umul.with.overflow where the multiply result is not used and one of the operands is a constant, we can perform the overflow check cheaper with a comparison then by performing the multiply and extracting the overflow flag.
(Noticed when looking at the conditions SCEV emits for overflow checks.)
Differential Revision: https://reviews.llvm.org/D104665
Joel E. Denny [Fri, 25 Jun 2021 16:40:04 +0000 (12:40 -0400)]
[UpdateCCTestChecks] Support --check-globals
This option is already supported by update_test_checks.py, but it can
also be useful in update_cc_test_checks.py. For example, I'd like to
use it in OpenMP offload codegen tests to check global variables like
`.offload_maptypes*`.
Reviewed By: jdoerfert, arichardson, ggeorgakoudis
Differential Revision: https://reviews.llvm.org/D104714
Philip Reames [Thu, 24 Jun 2021 01:50:00 +0000 (18:50 -0700)]
[test][instcombine] Add test cases for all x.with.overflow overflow checks
For each of the x.with.overflow variants, if only the overflow bit is consumed, we can generate a direct overflow comparison. This precommits tests for each of the variants and tries to cover interesting cornercases.
Stephan Herhut [Fri, 25 Jun 2021 10:44:22 +0000 (12:44 +0200)]
[mlir][memref] Introduce UnrankedMemRefOf to tablegen definitions
This enables specifying operations that only support some element types for
unranked memrefs.
Differential Revision: https://reviews.llvm.org/D104906
Hendrik Greving [Wed, 23 Jun 2021 19:32:04 +0000 (12:32 -0700)]
[ModuloSchedule] Pass loop block explicitly to kernel rewriter.
This change is NFC upstream. We pass in the loop's block to the kernel
rewriter explicitly, instead of assuming it's the loop's top block. This
change is made for downstream targets where this assumption doesn't hold.
Differential Revision: https://reviews.llvm.org/D104811
Xun Li [Fri, 25 Jun 2021 16:46:55 +0000 (09:46 -0700)]
[Coroutines] Remove all legacy test command
With new pm becomes the default, the old-style test command becomes exactly the same as the new test command, i.e. the two commands are now redundant.
We should just delete the old command. (unless someone wants to add enable-new-pm=0 to all old commands.
Differential Revision: https://reviews.llvm.org/D104895
Sander de Smalen [Fri, 25 Jun 2021 16:36:44 +0000 (17:36 +0100)]
Revert "[GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize."
This patch seems to be causing build errors, reverting it for now.
This reverts commit
aeab9d9570ac8cb554aff6e1af24a471fdf5b4e5.
Nikita Popov [Fri, 25 Jun 2021 09:26:15 +0000 (11:26 +0200)]
[OpaquePtr] Allow globals with opaque pointer value type
Do this by making opaque pointers a valid pointer element type,
for which we implicitly create an opaque pointer (moving the logic
from getPointerTo into PointerType::get).
We'll never create something like a "pointer to opaque pointer",
but accept it in the API, because a lot of code reasonably assumes
that you can create a pointer to pointer type.
Differential Revision: https://reviews.llvm.org/D104902
Chris Bond [Fri, 25 Jun 2021 16:15:04 +0000 (18:15 +0200)]
[lldb-vscode] Make extension contribute breakpoints use new package.json schema
See https://code.visualstudio.com/updates/v1_42#_implement-a-debug-adapter-inside-an-extension
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D104882
Sanjay Patel [Fri, 25 Jun 2021 15:36:28 +0000 (11:36 -0400)]
[Analysis] use better version of getLibFunc to check for alloc/free calls
There's no reason to use the weaker name-only analysis when we
have a function prototype to check (in fact, we probably should
not even have that name-only function exposed for general use,
but removing it requires auditing all of the callers).
The version of getLibFunc that takes a Function argument also
does some prototype checking to make sure the arguments/return
type match the expected signature of a real library call.
This is NFC-intended because the code in MemoryBuiltins does its
own function signature checking. For now, that means there may
be some redundancy in the checking, but that should not be above
the noise for compile-time. Ideally, we can move the checks to
a single location.
There's still a hole in the logic that allows the example in
https://llvm.org/PR50846 to cause a compiler crash.
Sander de Smalen [Fri, 25 Jun 2021 14:55:03 +0000 (15:55 +0100)]
[GlobalISel] NFC: Have LLT::getSizeInBits/Bytes return a TypeSize.
To reflect that the size may be scalable, a TypeSize is returned
instead of an unsigned. In places where the result is used,
it currently relies on an implicit cast of TypeSize -> uint64_t,
which asserts that the type is not scalable.
This patch is NFC for fixed-width vectors.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D104454
Jay Foad [Fri, 25 Jun 2021 15:57:34 +0000 (16:57 +0100)]
[AMDGPU] Removed unused Predicate HasOffset3fBug. NFC.
The predicate definition didn't make sense anyway because it was defined
as being the opposite of what the name suggests.
Krzysztof Parzyszek [Fri, 25 Jun 2021 15:22:01 +0000 (10:22 -0500)]
[Hexagon] Convert getTypeAlignment to return Align
Plus some minor related changes of the same nature.
Andrzej Warzynski [Fri, 25 Jun 2021 15:27:36 +0000 (16:27 +0100)]
[flang][unittest] Add a missing dependency
In https://reviews.llvm.org/D103612, a definition of an instance of
`Fortran::parser::AnalyzedObjectsAsFortran` was moved (that object is
used in unparsing). That, in turn, introduced a dependency of the unit
tests on the `FortranEvaluate` library, which defines
`AnalyzedObjectsAsFortran`.
That dependency was missed in D103612 and has caused shared-library
builds to fail. I'm submitting this without a review, as it's rather
straightforward omission.
Mark de Wever [Fri, 25 Jun 2021 15:34:30 +0000 (17:34 +0200)]
[libc++][NFC] Rename include guard.
Sander de Smalen [Fri, 25 Jun 2021 10:27:41 +0000 (11:27 +0100)]
[GlobalISel] NFC: Change LLT::changeNumElements to LLT::changeElementCount.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D104453
Kadir Cetinkaya [Thu, 24 Jun 2021 09:38:23 +0000 (11:38 +0200)]
[clangd] Introduce a log-prefix flag to remote-index-server
Differential Revision: https://reviews.llvm.org/D104843
Kadir Cetinkaya [Thu, 24 Jun 2021 06:18:40 +0000 (08:18 +0200)]
[clangd] Call malloc_trim in clangd-index-server periodically
Differential Revision: https://reviews.llvm.org/D104841
Yaxun (Sam) Liu [Fri, 25 Jun 2021 14:10:27 +0000 (10:10 -0400)]
[clang] Fix build failure due to _S
_S is a reserved identifier in <ctype.h> on Solaris.
Yaxun (Sam) Liu [Wed, 23 Jun 2021 17:54:03 +0000 (13:54 -0400)]
[OpenCL] Do not include default header for preprocessor output as input
When clang driver is used with -save-temps to compile OpenCL program,
clang driver first launches clang -cc1 -E to generate preprocessor expansion output,
then launches clang -cc1 with the generated preprocessor expansion output as input
to generate LLVM IR.
Currently clang by default passes "-finclude-default-header" "-fdeclare-opencl-builtins"
in both steps, which causes default header included again in the second step, which
causes error.
This patch let clang not to include default header when input type is preprocessor expansion
output, which fixes the issue.
Reviewed by: Anastasia Stulova
Differential Revision: https://reviews.llvm.org/D104800
Florian Hahn [Fri, 25 Jun 2021 12:55:08 +0000 (13:55 +0100)]
[LV] Reflow comment for VectorizationCostTy (NFC).
Andrzej Warzynski [Fri, 4 Jun 2021 14:25:58 +0000 (15:25 +0100)]
[flang][driver] Add `-fno-analyzed-objects-for-unparse`
This patch adds a new option for the new Flang driver:
`-fno-analyzed-objects-for-unparse`. The semantics are similar to
`-funparse-typed-exprs-to-f18-fc` from `f18`. For consistency, the
latter is replaced with `-fno-analyzed-objects-for-unparse`.
The new option controls the behaviour of the unparser (i.e. the action
corresponding to `-fdebug-unparse`). The default behaviour is to use the
analyzed objects when unparsing. The new flag can be used to turn this
off, so that the original parse-tree objects are used. The analyzed
objects are generated during the semantic checks [1].
This patch also updates the semantics of
`-fno-analyzed-objects-for-unparse`/`-funparse-typed-exprs-to-f18-fc`
in `f18`, so that this flag is always taken into account when `Unparse`
is used (this way the semantics in `f18` and `flang-new` are identical).
The added test file is based on example from Peter Steinfeld.
[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/Semantics.md
Differential Revision: https://reviews.llvm.org/D103612
serge-sans-paille [Fri, 25 Jun 2021 08:02:33 +0000 (10:02 +0200)]
[NFC] remove unreferenced function ResolveIPV4HostName
Differential Revision: https://reviews.llvm.org/D104856
Jon Chesterfield [Fri, 25 Jun 2021 11:08:56 +0000 (12:08 +0100)]
[OpenMP][NFC] Drop unused headers from amdgpu plugin
Stuart Brady [Wed, 23 Jun 2021 13:21:15 +0000 (14:21 +0100)]
[OpenCL] Use DW_LANG_OpenCL language tag for OpenCL C
Note regarding C++ for OpenCL:
When compiling C++ for OpenCL, DW_LANG_C_plus_plus* is emitted.
There is no DWARF language code defined for C++ for OpenCL as of yet,
but DWARF issue 210514.1 has been raised to request one.
In the mean time, continuing to emit DW_LANG_C_plus_plus* for C++ for
OpenCL allows the potential to distinguish between C++ for OpenCL and
OpenCL C in !DICompileUnit nodes, whereas using DW_LANG_OpenCL for
C++ for OpenCL would prevent this.
This change therefore leaves C++ for OpenCL as-is.
Reviewed By: shchenz, Anastasia
Differential Revision: https://reviews.llvm.org/D104118
Sander de Smalen [Fri, 25 Jun 2021 07:25:41 +0000 (08:25 +0100)]
[GlobalISel] NFC: Change LLT::scalarOrVector to take ElementCount.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D104452
David Spickett [Fri, 25 Jun 2021 09:57:46 +0000 (09:57 +0000)]
[lldb] Re-enable GDB server client memory tag read tests
These were disabled in
473a3a773ea565612e836ae6c2093178c5a9eb72
because they failed on 32 bit platforms. (Arm for sure but I assume
any 32 bit)
This was due to the printf formatter used. These assumed
that types like uint64_t/size_t would be certain size/type and
that changes on 32 bit.
Instead use "z" to print the size_t and PRI<...> formatters
for the addr_t (always uint64_t) and the int32_t.
Sjoerd Meijer [Thu, 3 Jun 2021 16:04:56 +0000 (17:04 +0100)]
[SLP][AArch64] Precommit test for D103629, checking <4 x i8> loads. NFC.
Gabor Marton [Wed, 23 Jun 2021 14:25:49 +0000 (16:25 +0200)]
[Analyzer][solver] Fix crashes during symbol simplification
Consider the code
```
void f(int a0, int b0, int c)
{
int a1 = a0 - b0;
int b1 = (unsigned)a1 + c;
if (c == 0) {
int d = 7L / b1;
}
}
```
At the point of divisiion by `b1` that is considered to be non-zero,
which results in a new constraint for `$a0 - $b0 + $c`. The type
of this sym is unsigned, however, the simplified sym is `$a0 -
$b0` and its type is signed. This is probably the result of the
inherent improper handling of casts. Anyway, Range assignment
for constraints use this type information. Therefore, we must
make sure that first we simplify the symbol and only then we
assign the range.
Differential Revision: https://reviews.llvm.org/D104844
Raphael Isemann [Fri, 25 Jun 2021 09:48:12 +0000 (11:48 +0200)]
[lldb] Skip TestDataFormatterSynthVal.py with GCC as the test compiler
Raphael Isemann [Fri, 25 Jun 2021 09:45:57 +0000 (11:45 +0200)]
[lldb] Skip libstdc++ tests failing with GCC
Tracked in llvm.org/pr50861
These tests fail with all GCC versions I tested (8.5, 9.4, 10.3, 11.1).
Raphael Isemann [Thu, 24 Jun 2021 15:21:12 +0000 (17:21 +0200)]
[lldb] Skip tests failing with GCC due to LLDB not being able to call constructors
Tracked in llvm.org/pr50814
These tests fail with all GCC versions I tested (8.5, 9.4, 10.3, 11.1).
Florian Hahn [Fri, 25 Jun 2021 08:29:47 +0000 (09:29 +0100)]
[SCEV] Support single-cond range check idiom in applyLoopGuards.
This patch extends applyLoopGuards to detect a single-cond range check
idiom that InstCombine generates.
It extends applyLoopGuards to detect conditions of the form
(-C1 + X < C2). InstCombine will create this form when combining two
checks of the form (X u< C2 + C1) and (X >=u C1).
In practice, this enables us to correctly compute a tight trip count
bounds for code as in the function below. InstCombine will fold the
minimum iteration check created by LoopRotate with the user check (< 8).
void unsigned_check(short *pred, unsigned width) {
if (width < 8) {
for (int x = 0; x < width; x++)
pred[x] = pred[x] * pred[x];
}
}
As a consequence, LLVM creates dead vector loops for the code above,
e.g. see https://godbolt.org/z/cb8eTcqET
https://alive2.llvm.org/ce/z/SHHW4d
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D104741
Nikita Popov [Fri, 25 Jun 2021 09:13:36 +0000 (11:13 +0200)]
[OpaquePtr] Allow alias to opaque pointer
By relaxing the LLParser pointer type assertion.
Nikita Popov [Fri, 25 Jun 2021 09:08:19 +0000 (11:08 +0200)]
[OpaquePtr] Split force-opaque-pointers test (NFC)
Separate out the case that uses llvm-dis without
--force-opaque-pointers. This will generally produce a different
result from the other cases, because things like global symbol
pointers will be non-opaque in this case.
David Spickett [Fri, 25 Jun 2021 08:52:36 +0000 (08:52 +0000)]
[lldb] Fix memory tag unsupported test
This corrects the test added in
31f9960c38529ce805edf9764535eb0ce188cadf
and temporarily patched in
3b4aad1186e8e8e6f6c7887cb5e8d9bfd7d3ce2f.
This test checks that the memory tag read
command errors when you use it on a platform
without memory tagging.
(which is why we skip the test if you actually
have MTE)
The problem with this test is that there's
two levels of unsupported each with it's own
specific error.
On anything that isn't AArch64, there's no
tagging extension we support. So you're told
that that is the case. As in "this won't ever work".
When you're on AArch64 we know that MTE could
be present on the remote and when we find that it
isn't, we tell you that instead.
Expect a different error message on AArch64 to fix
the test.
serge-sans-paille [Tue, 22 Jun 2021 20:50:37 +0000 (22:50 +0200)]
[llvm-cov] Enforce alignment of function records
Function Records are required to be aligned on 8 bytes. This is enforced for each
records except the first, when one relies on the default alignment within an
std::string. There's no such guarantee, and indeed on 32 bits for some
implementation of std::string this is not enforced.
Provide a portable implementation based on llvm's MemoryBuffer.
Differential Revision: https://reviews.llvm.org/D104745
Sjoerd Meijer [Thu, 24 Jun 2021 18:29:13 +0000 (19:29 +0100)]
[AArch64] Custom lower <4 x i8> loads
This custom lowers <4 x i8> vector loads using a 32-bit load, followed by 2
SSHLL instructions to extend it to e.g. a <4 x i32> vector. Before, it was
really inefficient and expensive to construct a <4 x i32> for this as 4 byte
loads and 4 moves were used. With this improvement SLP vectorisation might for
example become profitable, see D103629.
Differential Revision: https://reviews.llvm.org/D104782
Nikita Popov [Fri, 25 Jun 2021 08:48:57 +0000 (10:48 +0200)]
[OpaquePtr] Enumerate alloca type
This is no longer implicitly enumerated through the pointer type.
Nikita Popov [Fri, 25 Jun 2021 08:45:29 +0000 (10:45 +0200)]
[OpaquePtr] Enumerate global variable type
This is no longer implicitly enumerated through the pointer type.
Qiu Chaofan [Fri, 25 Jun 2021 08:00:07 +0000 (16:00 +0800)]
[PowerPC] Change VSRpRC allocation order
On PowerPC, VSRpRC represents the pairs of even and odd VSX register,
and VRRC corresponds to higher 32 VSX registers. In some cases, extra
copies are produced when handling incoming VRRC arguments with VSRpRC.
This patch changes allocation order of VSRpRC to eliminate this kind of
copy.
Stack frame sizes may increase if allocating non-volatile registers, and
some other vector copies happen. They need fix in future changes.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D104855
Martin Storsjö [Sun, 20 Jun 2021 20:58:46 +0000 (23:58 +0300)]
[LLD] [COFF] Fix handling of LTO comdats with nontrivial selection types after
728cc0075e5dfdb454eb
Commit
728cc0075e5dfdb454ebe6418b63bdffae71ec14 made comdat symbols
from LTO objects be treated as any regular comdat symbol. This works
great for symbols that actually are IMAGE_COMDAT_SELECT_ANY, but
if the symbols have a less trivial selection type that require comparing
either the section chunk size or contents, we can't check that before
actually doing the LTO compilation.
Therefore bring back one aspect of handling from before; that comdat
resolution with a leader from an LTO symbol is essentially skipped,
like it was before
728cc0075e5dfdb454ebe6418b63bdffae71ec14.
Differential Revision: https://reviews.llvm.org/D104605
Amara Emerson [Thu, 24 Jun 2021 18:10:42 +0000 (11:10 -0700)]
[ARM] Fix crash in chained BFI combine due to incorrectly RAUW'ing a node.
For a bfi chain like:
a = bfi input, x, y
b = bfi a, x', y'
The previous code was RAUW'ing a with x, mutating the second 'b' bfi, and when
SelectionDAG's CSE code ended up deleting it unexpectedly, bad things happend.
There's no need to RAUW in this case because we can just return our newly
created replacement BFI node. It also looked incorrect because it didn't account
for other users of the 'a' bfi.
Since it seems that chains of more than 2 BFI nodes are hard/impossible to
produce without this combine kicking in at some point, I've removed that
functionality since it had no test coverage.
rdar://
79095399
Differential Revision: https://reviews.llvm.org/D104868
Fraser Cormack [Tue, 22 Jun 2021 17:08:52 +0000 (18:08 +0100)]
[RISCV] Permit larger RVV stacks and stack offsets
This patch teaches the compiler to generate code to handle larger RVV
stack sizes and stack offsets which resolve an amount larger than 2047
vector registers in size.
The previous behaviour was asserting on such large values as it was only
able to materialize the constant by feeding it to the 12-bit immediate
of an `ADDI` instruction. The compiler can now materialize this amount
into a temporary register before continuing with the computation.
A test case for this scenario is included which also checks that the
temporary register used to materialize the amount doesn't require an
additional spill slot over what we're already reserving for RVV code.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D104727
Serge Pavlov [Wed, 23 Jun 2021 06:33:55 +0000 (13:33 +0700)]
[X86] Add description of FXAM instruction
Previously this instruction could be used only in assembler. This change
makes it available for compiler also. Scheduling information was copied
from FTST instruction, hopefully this can be a satisfactory approximation.
Differential Revision: https://reviews.llvm.org/D104853
Fangrui Song [Fri, 25 Jun 2021 04:35:48 +0000 (21:35 -0700)]
[MC][ELF] Change SHT_LLVM_CALL_GRAPH_PROFILE relocations from SHT_RELA to SHT_REL
... even on targets preferring RELA. The section is only consumed by ld.lld
which can handle REL.
Follow-up to D104080 as I explained in the review. There are two advantages:
* The D104080 code only handles RELA, so arm/i386/mips32 etc may warn for -fprofile-use=/-fprofile-sample-use= usage.
* Decrease object file size for RELA targets
While here, change the relocation to relocate weights, instead of 0,1,2,3,..
I failed to catch the issue during review.
Arthur Eubanks [Fri, 25 Jun 2021 02:21:16 +0000 (19:21 -0700)]
Revert "[BuildLibCalls/SimplifyLibCalls] Fix attributes on created CallInst instructions."
This reverts commit
1eda5453f2dcc9a9a4b4578fe74163c529974503.
Causes https://crbug.com/1223647:
Incompatible argument and return types for 'returned' attribute
tail call void @llvm.memset.p0i8.i64(i8* noalias noundef returned writeonly align 1 dereferenceable(255) %arraydecay, i8 0, i64 255, i1 false), !dbg !985
Jez Ng [Fri, 25 Jun 2021 02:23:04 +0000 (22:23 -0400)]
[lld-macho] Move ICF members from InputSection to ConcatInputSection
`icfEqClass` only makes sense on ConcatInputSections since (in contrast
to literal sections) they are deduplicated as an atomic unit.
Similarly, `hasPersonality` and `replacement` don't make sense on
literal sections.
This mirrors LLD-ELF, which stores `icfEqClass` only on non-mergeable
sections.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D104670
Kai Luo [Fri, 25 Jun 2021 01:43:31 +0000 (01:43 +0000)]
[PowerPC] Move PPCBranchSelector as close to asm printer as possible
Currently, PPCBranchSelector is not immediately preceding asm printer pass. `-debug-pass=Structure` gives
```
PowerPC Branch Selector
Contiguously Lay Out Funclets
StackMap Liveness Analysis
Live DEBUG_VALUE analysis
Lazy Machine Block Frequency Analysis
Machine Optimization Remark Emitter
Linux PPC Assembly Printer
```
After the patch
```
Contiguously Lay Out Funclets
StackMap Liveness Analysis
Live DEBUG_VALUE analysis
PowerPC Branch Selector
Lazy Machine Block Frequency Analysis
Machine Optimization Remark Emitter
Linux PPC Assembly Printer
```
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D104762
Jinsong Ji [Fri, 25 Jun 2021 01:08:32 +0000 (01:08 +0000)]
[PowerPC] Add XL compat __compare_and_swap builtins
Prototype
int __compare_and_swap (volatile int* addr, int* old_val_addr, int
new_val);
int __compare_and_swaplp (volatile long* addr, long* old_val_addr, long
new_val);
Refer to
https://www.ibm.com/docs/en/xl-c-and-cpp-aix/16.1?topic=functions-compare-swap-compare-swaplp
Reviewed By: w2yehia
Differential Revision: https://reviews.llvm.org/D104837
Craig Topper [Thu, 24 Jun 2021 22:53:47 +0000 (15:53 -0700)]
[RISCV] Add vget/vset intrinsics for inserting and extracting between different lmuls.
These allow getting a whole register from a larger lmul. Or
inserting a whole register into a larger lmul register. Fractional
lmuls are not supported as they would require a vslide.
Based on this update to the intrinsic doc
https://github.com/riscv/rvv-intrinsic-doc/pull/99
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D104822
Muhammad Omair Javaid [Fri, 25 Jun 2021 00:55:25 +0000 (00:55 +0000)]
Unsupported sanitize-coverage-old-pm.c on 32 bit Arm
sanitize-coverage-old-pm.c is passing intermittently on different
arm v7 machines. This patch moves it to unsupported on all arm 32
targets reporting armv8l core.
Vitaly Buka [Fri, 25 Jun 2021 00:30:03 +0000 (17:30 -0700)]
Revert "[hwasan] print exact mismatch offset for short granules."
Breaks sanitizer-x86_64-linux-android and sanitizer-x86_64-linux-qemu bots.
This reverts commit
7e3f8b8affd0392c997564b5f34c61d6115a3516.
Vitaly Buka [Fri, 25 Jun 2021 00:28:01 +0000 (17:28 -0700)]
[scudo] Clang-format tests
LLVM GN Syncbot [Fri, 25 Jun 2021 00:29:34 +0000 (00:29 +0000)]
[gn build] Port
69d5a6662115
Christopher Di Bella [Wed, 9 Jun 2021 23:10:17 +0000 (23:10 +0000)]
[libcxx][modularisation] splits `<utility>` into self-contained headers
* moves `std::hash` and `std::unary_function` into `__functional`
* Everything else goes into `__utility/${NAME}.h`
Differential Revision: https://reviews.llvm.org/D104002
Mark Leair [Thu, 24 Jun 2021 23:55:45 +0000 (16:55 -0700)]
Change the flang reshape runtime routine interface to use a result
argument instead of a result result object.
Change the reshape flang unit test to use the new interface. Also, add an
order argument to exercise the order subscript code in the rehsape runtime
routine.
Differential Revision: https://reviews.llvm.org/D104586
Muhammad Omair Javaid [Thu, 24 Jun 2021 23:59:32 +0000 (04:59 +0500)]
Revert "[Clang] XFAIL sanitize-coverage-old-pm.c on 32bit Armv8l"
This reverts commit
c5028f3473ed50a7433fe278984cd1a755b338b9.
Nemanja Ivanovic [Thu, 24 Jun 2021 23:41:12 +0000 (18:41 -0500)]
[PowerPC] Fix vec_add for 64-bit on pre-Power7 subtargets
The shift of the carry was actually incorrect.
Geoffrey Martin-Noble [Thu, 24 Jun 2021 23:33:13 +0000 (16:33 -0700)]
Update Bazel build for
744146f60b
Updates Bazel build files to match
https://github.com/llvm/llvm-project/commit/
744146f60b
Differential Revision: https://reviews.llvm.org/D104885
Nemanja Ivanovic [Thu, 24 Jun 2021 23:03:06 +0000 (18:03 -0500)]
[PowerPC] Fix bswap combine for big endian systems
Commit
0464586ac515e8cfebe4c7615387fd625c8869f5 added a combine
for a 64-bit load feeding a bswap but the implementation is only
correct for little endian systems.
This fixes it for big endian systems.
Gus Smith [Thu, 24 Jun 2021 22:18:40 +0000 (22:18 +0000)]
[MLIR][Sparse] Refactor lattice code into its own file
Moves iteration lattice/merger code into new SparseTensor/Utils directory. A follow-up CL will add lattice/merger unit tests.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D104757
AndreyChurbanov [Thu, 24 Jun 2021 23:02:14 +0000 (02:02 +0300)]
[OpenMP][NFC] libomp: fix wrong debug assertion.
Normalized bounds of chunk of iterations to steal from are inclusive,
so upper bound should not be decremented in expression to check.
Problem was in attempt to steal iterations 0:0, that caused assertion after
wrong decrement. Reported in comment to https://reviews.llvm.org/D103648.
Differential Revision: https://reviews.llvm.org/D104880
Tony Tye [Thu, 24 Jun 2021 02:01:24 +0000 (02:01 +0000)]
[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x43
Reviewed By: kzhuravl, rampitec
Differential Revision: https://reviews.llvm.org/D104872
Muhammad Omair Javaid [Thu, 24 Jun 2021 22:49:05 +0000 (22:49 +0000)]
Disable TestAArch64UnwindPAC.py for non PAC targets
TestAArch64UnwindPAC.py started failing on LLDB buildbot as underlying
hardware does not support PAC. This patch skips this test for targets
which do not support PAC feature.