Shraiysh Vaishay [Tue, 15 Feb 2022 12:01:31 +0000 (17:31 +0530)]
[mlir][OpenMP] Change omp.atomic.update to have generic updates
This patch changes the syntax of omp.atomic.update to allow the other
dialects to modify the variable with appropriate operations in the
region.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D119522
Matthias Springer [Tue, 15 Feb 2022 12:16:50 +0000 (21:16 +0900)]
[mlir][bufferize] Add vector-bufferize pass and remove obsolete patterns from Linalg Bufferize
Differential Revision: https://reviews.llvm.org/D119444
Simon Pilgrim [Tue, 15 Feb 2022 12:16:54 +0000 (12:16 +0000)]
[InstCombine] Add shift+trunc+mask tests requested for D119715
Sven van Haastregt [Tue, 15 Feb 2022 12:12:03 +0000 (12:12 +0000)]
[OpenCL] opencl-c.h: fix atomic_fetch_max with addrspace
Commit
3c7d2f1b67d1 ("[OpenCL] opencl-c.h: add CL 3.0 non-generic
address space atomics", 2021-07-30) added some atomic_fetch_add/sub
overloads with uintptr_t arguments twice. Instead, they should have
been atomic_fetch_max overloads with non-generic address spaces.
Nikita Popov [Tue, 15 Feb 2022 12:04:52 +0000 (13:04 +0100)]
[DSE] Extract a common PDT check (NFC)
Simon Moll [Tue, 15 Feb 2022 09:55:14 +0000 (10:55 +0100)]
[VE] v256i1 broadcast isel and tests
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D119241
Jan Svoboda [Tue, 15 Feb 2022 11:39:20 +0000 (12:39 +0100)]
[clang][lex] Remove misleading comment
The resiliency to `HeaderSearch::Add{,System}SearchPath` is implemented in later patch (D116750).
David Spickett [Tue, 15 Feb 2022 11:36:55 +0000 (11:36 +0000)]
[lldb] Remove memory region non-address change from release notes
This is now on 14.x as
af19ae529271f9ae96927662d7d876489115fb26
so it is not new to 15.
Jay Foad [Tue, 15 Feb 2022 11:06:44 +0000 (11:06 +0000)]
[AMDGPU] Reenable some disabled RUN lines
These look like they were temporarily disabled to placate
update_mir_test_checks and then committed by mistake.
iains [Tue, 15 Feb 2022 09:55:22 +0000 (09:55 +0000)]
[clang] Remove a duplicate action kind table entry.
We have two entries for OPT_emit_codegen_only in the frontend action kind
table, delete one.
Differential Revision: https://reviews.llvm.org/D119826
Markus Böck [Sun, 13 Feb 2022 10:07:36 +0000 (11:07 +0100)]
[X86][Win64] Avoid statepoints in trailing call position
The "avoid trailing call pass" makes sure that no function ends with a call instruction for the purpose of the unwinder.
It starts of by skipping over any non real instruction, which is approximated via the Pseudo and Meta property. This sadly leads to issues when the last machine instruction is a STATEPOINT, as it is skipped despite it lowering to a call.
This patch fixes the use of a statepoint in the trailing call position by making sure call instructions are not skipped.
Differential Revision: https://reviews.llvm.org/D119644
Markus Böck [Sun, 13 Feb 2022 19:34:00 +0000 (20:34 +0100)]
[llvm][doc] Update comments and documentation of custom stackmap formats in GC
Since https://reviews.llvm.org/D53892 it is possible to emit a custom stackmap by overwriting the emitStackMaps method of GCMetadataPrinter. That way even AOT compilers can generate a more efficient and more suitable format for their needs.
This patch updates documentation and stale comments in source code. In particular it removes the issue from the issue list in the Statepoints documentation and adjusts comments in GCStrategy.
Differential Revision: https://reviews.llvm.org/D119660
Adrian Kuegel [Tue, 15 Feb 2022 10:14:20 +0000 (11:14 +0100)]
[mlir][Math] Fix NaN handling in ExpM1 approximation.
Differential Revision: https://reviews.llvm.org/D119822
Nikita Popov [Tue, 15 Feb 2022 11:00:47 +0000 (12:00 +0100)]
[InstSimplify] Strip offsets once in computePointerICmp()
Instead of doing an inbounds strip first and another non-inbounds
strip afterward for equality comparisons, directly do a single
inbounds or non-inbounds strip based on whether we have an equality
predicate or not.
This is NFC-ish in that the alloca equality codepath is the only
part that sees additional non-inbounds offsets now, and for that
codepath it doesn't matter whether or not the GEP is inbounds, as
it does a stronger check itself. InstCombine would infer inbounds
for such GEPs.
Vladislav Khmelevsky [Tue, 15 Feb 2022 10:23:31 +0000 (13:23 +0300)]
[BOLT] Fix aarch64 dwarf test
After "Remove caching of ranges/abbrevs" patch the dwarf offsets are a
bit changed and the subprograms high pc is replaced with AT_RANGES.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D119733
Matthias Springer [Tue, 15 Feb 2022 10:44:31 +0000 (19:44 +0900)]
[mlir][bufferize] Support tensor.expand_shape and tensor.collapse_shape
Differential Revision: https://reviews.llvm.org/D112512
Jay Foad [Mon, 14 Feb 2022 10:49:12 +0000 (10:49 +0000)]
[AMDGPU] Divergence-driven instruction selection for bfm patterns
Differential Revision: https://reviews.llvm.org/D119706
Akshay Baviskar [Mon, 14 Feb 2022 16:54:59 +0000 (22:24 +0530)]
Add verifier for gpu.alloc op
Add verifier for gpu.alloc op to verify if the dimension operand counts
and symbol operand counts are same as their memref counterparts.
Differential Revision: https://reviews.llvm.org/D117427
Matthias Springer [Tue, 15 Feb 2022 10:05:26 +0000 (19:05 +0900)]
[mlir][bufferize] Generalize filtering mechanism in BufferizationOptions
Support ALLOW filters and DENY filters. This is needed for compatibility with existing code that specifies more complex op filters.
Differential Revision: https://reviews.llvm.org/D119820
David Green [Tue, 15 Feb 2022 10:17:02 +0000 (10:17 +0000)]
[DAGCombine] Move AVG combine to SimplifyDemandBits
This moves the matching of AVGFloor and AVGCeil into a place where
demand bit are available, so that it can detect more cases for more
folds. It changes the transform to start from a shift, not from a
truncate. We match the pattern shr(add(ext(A), ext(B)), 1), transforming
to ext(hadd(A, B)).
For signed values, because only the bottom bits are demanded llvm will
transform the above to use a lshr too, as opposed to ashr. In order to
correctly detect the hadd we need to know the demanded bits to turn it
back. Depending on whether the shift is signed (ashr) or logical (lshr),
and the extensions are signed or unsigned we can create different nodes.
If the shift is signed:
Needs >= 2 sign bits. https://alive2.llvm.org/ce/z/h4gQAW generating signed rhadd.
Needs >= 2 zero bits. https://alive2.llvm.org/ce/z/B64DUA generating unsigned rhadd.
If the shift is unsigned:
Needs >= 1 zero bits. https://alive2.llvm.org/ce/z/ByD8sj generating unsigned rhadd.
Needs 1 demanded bit zero and >= 2 sign bits https://alive2.llvm.org/ce/z/hvPGxX and
https://alive2.llvm.org/ce/z/32P5n1 generating signed rhadd.
Differential Revision: https://reviews.llvm.org/D119072
Jan Svoboda [Tue, 15 Feb 2022 09:40:05 +0000 (10:40 +0100)]
[clang][lex] Use `SearchDirIterator` types in for loops
This patch replaces a lot of index-based loops with iterators and ranges.
Depends on D117566.
Reviewed By: ahoppen
Differential Revision: https://reviews.llvm.org/D119722
Jan Svoboda [Tue, 15 Feb 2022 09:37:36 +0000 (10:37 +0100)]
[clang][lex] Use `ConstSearchDirIterator` in lookup cache
This patch starts using the new iterator type in `LookupFileCacheInfo`.
Depends on D117566.
Reviewed By: ahoppen
Differential Revision: https://reviews.llvm.org/D119721
Jan Svoboda [Tue, 15 Feb 2022 09:11:00 +0000 (10:11 +0100)]
[clang][lex] Introduce `ConstSearchDirIterator`
The `const DirectoryLookup *` out-parameter of `{HeaderSearch,Preprocessor}::LookupFile()` is assigned the most recently used search directory, which callers use to implement `#include_next`.
From the function signature it's not obvious the `const DirectoryLookup *` is being used as an iterator. This patch introduces `ConstSearchDirIterator` to make that affordance obvious. This would've prevented a bug that occurred after initially landing D116750.
Reviewed By: ahoppen
Differential Revision: https://reviews.llvm.org/D117566
Jay Foad [Mon, 14 Feb 2022 17:50:21 +0000 (17:50 +0000)]
[AMDGPU] Honor !invariant.load metadata on load-like intrinsics
Differential Revision: https://reviews.llvm.org/D119739
Jay Foad [Mon, 14 Feb 2022 17:52:38 +0000 (17:52 +0000)]
[AMDGPU] Precommit test for !invariant.load metadata on load-like intrinsics
Differential Revision: https://reviews.llvm.org/D119738
Nikita Popov [Tue, 15 Feb 2022 09:09:48 +0000 (10:09 +0100)]
[BitcodeReader] Change order of assignValue() arguments (NFC)
Other methods in ValueList generally pass Idx first, and it is
more convention for assignment methods to have the target on the
LHS rather than RHS.
Jan Svoboda [Tue, 15 Feb 2022 08:52:38 +0000 (09:52 +0100)]
[clang][lex] NFC: De-duplicate some #include_next logic
This patch addresses a FIXME and de-duplicates some `#include_next` logic
Depends on D119714.
Reviewed By: ahoppen
Differential Revision: https://reviews.llvm.org/D119716
Jan Svoboda [Tue, 15 Feb 2022 08:51:17 +0000 (09:51 +0100)]
[clang][deps] Disable global module index
While scanning dependencies of a TU that depends on a PCH, the scanner basically performs mixed implicit/explicit modular compilation. (Explicit modules come from the PCH.) This seems to trip up the global module index.
This patch disables global module index in the dependency scanner.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D118890
Jan Svoboda [Tue, 15 Feb 2022 08:49:16 +0000 (09:49 +0100)]
[clang][lex][minimizer] Avoid treating path separators as comments
The minimizer strips out single-line comments (introduced by `//`). This sequence of characters can also appear in `#include` or `#import` directives where they play the role of path separators. We already avoid stripping this character sequence for `#include` but not for `#import` (which has the same semantics). This patch makes it so `#import <A//A.h>` is not affected by minimization. Previously, we would incorrectly reduce it into `#import <A`.
Reviewed By: arphaman
Differential Revision: https://reviews.llvm.org/D119226
Jan Svoboda [Tue, 15 Feb 2022 08:49:00 +0000 (09:49 +0100)]
[clang][lex][minimizer] Ensure whitespace between squashed lines
The minimizer tries to squash multi-line macro definitions into single line. For that to work, contents of each line need to be separated by a space. Since we always strip leading whitespace on lines of a macro definition, the code currently tries to preserve exactly one space that appeared before the backslash.
This means the following code:
```
#define FOO(BAR) \
#BAR \
baz
```
gets minimized into:
```
#define FOO(BAR) #BAR baz
```
However, if there are no spaces before the backslash on line 2:
```
#define FOO(BAR) \
#BAR\
baz
```
no space can be preserved, leading to (most likely) malformed macro definition:
```
#define FOO(BAR) #BARbaz
```
This patch makes sure we always put exactly one space at the end of line ending with a backslash.
Reviewed By: arphaman
Differential Revision: https://reviews.llvm.org/D119231
Jan Svoboda [Tue, 15 Feb 2022 08:18:35 +0000 (09:18 +0100)]
[clang][lex] Remove `Preprocessor::GetCurDirLookup()`
`Preprocessor` exposes the search directory iterator via `GetCurDirLookup()` getter, which is only used in two static functions.
To simplify reasoning about search directory iterators/references and to simplify the `Preprocessor` API, this patch makes the two static functions private member functions and removes the getter entirely.
Depends D119708.
Reviewed By: ahoppen, dexonsmith
Differential Revision: https://reviews.llvm.org/D119714
Jan Svoboda [Tue, 15 Feb 2022 08:17:22 +0000 (09:17 +0100)]
[clang][lex] Remove `PPCallbacks::FileNotFound()`
The purpose of the `FileNotFound` preprocessor callback was to add the ability to recover from failed header lookups. This was to support downstream project.
However, injecting additional search path while performing header search can invalidate currently used iterators/references to `DirectoryLookup` in `Preprocessor` and `HeaderSearch`.
The downstream project ended up maintaining a separate patch to further tweak the functionality. Since we don't have any upstream users nor open source downstream users, I'd like to remove this callback for good to prevent future misuse. I doubt there are any actual downstream users, since the functionality is definitely broken at the moment.
Reviewed By: ahoppen
Differential Revision: https://reviews.llvm.org/D119708
Nikita Popov [Sun, 13 Feb 2022 13:13:16 +0000 (14:13 +0100)]
[Support] Fix build on illumos
D116366 added a call to madvise() in Path.inc. Unfortunately,
Illumos does not declare this function if _XOPEN_SOURCE is defined
(which it is by default) and we need to provide the declaration
manually. This is the same workaround used in sanitizers:
https://github.com/llvm/llvm-project/blob/
ee423d93ead39e94c2970b3cc7ef6e6faa75d10b/compiler-rt/lib/sanitizer_common/sanitizer_solaris.cpp#L77-L85
Differential Revision: https://reviews.llvm.org/D119695
Nikita Popov [Wed, 9 Feb 2022 13:44:20 +0000 (14:44 +0100)]
[Bitcode] Improve support for opaque-pointer bitcode upgrade
This is step two of supporting autoupgrade of old bitcode to opaque
pointers. Rather than tracking the element type ID of pointers in
particular, track all type IDs that a type contains. This allows us
to recover the element type in more complex situations, e.g. when
we need to determine the pointer element type of a vector element
or function type parameter.
Differential Revision: https://reviews.llvm.org/D119339
Ivan Butygin [Sun, 13 Feb 2022 20:25:19 +0000 (23:25 +0300)]
[mlir][spirv] Add OpenCL fma op and lowering
Also, it seems Khronos has changed html spec format so small adjustment to script was needed.
Base op parsing is also probably broken.
Differential Revision: https://reviews.llvm.org/D119678
serge-sans-paille [Mon, 14 Feb 2022 15:27:04 +0000 (16:27 +0100)]
Cleanup LLVMDWARFDebugInfo
As usual with that header cleanup series, some implicit dependencies now need to
be explicit:
llvm/DebugInfo/DWARF/DWARFContext.h no longer includes:
- "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
- "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
- "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
- "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
- "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
- "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
- "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
- "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
- "llvm/DebugInfo/DWARF/DWARFSection.h"
- "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
- "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
Plus llvm/Support/Errc.h not included by a bunch of llvm/DebugInfo/DWARF/DWARF*.h files
Preprocessed lines to build llvm on my setup:
after:
1065629059
before:
1066621848
Which is a great diff!
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D119723
Bill Wendling [Tue, 15 Feb 2022 08:06:01 +0000 (00:06 -0800)]
Insert a blurb about the -fzero-call-used-regs feature
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D119592
Pavel Labath [Tue, 15 Feb 2022 07:41:44 +0000 (08:41 +0100)]
[lldb] Fix thread syncrhonization TestThreadBacktraceRepeat
lldb reports (and lldbutil.continue_to_breakpoint returns) a stop reason
even for suspended threads. Fix the test to expect that.
This was making the test flaky, as most of the time, the two threads
stop simultaneously, and the synchronization code is not executed.
Valentin Clement [Tue, 15 Feb 2022 07:24:48 +0000 (08:24 +0100)]
[flang] Enable complex type in function lowering
This patch enables complex type in lowering.
It is tested on function return types.
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D119698
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D119700
Co-authored-by: Jean Perier <jperier@nvidia.com>
Valentin Clement [Tue, 15 Feb 2022 07:23:00 +0000 (08:23 +0100)]
[flang] Enable scalar real type in lowering
This patch enables scalar real type in lowering.
It is tested on function return types.
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D119698
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D119699
Co-authored-by: Jean Perier <jperier@nvidia.com>
Shraiysh Vaishay [Tue, 15 Feb 2022 05:56:49 +0000 (11:26 +0530)]
[flang][mlir][NFC] Remove deprecated parser/printer/verifier utilities
These have been replaced by `hasCustomAssemblyFormat` and `hasVerifier`
fields and aren't needed anymore.
Ops deriving from `fir_IntegralSwitchTerminatorOp` and `region_Op` are
not handled in this patch for ease of review.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D119776
Siva Chandra Reddy [Tue, 25 Jan 2022 19:50:00 +0000 (19:50 +0000)]
[libc] Add a platform independent buffered file IO data structure.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D119458
Jonas Devlieghere [Tue, 15 Feb 2022 05:21:07 +0000 (21:21 -0800)]
[lldb] Determine the main binary in JSON crashlogs
The symbolicator assumes that the first image in the image list is the
main image. That isn't always the case. For JSON crashlogs we can use
the procName to move the main image to the front of the list.
rdar://
83907760
Serguei Katkov [Tue, 15 Feb 2022 05:21:33 +0000 (12:21 +0700)]
[Safepoint Verifier] Add a missed comment to previous commit.
Serguei Katkov [Mon, 14 Feb 2022 12:22:47 +0000 (19:22 +0700)]
[Safepoint Verifier] gc.relocate does not change the constant property.
Add traverse through gc.relocate in determining whether base is
isExclusivelyDerivedFromNull OR ExclusivelyNull.
Reviewers: reames, anna
Reviewed By: reames, anna
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D119712
Min-Yih Hsu [Tue, 14 Dec 2021 12:59:22 +0000 (20:59 +0800)]
[TableGen] Add a new `encoder` directive into VarLenCodeEmitterGen
The new encoder directive can be used to specify custom encoder for a
single operand or slice. This is different from the EncoderMethod field
within an Operand, which affects every operands in the target.
In addition, this patch also changes the function signature of the
encoder method -- a new argument, InsertPost, is added to both the
default one (i.e. getMachineValue) and the custom one. This argument
provides the bit position where the operand will eventually be inserted.
Differential Revision: https://reviews.llvm.org/D119100
Brad Smith [Tue, 15 Feb 2022 04:29:13 +0000 (23:29 -0500)]
[Driver][NetBSD] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D119655
Brad Smith [Tue, 15 Feb 2022 04:24:26 +0000 (23:24 -0500)]
[Driver][DragonFly] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D119656
Yonghong Song [Sun, 13 Feb 2022 00:56:17 +0000 (16:56 -0800)]
[BPF] Fix a bug in BTF_KIND_TYPE_TAG generation
Kumar Kartikeya Dwivedi reported a bug ([1]) where BTF_KIND_TYPE_TAG types
are not generated.
Currently, BPF backend only generates BTF types which are used by
the program, e.g., global variables, functions and some builtin functions.
For example, suppose we have
struct task_struct {
...
struct task_group *sched_task_group;
struct mm_struct *mm;
...
pid_t pid;
pid_t tgid;
...
}
If BPF program intends to access task_struct->pid and task_struct->tgid,
there really no need to generate BTF types for struct task_group
and mm_struct.
In BPF backend, during BTF generation, when generating BTF for struct
task_struct, if types for task_group and mm_struct have not been generated
yet, a Fixup structure will be created, which will be reexamined later
to instantiate into either a full type or a forward type.
In current implementation, if we have something like
struct foo {
struct bar __tag1 *f;
};
and when generating types for struct foo, struct bar type
has not been generated, the __tag1 will be lost during later
Fixup instantiation. This patch fixed this issue by properly
handling btf_type_tag's during Fixup instantiation stage.
[1] https://lore.kernel.org/bpf/
20220210232411.pmhzj7v5uptqby7r@apollo.legion/
Differential Revision: https://reviews.llvm.org/D119799
Snehasish Kumar [Mon, 14 Feb 2022 19:52:38 +0000 (11:52 -0800)]
Reland "[memprof] Introduce a wrapper around MemInfoBlock."
This reverts commit
e6999040f5758f89a64b6232119b775b7bd1c85b.
Update test to fix signed int comparison warning, fix whitespace in
compiler-rt MIBEntryDef.inc file.
Differential Revision: https://reviews.llvm.org/D117256
Hongtao Yu [Mon, 14 Feb 2022 17:33:54 +0000 (09:33 -0800)]
[CSSPGO] Do not merge a context that is already duplicated into the base profile.
Do not merge a context that is already duplicated into the base profile.
Also fixing a typo caused by previous refactoring.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D119735
Jun Zhang [Fri, 11 Feb 2022 08:40:26 +0000 (16:40 +0800)]
[Clang][Sema] Add a missing regression test about Wliteral-range
This patch adds a missing test, covering the different kinds of floating-point
literals, like hexadecimal floats, and testing extreme cases & normal cases.
Differential Revision: https://reviews.llvm.org/D119528
Jim Ingham [Tue, 15 Feb 2022 00:57:20 +0000 (16:57 -0800)]
This test seems to pass on Linux, remove the x-fail.
One of the tests in this test setup was copied from a more complex test, and I didn't know
if the setup or the subsequent parts of the test were the ones that fail on Linux. Looks
like it was the latter, so let's mark this succeeding.
Mike Rice [Mon, 14 Feb 2022 19:36:12 +0000 (11:36 -0800)]
[OpenMP]Fix parsing of OpenMP directive nested in a metadirective
Differential Revision: https://reviews.llvm.org/D119761
Jonas Devlieghere [Mon, 14 Feb 2022 22:25:27 +0000 (14:25 -0800)]
[dsymutil] Add the ability to run the DWARF verifier on the input
Currently you can run the DWARF verifier on the linked dsymutil output.
This patch extends this functionality and makes it possible to
run the DWARF verifier on the input as well.
A new option --verify-dwarf allows you to specify input, output, all and
none. The existing --verify flag remains unchanged and acts and alias
for --verify-dwarf=output.
Input verification issues do not result in a non-zero exit code because
dsymutil is capable of taking invalid DWARF as input and producing valid
DWARF as output.
Differential revision: https://reviews.llvm.org/D89216
Snehasish Kumar [Mon, 14 Feb 2022 19:52:34 +0000 (11:52 -0800)]
Reland "[memprof] Refactor out the MemInfoBlock into a macro based def."
This reverts commit
857ec0d01f8021ff0d9540fcbf6ff24e29868ba4.
Fixes -DLLVM_ENABLE_MODULES=On build by adding the new textual
header to the modulemap file.
Reviewed in https://reviews.llvm.org/D117722
Volodymyr Sapsai [Tue, 1 Feb 2022 23:03:59 +0000 (15:03 -0800)]
[modules] Add a flag for TagDecl if it was a definition demoted to a declaration.
For redeclaration chains we maintain an invariant of having only a
single definition in the chain. In a single translation unit we make
sure not to create duplicates. But modules are separate translation
units and they can contain definitions for the same symbol
independently. When we load such modules together, we need to demote
duplicate definitions to keep the AST invariants.
Some AST clients are interested in distinguishing
declaration-that-was-demoted-from-definition and
declaration-that-was-never-a-definition. For that purpose introducing
`IsThisDeclarationADemotedDefinition`. No functional change intended.
rdar://
84677782
Differential Revision: https://reviews.llvm.org/D118855
Peter Klausler [Tue, 8 Feb 2022 19:56:22 +0000 (11:56 -0800)]
[flang] Accept structure constructor value for polymorphic component
Semantic analysis was emitting a bogus error message when a structure
constructor contains a monomorphic value for a (limited) polymorphic
component of a derived type. The type compatibility test was too
strict; this patch relaxes it a little to allow values that could
be assigned or passed to a variable or dummy argument with that type.
Also add some quotes to an error message that was sometimes confusing
without them, and remove a repeated space character from another.
Differential Revision: https://reviews.llvm.org/D119744
Jim Ingham [Mon, 14 Feb 2022 23:49:37 +0000 (15:49 -0800)]
Fix an incorrect assumption in "thread until": code with debug info is not always in a function.
Some dyld cross library stubs can have line information but no function. Make sure you
check that you have a valid Function object before asking it questions.
Differential Revision: https://reviews.llvm.org/D119297
Jim Ingham [Fri, 4 Feb 2022 23:16:31 +0000 (15:16 -0800)]
Add a repeat command option for "thread backtrace --count N".
This way if you have a long stack, you can issue "thread backtrace --count 10"
and then subsequent <Return>-s will page you through the stack.
This took a little more effort than just adding the repeat command, since
the GetRepeatCommand API was returning a "const char *". That meant the command
had to keep the repeat string alive, which is inconvenient. The original
API returned either a nullptr, or a const char *, so I changed the private API to
return an llvm::Optional<std::string>. Most of the patch is propagating that change.
Also, there was a little thinko in fetching the repeat command. We don't
fetch repeat commands for commands that aren't being added to history, which
is in general reasonable. And we don't add repeat commands to the history -
also reasonable. But we do want the repeat command to be able to generate
the NEXT repeat command. So I adjusted the logic in HandleCommand to work
that way.
Differential Revision: https://reviews.llvm.org/D119046
Nikolas Klauser [Mon, 14 Feb 2022 17:52:28 +0000 (18:52 +0100)]
[libc++] Guard warning pragmas
This makes the GCC output even cleaner!
Reviewed By: ldionne, #libc
Spies: mstorsjo, Quuxplusone, Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D119295
Nikolas Klauser [Fri, 11 Feb 2022 00:01:17 +0000 (01:01 +0100)]
[libc++] Replace _VSTD with std in __ranges/
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D119497
Bixia Zheng [Fri, 11 Feb 2022 23:05:06 +0000 (15:05 -0800)]
[mlir][sparse][taco] Support true dense tensors and all dense sparse tensors.
The only method to create a true dense tensor (i.e un-annotated) in MLIR-PyTACO
is through the from_array method. However, the annotated all dense tensors are
also implemented as true dense tensor currently. The PR fixes the
implementation to support annotated all dense sparse tensors.
Extend the tensor init method to support the construction of a tensor without
any sparsity annotation.
Change the tensor to_file method to only support writing unpacked sparse
tensors to file through the MLIR sparse tensor dialect.
Add unit tests for true dense tensors and all dense sparse tensors.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D119500
Peter Klausler [Tue, 8 Feb 2022 18:07:55 +0000 (10:07 -0800)]
[flang] Ensure a characterized ENTRY in a PURE subprogram is also marked PURE
ENTRY point symbols aren't marked PURE in the symbol table, but must
instead inherit the attribute from their containing subprograms.
There's a predicate in semantics that does this, but it wasn't being
used in the context of actual procedure argument characterization.
Differential Revision: https://reviews.llvm.org/D119564
Florian Mayer [Sat, 12 Feb 2022 01:41:56 +0000 (17:41 -0800)]
[HWASAN] use common alignAndPadAlloca
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D119614
Louis Dionne [Mon, 14 Feb 2022 23:25:57 +0000 (18:25 -0500)]
[libc++][NFC] Fix typo in comment
Martin Storsjö [Thu, 10 Feb 2022 11:08:24 +0000 (13:08 +0200)]
[libcxx] [ci] Enable LIBCXX_ENABLE_WERROR where possible
Only opt out from it in the few configs (GCC based) where there still
are build warnings.
Differential Revision: https://reviews.llvm.org/D119573
Stefan Pintilie [Mon, 14 Feb 2022 21:38:54 +0000 (15:38 -0600)]
[PowerPC] Remove the LDMX instruction.
The LDMX instruction was to be potentially added in P9 but it was never added
in either ISA 3.0 or ISA 3.1. This patch removes that instruction as it is
currently still an invalid instruction.
Reviewed By: lei
Differential Revision: https://reviews.llvm.org/D118074
Florian Mayer [Sat, 12 Feb 2022 01:38:19 +0000 (17:38 -0800)]
[NFC] [MTE] Move alignAndPadAlloca to MemoryTaggingSupport.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D119610
Peter Klausler [Mon, 7 Feb 2022 23:34:54 +0000 (15:34 -0800)]
[flang] Accept NULL(mold=x) as constant component value in constant structure constructor
The predicate IsInitialDataTarget() was failing to return a correct true
result in the case of a reference to the intrinsic function NULL() with a
MOLD= argument. Fix, and improve tests for "NULL()" elsewhere in semantics,
checking for an attribute set by intrinsics.cpp rather than the actual name.
Differential Revision: https://reviews.llvm.org/D119452
Dmitry Vassiliev [Mon, 14 Feb 2022 22:30:13 +0000 (01:30 +0300)]
[NVPTX] Fix NVPTXReplaceImageHandles for multiple uses of a texref
The texsurf_handle is removed by NVPTXReplaceImageHandles.cpp. There are more than one uses of the texsurf_handle, one of them is a regular function call, and one of them is a texture intrinsic.
The current hacky logic in NVPTXReplaceImageHandles.cpp for CUDA cannot handle such a mixed use. This patch fixes this issue.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D119635
Dmitry Vassiliev [Mon, 14 Feb 2022 22:23:11 +0000 (01:23 +0300)]
[NVPTX] Fix bug with int_nvvm_rotate_b64 when operand immediate
Need to subract from 64, not 32.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D119639
Sam Clegg [Fri, 11 Feb 2022 23:53:28 +0000 (15:53 -0800)]
[WebAssembly] Use GeneralDynamic TLS for exception handling builtins.
These global TLS symbols are shared across all shared libraries and
therefor should not be assumed to be local to the current module.
Also add new error in the linker when TLS relocations are used against
undefined symbols. TLS relocations are offsets into the current modules
tls data segment, and don't make sense for undefined symbols which are
modeled as global imports.
Fixes: https://github.com/emscripten-core/emscripten/issues/13398
Differential Revision: https://reviews.llvm.org/D119630
Nick Desaulniers [Mon, 14 Feb 2022 21:47:00 +0000 (13:47 -0800)]
[funcattrs] check reachability to improve noreturn
There was a fixme in the code pertaining to attributing functions as
noreturn. By using reachability, if none of the blocks that are
reachable from the entry return, then the function is noreturn.
Previously, the code only checked if any blocks returned. If they're
unreachable, then they don't matter.
This improves codegen for the Linux kernel.
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1563
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D119571
Nikolas Klauser [Thu, 10 Feb 2022 22:28:11 +0000 (23:28 +0100)]
[libc++] Prepare string.nonmembers for constexpr
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D119487
LLVM GN Syncbot [Mon, 14 Feb 2022 21:39:38 +0000 (21:39 +0000)]
[gn build] Port
5d1c1a243c4d
Marek Kurdej [Mon, 7 Feb 2022 21:04:31 +0000 (16:04 -0500)]
[libc++] [C++2b] [P0943] Add stdatomic.h header.
* https://wg21.link/P0943
* https://eel.is/c++draft/stdatomic.h.syn
Differential Revision: https://reviews.llvm.org/D97044
Fangrui Song [Mon, 14 Feb 2022 21:23:22 +0000 (13:23 -0800)]
Revert D119669 "[NVPTX] Prefix "$L__" for branch label names"
This reverts commit
cccef321096c20825fe8738045c1d91d3b9fd57d.
Broke clang-cuda-t4
```
/buildbot/cuda-t4-0/work/clang-cuda-t4/clang/bin/clang++ -DNDEBUG -O3 -DNDEBUG -w -Werror=date-time -UNDEBUG --cuda-path=/buildbot/cuda-t4-0/work/clang-cuda-t4/external/cuda/cuda-11.0 -I/buildbot/cuda-t4-0/work/clang-cuda-t4/external/cuda/cuda-11.0/include --cuda-gpu-arch=sm_75 -std=c++20 -stdlib=libstdc++ --gcc-toolchain=/buildbot/cuda-t4-0/work/clang-cuda-t4/external/cuda/gcc-8 -DSTDLIB_VERSION=2014 -MD -MT External/CUDA/CMakeFiles/complex-cuda-11.0-c++20-libstdc++-8.dir/complex.cu.o -MF External/CUDA/CMakeFiles/complex-cuda-11.0-c++20-libstdc++-8.dir/complex.cu.o.d -o External/CUDA/CMakeFiles/complex-cuda-11.0-c++20-libstdc++-8.dir/complex.cu.o -c /buildbot/cuda-t4-0/work/clang-cuda-t4/llvm-test-suite/External/CUDA/complex.cu
ptxas /tmp/complex-cfa050/complex-sm_75.s, line 250; fatal : Parsing error near '$L__BB6_2': syntax error
ptxas fatal : Ptx assembly aborted due to errors
```
Alex Lorenz [Mon, 14 Feb 2022 21:21:39 +0000 (13:21 -0800)]
[clang][test] Add -fuse-ld= to test cases added in
d238acd1131ec2670acf5cf47b89069ca6c2e86c to resolve test failure with CLANG_DEFAULT_LINKER=lld
Louis Dionne [Tue, 8 Feb 2022 18:06:44 +0000 (13:06 -0500)]
[release] Use a supported way of building libc++ when building the documentation
Instead of using the deprecated LLVM_ENABLE_PROJECTS build, use the
default runtimes build. This is just as fast, but it's supported.
Differential Revision: https://reviews.llvm.org/D119275
Dmitry Vassiliev [Mon, 14 Feb 2022 20:51:36 +0000 (23:51 +0300)]
[NVPTX] Prefix "$L__" for branch label names
A global variable may have the same name as a label, and ptxas does not accept it.
Prefix labels with $L__ to fix this.
Reviewed By: MaskRay, tra
Differential Revision: https://reviews.llvm.org/D119669
Jay Foad [Fri, 11 Feb 2022 10:39:46 +0000 (10:39 +0000)]
[MC] Define and use MCRegisterInfo::regsOverlap
Separate MCRegisterInfo::regsOverlap out from
TargetRegisterInfo::regsOverlap. This is useful in the AMDGPU AsmParser
where we only have access to MCRegisterInfo.
Differential Revision: https://reviews.llvm.org/D119533
Joe Nash [Mon, 14 Feb 2022 18:34:11 +0000 (13:34 -0500)]
[AMDGPU] Fix AGPR offset for waitcnt
An enum value stores the offset between AGPR ranges and VGPR
ranges in the internal storage of SIInsertWaitcnts. It said 226 when
it should say 256, causing some portion of the ranges to overlap. That
in turn causes 'aliasing' between the registers, potentially inserting
waitcnts that are not required.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D119749
Louis Dionne [Thu, 10 Feb 2022 19:03:05 +0000 (14:03 -0500)]
[libc++abi] Add a from-scratch testing config for Apple backdeployment
We added one for libc++ recently, and this patch adds one for libc++abi.
Also, as a fly-by fix, include older libunwind dylibs in the testing of
libc++ and libc++abi, which fixes some issues related to running
back-deployment tests on newer systems.
Differential Revision: https://reviews.llvm.org/D119466
Joseph Huber [Mon, 14 Feb 2022 19:01:04 +0000 (14:01 -0500)]
[Libomptarget][NFC] Remove constexpr to hide warnings
Currently whenever we compile the device runtime we get the following
'Mapping.cpp:32:32: warning: inline function '_OMP::impl::getGridValue'
is not defined [-Wundefined-inline]' warning. This can be silenced by
removing the constexpr attribute for this function. Doing this doesn't
change the generated bitcode at all but prevents the screen from getting
filled with warnings whenver we build the runtime.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D119747
Valentin Clement [Mon, 14 Feb 2022 20:31:46 +0000 (21:31 +0100)]
[flang] Lower basic function with scalar integer/logical return value
This patch allows the lowring of simple empty function with a
scalar integer or logical return value.
The code in ConvertType.cpp is cleaned up as well. This file was landed
together with the initial flang push and lowering was still a prototype
at that time. Some more cleaning will come with follow up patches.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D119698
Co-authored-by: Jean Perier <jperier@nvidia.com>
Alex Lorenz [Mon, 14 Feb 2022 20:24:43 +0000 (12:24 -0800)]
[clang][driver] add clang driver support for emitting macho files with two build version load commands
This patch extends clang driver to pass the right flags to the clang frontend, and ld64,
so that they can emit macho files with two build version load commands. It adds a new
0darwin-target-variant option which complements -target and also can be used to specify different
target variants when multi-arch compilations are invoked with multiple -arch commands.
Differential Revision: https://reviews.llvm.org/D118862
Martin Storsjö [Tue, 25 Jan 2022 09:24:45 +0000 (11:24 +0200)]
[libcxx] [test] Fix the get_weekday test on glibc
This test feeds in the expected utf8 form of weekdays in various
languages, trying to match what libc++ has gathered internally
from `strftime()`. On glibc, the ru_RU.UTF-8 representation of the
tested weekday is spelled with upper case, while the existing
test reference is lower case.
Differential Revision: https://reviews.llvm.org/D118237
Martin Storsjö [Thu, 20 Jan 2022 12:47:05 +0000 (14:47 +0200)]
[libcxx] [test] Simplify the handling of platform specific NAN formatting in put_long_double
Also opt in to testing the hexadecimal float formatting for glibc; glibc
does matches the current test references there.
Differential Revision: https://reviews.llvm.org/D118238
Jonas Devlieghere [Mon, 14 Feb 2022 20:12:54 +0000 (12:12 -0800)]
[crashlog] Change heuristic to stripping the meta data from crashlogs
Instead trying to pro-actively determine if the first line in a
crashlog contains meta data, change the heuristic to do the following:
1. To trying to parse the whole file. If that fails, then:
2. Strip the first line and try parsing the remainder of the file. If
that fails, then:
3. Fall back to the textual crashlog parser.
rdar://
88580543
Differential revision: https://reviews.llvm.org/D119755
Jonas Devlieghere [Mon, 14 Feb 2022 20:14:36 +0000 (12:14 -0800)]
[lldb] Stop forwarding LLDB_DEFAULT_PYTHON_VERSION in crashlog
Support for Python 2 was removed in Xcode 13.
Differential revision: https://reviews.llvm.org/D119756
Arthur O'Dwyer [Mon, 14 Feb 2022 20:12:10 +0000 (15:12 -0500)]
[libc++] [test] Uncomment std::ranges::min_element in niebloid.compile.pass.cpp.
This should have been part of
3b470d1ce.
Martin Storsjö [Sat, 12 Feb 2022 20:00:46 +0000 (22:00 +0200)]
[libcxx] Fix setup of MSVC specific intrinsics in Ryu code
This fixes warnings about implicitly declared `_umul128` and
`__shiftright128` when building for x86_64 with clang-cl.
Use `_MSC_VER` instead of `_LIBCPP_COMPILER_MSVC` for enabling MSVC
specific code; `_MSC_VER` is defined both in clang-cl and MSVC,
while `_LIBCPP_COMPILER_MSVC` only is defined if building with the
actual MSVC compiler.
Include `ryu.h` at the head of `d2s_intrinsics.h`, as it uses
the `_LIBCPP_64_BIT` define, which is defined in `ryu.h`.
Now the Ryu files build without warnings with clang-cl for i386,
x86_64, arm and aarch64.
Differential Revision: https://reviews.llvm.org/D119647
Jonathan Peyton [Mon, 31 Jan 2022 16:04:49 +0000 (10:04 -0600)]
[OpenMP][libomp] Introduce oneAPI compiler support
Introduce KMP_COMPILER_ICX macro to represent compilation with oneAPI
compiler.
Fixup flag detection and compiler ID detection in CMake. Older CMake's
detect IntelLLVM as Clang.
Fix compiler warnings.
Fixup many of the tests to have non-empty parallel regions as they are
elided by oneAPI compiler.
Joe Nash [Mon, 14 Feb 2022 16:29:58 +0000 (11:29 -0500)]
[AMDGPU] Pre-commit test for wait between agpr & vgpr
Due to a typo of 256 to 226, the SIInsertWaitcnt pass thinks
several registers are aliased from a waitcnt PoV including vgpr226
and agpr0, vgpr227 and agpr1...
This is a test of the behavior.
NFC.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D119750
LLVM GN Syncbot [Mon, 14 Feb 2022 19:57:49 +0000 (19:57 +0000)]
[gn build] Port
85355a560a33
LLVM GN Syncbot [Mon, 14 Feb 2022 19:57:48 +0000 (19:57 +0000)]
[gn build] Port
2a8f9a5e95de
Raman Tenneti [Mon, 14 Feb 2022 19:53:59 +0000 (11:53 -0800)]
[libc] [Obvious] Fix.
Disable getenv_test.
Reviewed By: rtenneti
Differential Revision: https://reviews.llvm.org/D119758
Nikolas Klauser [Mon, 14 Feb 2022 17:26:02 +0000 (18:26 +0100)]
[libc++] Implement P0627R6 (Function to mark unreachable code)
Reviewed By: ldionne, Quuxplusone, #libc
Spies: arichardson, mstorsjo, libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D119152
Raman Tenneti [Mon, 14 Feb 2022 19:43:47 +0000 (11:43 -0800)]
[libc] [Obvious] Fix.
Removed getenv from entrypoints.
Reviewed By: rtenneti
Differential Revision: https://reviews.llvm.org/D119753