Mehdi Amini [Wed, 19 Jan 2022 06:43:57 +0000 (06:43 +0000)]
Fix GCC 5 MLIR Build (NFC)
Try to fix the error:
mlir/lib/Parser/Parser.cpp:553:14: error: cannot call member function 'mlir::InFlightDiagnostic mlir::detail::Parser::emitError(llvm::SMLoc, const llvm::Twine&)' without object
<< "operation location alias was never defined";
eopXD [Mon, 17 Jan 2022 07:40:00 +0000 (23:40 -0800)]
[RISCV] Add patterns for vector narrowing integer right shift instructions
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117454
Siva Chandra Reddy [Wed, 19 Jan 2022 06:22:17 +0000 (06:22 +0000)]
[libc][Obvious] Add -Wno-c++17-extensions to sinf, cosf and sincosf targets.
Amir Ayupov [Wed, 19 Jan 2022 05:13:25 +0000 (21:13 -0800)]
[BOLT][CMAKE] Use BOLT_CLANG_EXE and BOLT_LLD_EXE as is
Add an ability to provide paths that don't match tool name exactly:
e.g. clang-13.
Remove use_lld call that sets up unused extra tools.
Test plan:
```
cmake -G Ninja ../llvm-project/llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt" -DBOLT_CLANG_EXE=/usr/bin/clang-13 -DBOLT_LLD_EXE=/usr/bin/lld-13
...
llvm-lit: /data/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using clang: /usr/bin/clang-13
llvm-lit: /data/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using lld: /usr/bin/lld-13
cmake -G Ninja ../llvm-project/llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt;lld" -DBOLT_CLANG_EXE=/usr/bin/clang-13
...
llvm-lit: /data/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using clang: /usr/bin/clang-13
llvm-lit: /data/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using lld: /data/llvm-build2/bin/lld
cmake -G Ninja ../llvm-project/llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt;clang;lld"
...
llvm-lit: /data/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using clang: /data/llvm-build3/bin/clang
llvm-lit: /data/llvm-project/llvm/utils/lit/lit/llvm/config.py:436: note: using lld: /data/llvm-build3/bin/lld
```
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D117446
River Riddle [Fri, 14 Jan 2022 04:51:38 +0000 (20:51 -0800)]
[mlir] Convert OpTrait::FunctionLike to FunctionOpInterface
This commit refactors the FunctionLike trait into an interface (FunctionOpInterface).
FunctionLike as it is today is already a pseudo-interface, with many users checking the
presence of the trait and then manually into functionality implemented in the
function_like_impl namespace. By transitioning to an interface, these accesses are much
cleaner (ideally with no direct calls to the impl namespace outside of the implementation
of the derived function operations, e.g. for parsing/printing utilities).
I've tried to maintain as much compatability with the current state as possible, while
also trying to clean up as much of the cruft as possible. The general migration plan for
current users of FunctionLike is as follows:
* function_like_impl -> function_interface_impl
Realistically most user calls should remove references to functions within this namespace
outside of a vary narrow set (e.g. parsing/printing utilities). Calls to the attribute name
accessors should be migrated to the `FunctionOpInterface::` equivalent, most everything
else should be updated to be driven through an instance of the interface.
* OpTrait::FunctionLike -> FunctionOpInterface
`hasTrait` checks will need to be moved to isa, along with the other various Trait vs
Interface API differences.
* populateFunctionLikeTypeConversionPattern -> populateFunctionOpInterfaceTypeConversionPattern
Fixes #52917
Differential Revision: https://reviews.llvm.org/D117272
Tue Ly [Wed, 19 Jan 2022 01:14:14 +0000 (20:14 -0500)]
[libc] Remove as_double usage as constant initializations in sincosf implementation.
Use hexadecimal floats with C++17 instead of as_double as floating point constant initializations.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D117628
River Riddle [Wed, 19 Jan 2022 04:46:34 +0000 (20:46 -0800)]
[flang] Convert uses of FunctionPass to OperationPass<FuncOp>
FunctionPass has been deprecated and is in the process of being removed.
Peixin-Qiao [Wed, 19 Jan 2022 04:36:14 +0000 (12:36 +0800)]
[MLIR][OpenMP] Support schedule chunk size with various bit width
The chunk size in schedule clause is one integer expression, which can
be either constant integer or integer variable. Fix schedule clause in
MLIR Op Def to support integer expression with different bit width.
Reviewed By: shraiysh
Differential Revision: https://reviews.llvm.org/D116073
River Riddle [Wed, 19 Jan 2022 04:18:47 +0000 (20:18 -0800)]
[mlir] Mark FunctionPass as deprecated using the C++14 deprecated attribute
River Riddle [Tue, 4 Jan 2022 23:41:17 +0000 (15:41 -0800)]
[mlir][Pass] Deprecate FunctionPass in favor of OperationPass<FuncOp>
The only benefit of FunctionPass is that it filters out function
declarations. This isn't enough to justify carrying it around, as we can
simplify filter out declarations when necessary within the pass. We can
also explore with better scheduling primitives to filter out declarations
at the pipeline level in the future.
The definition of FunctionPass is left intact for now to allow time for downstream
users to migrate.
Differential Revision: https://reviews.llvm.org/D117182
Casey Carter [Thu, 30 Dec 2021 01:53:16 +0000 (17:53 -0800)]
[libcxx][test] test _LIBCPP_VERSION with #ifdef, not #if
Jacques Pienaar [Wed, 19 Jan 2022 02:48:43 +0000 (18:48 -0800)]
[mlir][textmate] Add support for function visibility
Avoids functions with visibility not being marked as functions. Tested
via Lightshow.
Louis Dionne [Tue, 7 Dec 2021 16:31:50 +0000 (11:31 -0500)]
[libc++] Re-enable the _BitInt test for std::atomic on Clang 14
It should now work since the Clang on CI nodes has been updated.
Differential Revision: https://reviews.llvm.org/D115256
Michael Gottesman [Sun, 16 Jan 2022 20:44:52 +0000 (12:44 -0800)]
[debug-info] Add support for llvm.dbg.addr in DIBuilder.
I based this off of the API already create for llvm.dbg.value since both
intrinsics have the same arguments at the API level.
I added some tests exercising the API a little as well as an additional small
test that shows how one can use llvm.dbg.addr to limit the PC range where an
address value is available in the debugger. This is done by calling
llvm.dbg.value with undef and the same metadata info as one used to create the
llvm.dbg.addr.
rdar://
83957028
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D117442
Hongtao Yu [Wed, 12 Jan 2022 20:21:54 +0000 (12:21 -0800)]
[CSSPGO] Print "context-nested" instead of "preilnined" for ProfileSummarySection.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D117141
Daniel Thornburgh [Wed, 19 Jan 2022 02:03:26 +0000 (18:03 -0800)]
[NFC] Test commit to verify commit access.
Chuanqi Xu [Tue, 18 Jan 2022 07:19:50 +0000 (15:19 +0800)]
[Coroutines] Offering llvm.coro.align intrinsic
It is a known problem that we can't align the switch-based coroutine
frame if the alignment exceeds std::max_align_t (which is 16 usually).
We could solve the problem on the middle-end by dynamically transforming
or in the frontend by emitting aligned allocation function.
If we need to solve it in the frontend, the middle end need to offer an
intrinsic to tell the alignment at least. This patch tries to offer such
an intrinsic called llvm.coro.align.
Reviewed By: https://reviews.llvm.org/D117542
Differential revision: https://reviews.llvm.org/D117542
minglotus-6 [Wed, 12 Jan 2022 00:57:01 +0000 (16:57 -0800)]
Update bitcode format doc to mention that a multi-module bitcode file is
valid.
Differential Revision: https://reviews.llvm.org/D117067
Fangrui Song [Wed, 19 Jan 2022 01:33:58 +0000 (17:33 -0800)]
[ELF] De-template InputSectionBase::getLocation. NFC
Jonas Devlieghere [Wed, 19 Jan 2022 00:37:30 +0000 (16:37 -0800)]
[lldb] Print an error message when we're reading libobjc.A.dylib from memory
Use libobjc.A.dylib as a sentinel to detect situations where we're
reading libraries from process memory instead of the shared cache.
Differential revision: https://reviews.llvm.org/D117623
Fangrui Song [Wed, 19 Jan 2022 01:03:23 +0000 (17:03 -0800)]
[ELF] Simplify/optimize EhInputSection::split
and change some `fatal` to `errorOrWarn`.
EhFrame.cpp is a helper file. We don't place all .eh_frame implementation there,
so the code move is fine.
Jessica Clarke [Tue, 18 Jan 2022 23:50:05 +0000 (23:50 +0000)]
[NFC][libunwind] Fix uintptr_t vs size_t confusion for lengths
These two are not conceptually the same; the former is a pointer shoved
in an integer, the latter is an offset or length. On the architectures
supported by libunwind, these two have the same underlying type, namely
unsigned int on ILP32, unsigned long on LP64 and unsigned long long on
LLP64. However, on CHERI, and thus Arm's Morello, they are not the same,
as pointers are hardware capabilities that carry additional metadata
including bounds and permissions, which is preserved in uintptr_t but
not in size_t. Thus, fix all length variables to be of type size_t not
uintptr_t, as we have done downstream for a while in CHERI LLVM but did
not get round to upstreaming.
Note that dyld_unwind_sections is currently defined in Apple's headers
as genuinely using uintptr_t to represent lengths. This is a bad API and
should be fixed, which would be totally API and ABI compatible due to
size_t and uintptr_t being the same type on all supported Apple systems,
but our definition is left matching theirs until such a time as they fix
their bogus types.
This is intended to be an NFC change on all architectures supported by
LLVM upstream, only being a functional change for CHERI downstream in
CHERI LLVM.
Matt Arsenault [Tue, 18 Jan 2022 23:41:44 +0000 (18:41 -0500)]
AMDGPU: Fix using deprecated buffer intrinsics in test
Ben Langmuir [Tue, 18 Jan 2022 22:26:30 +0000 (14:26 -0800)]
[llvm-jitlink] Prevent dead-stripping of test callback
`llvm_jitlink_setTestResultOverride` is used via runtime lookup by
tests, so make sure it is not dead-stripped from llvm-jitlink in release
builds.
Fixes https://github.com/llvm/llvm-project/issues/53203
Differential Revision: https://reviews.llvm.org/D117609
Benjamin Kramer [Tue, 18 Jan 2022 23:55:56 +0000 (00:55 +0100)]
[bazel] Port
755dc07d69ed
Still a fair bit of spaghetti in the unittest rules
Vincent Lee [Sat, 15 Jan 2022 07:06:13 +0000 (23:06 -0800)]
[lld-macho] Allow deduplicate-literals to be overridden
It's still uncertain but whether we want to have `deduplicate-literals` be the
default flag for LLD out of the box or not. If `deduplicate-literals` is the default
behavior, then we will need a way override it and not deduplicate. Luckily, we
have `no_deduplicate` to fill this gap. For now, I've set the default to be false
which aligns with the existing behavior. That can only always be changed after
discussions on D117250.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D117387
Peter Klausler [Sat, 8 Jan 2022 21:08:08 +0000 (13:08 -0800)]
[flang] Better messages for function vs. array errors
When a scalar-valued function with no distinct RESULT
is being called recursively in its own executable part,
emit a better message about the error. Clean up the
code that resolves function vs. array ambiguities in
expression semantics.
Update to address review comment
Differential Revision: https://reviews.llvm.org/D117577
Philip Reames [Tue, 18 Jan 2022 23:16:47 +0000 (15:16 -0800)]
[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last use has been removed
Try 2, this time including the test.
Joseph Huber [Tue, 18 Jan 2022 00:55:03 +0000 (19:55 -0500)]
[Libomptarget] Fix external visibility for internal variables
After the changes in D117362 made variables declared inside of a target
declare directive visible outside the plugin, some variables inside the
runtime were given visiblity that conflicted with their address space
type. This caused problems when shared or local memory was made
externally visible. This patch fixes this issue by making these
varialbes static within the module, therefore limiting their visibility
to being internal.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D117526
Joseph Huber [Fri, 14 Jan 2022 22:21:46 +0000 (17:21 -0500)]
[OpenMP] Remove hidden visibility for declare target variables
This patch changes the visiblity of variables declared within a declare
target directive. Variable declarations within a declare target
directive need to be externally visible to the plugin for initialization
or reading. Previously this would cause runtime errors where the named
global could not be found because it was not included in the symbol
table.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D117362
Philip Reames [Tue, 18 Jan 2022 23:16:12 +0000 (15:16 -0800)]
Revert "[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last use has been removed"
This reverts commit
167af7bbfe2d6e969c409b0cbe1af560b2b39e8f. Buildbot breaks since I forgot to remove a unit test.
Philip Reames [Tue, 18 Jan 2022 23:12:00 +0000 (15:12 -0800)]
[MemoryBuiltins] Demote isMallocLikeFn to implementation routine since last use has been removed
Peter Klausler [Mon, 10 Jan 2022 20:34:51 +0000 (12:34 -0800)]
[flang] runtime: catch OPEN(ACCESS='DIRECT',POSITION=)
A POSITION= specifier may not be used on a direct access file.
Differential Revision: https://reviews.llvm.org/D117596
Peter Klausler [Mon, 10 Jan 2022 20:04:30 +0000 (12:04 -0800)]
[flang] runtime error on inappropriate OPEN(UNIT=extant,RECL=n)
Don't let a program set a fixed RECL= on a connected unit unless
it already had one with the same value.
Differential Revision: https://reviews.llvm.org/D117595
Philip Reames [Tue, 18 Jan 2022 22:46:58 +0000 (14:46 -0800)]
[LangRef] Clarify that inaccessiblememonly functions are allowed noalias returns
Confusion over this point came up in a couple of recent changes (D117180,
e20b32ff3). Current tone of discussion seems to be that we think inaccessiblememonly was always legal on allocation functions, so this change takes the form of a clarification instead of a change.
Differential Revision: https://reviews.llvm.org/D117571
Benjamin Kramer [Tue, 4 Jan 2022 15:52:44 +0000 (16:52 +0100)]
[linalg][fusion] Disallow fusion when it would create an invalid expand_shape
The input type of a linalg.generic can be less dynamic than its output
type. If this is the case moving a reshape across the generic op would
create invalid IR, as expand_shape cannot expand arbitrary dynamic
dimensions.
Check that the reshape is actually valid before creating the
expand_shape. This exposes the existing verification logic in reshape
utils and removes the incomplete custom implementation in fusion.
Differential Revision: https://reviews.llvm.org/D116600
Benjamin Kramer [Mon, 17 Jan 2022 16:38:07 +0000 (17:38 +0100)]
[mlir][linalg] Insert a cast for identity linalg.generics when the types don't match
This can happen when the result has different dynamic dimensions than
the input.
Differential Revision: https://reviews.llvm.org/D117498
Mogball [Tue, 18 Jan 2022 22:39:24 +0000 (22:39 +0000)]
[mlir] Fix bazel build of GPU dialect
Matt Arsenault [Tue, 18 Jan 2022 22:07:19 +0000 (17:07 -0500)]
GlobalISel: Swap order of operand checks in ConstantFoldVectorBinop
Since constants are canonicalized to the RHS, this is more likely to
exit early.
Matt Arsenault [Tue, 11 Jan 2022 14:46:18 +0000 (09:46 -0500)]
GlobalISel: Fix CSEMIRBuilder mishandling constant folds of vectors
This was ignoring the requested result register, resulting in a
missing def when this happened in the IRTranslator. Fixes some crashes
and verifier errors at -O0.
Alternatively we could pass DstOps to the constant fold functions.
Sam Clegg [Sat, 15 Jan 2022 23:33:02 +0000 (15:33 -0800)]
[lld][WebAssembly] Perform data relocations during start function
We already perform memory initialization and apply global relocations
during start. It makes sense to performs data relocations too. I think
the reason we were not doing this already is solely historical.
Differential Revision: https://reviews.llvm.org/D117412
Ed Maste [Mon, 17 Jan 2022 22:36:45 +0000 (17:36 -0500)]
[sanitizer] Improve FreeBSD ASLR detection
The kern.elf64.aslr.pie_enable and kern.elf32.aslr.pie_enable sysctls
control the default setting for PIE binary address randomization, but
it is possible to enable or disable ASLR on a per-process basis. So,
use procctl(2) to query whether ASLR is enabled.
(Note that with ASLR enabled but sysctl kern.elf64.aslr.pie_enable=0
a PIE binary will in effect have randomization disabled, and would be
functional with msan. This is not intended as as a user-facing control
though; proccontrol(1) should be used to disable aslr for the process.)
Reviewed By: devnexen
Differential Revision: https://reviews.llvm.org/D117521
Matt Arsenault [Fri, 7 Jan 2022 22:44:23 +0000 (17:44 -0500)]
GlobalISel: Fix legalization error where CSE leaves behind dead defs
If the conversion artifact introduced in the unmerge of cast of merge
combine already existed in the function, this would introduce dead
copies which kept the old casts around, neither of which were deleted,
and would fail legalization.
This would fail as follows:
The G_UNMERGE_VALUES of the G_SEXT of the G_BUILD_VECTOR would
introduce a G_SEXT for each of the scalars.
Some of the required G_SEXTs already existed in the function, so CSE
moves them up in the function and introduces a copy to the original
result register.
The introduced CSE copies are dead, since the originally G_SEXTs were
already directly used. These copies add a use to the illegal G_SEXTs,
so they are not deleted.
The artifact combiner does not see the defs that need to be updated,
since it was hidden inside the CSE builder.
I see 2 potential fixes, and opted for the mechanically simpler one,
which is to just not insert the cast if the result operand isn't
used. Alternatively, we could not insert the cast directly into the
result register, and use replaceRegOrBuildCopy similar to the case
where there is no conversion.
I suspect this is a wider problem in the artifact combiner.
Mehdi Amini [Tue, 18 Jan 2022 20:55:35 +0000 (20:55 +0000)]
Allows deferred location attribute in `parseOptionalLocationSpecifier`
Before this patch, deferred location in operation like `test.pretty_printed_region` would
break the parser, and so the IR round-trip.
Depends On D117088
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117413
Chris Bieneman [Tue, 18 Jan 2022 21:37:10 +0000 (15:37 -0600)]
Adding gitattributes for split-file tests
This change gets the split-file tests passing on Windows when
autocrlf=true.
Stanislav Gatev [Tue, 18 Jan 2022 15:51:57 +0000 (15:51 +0000)]
[clang][dataflow] Add a test to justify skipping past references in UO_Deref
This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.
Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D117567
Amir Ayupov [Fri, 30 Jul 2021 00:29:32 +0000 (17:29 -0700)]
[BOLT][NFC] Delimit bytes in MCAnnotation bitmask
Summary: Show individual bytes in the annotation mask.
Test Plan: ninja llvm-bolt
Reviewers: maksfb
FBD30026393
Amir Ayupov [Wed, 4 Aug 2021 00:53:32 +0000 (17:53 -0700)]
[BOLT][NFC] Move Offset annotation to Group 1
Summary:
Move the annotation to avoid dynamic memory allocations.
Improves the CPU time of instrumenting a large binary by 1% (+-0.8%, p-value 0.01)
Test Plan: NFC
Reviewers: maksfb
FBD30091656
Sam McCall [Tue, 18 Jan 2022 20:57:26 +0000 (21:57 +0100)]
[Sema] Add test for new errors due to
09f8315bba391
Knowing the type of more dependent expressions means we can diagnose
more errors at template parsing rather than instantiation time.
Such templates are IFNDR, so this is a QoI improvement.
I hadn't anticipated this in the original patch, so had no test.
David Green [Tue, 18 Jan 2022 21:03:08 +0000 (21:03 +0000)]
[DAG] Extend SearchForAndLoads with any_extend handling
This extends the code in SearchForAndLoads to be able to look through
ANY_EXTEND nodes, which can be created from mismatching IR types where
the AND node we begin from only demands the low parts of the register.
That turns zext and sext into any_extends as only the low bits are
demanded. To be able to look through ANY_EXTEND nodes we need to handle
mismatching types in a few places, potentially truncating the mask to
the size of the final load.
Recommitted with a more conservative check for the type of the extend.
Differential Revision: https://reviews.llvm.org/D117457
Philip Reames [Tue, 18 Jan 2022 20:38:28 +0000 (12:38 -0800)]
A readonly operand bundle should not prevent inference of readonly from a readnone callee
A readonly operand bundle disallows inference of readnone from the callee, but it should not prevent us from using the readnone fact on the callee to infer readonly for the callsite.
Fixes pr53270.
Differential Revision: https://reviews.llvm.org/D117591
Mehdi Amini [Tue, 18 Jan 2022 20:43:19 +0000 (20:43 +0000)]
Use Opaque location for handling deferred references to aliases internally to the parser (NFC)
This will allow to return to the client of `parseLocationInstance` a location that is resolved later.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117088
Chris Bieneman [Tue, 18 Jan 2022 17:06:26 +0000 (11:06 -0600)]
Handle whitespace in symbol list
Trimming whitespace or carriage returns from symbols allows this code
to work on Windows and makes it match other places symbol lists are
handled.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D117570
Philip Reames [Tue, 18 Jan 2022 20:08:40 +0000 (12:08 -0800)]
Fix incorrect inference of writeonly despite reading operand bundle
If we have a writeonly function called from a callsite with a potentially reading operand bundle, we can not conclude the callsite is writeonly.
The changed test is the only one I've been able to demonstrate a current miscompile on, but an incorrect result here could show up in a bunch of subtle ways. For instance, this issue caused several spurious test changes when combined with D117591.
John Ericson [Tue, 18 Jan 2022 07:05:47 +0000 (07:05 +0000)]
[polly][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D117541
Sam Clegg [Tue, 18 Jan 2022 19:43:27 +0000 (11:43 -0800)]
[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
It seems the first half of this test was disabled in error
as part of https://reviews.llvm.org/D93066.
Differential Revision: https://reviews.llvm.org/D117594
spupyrev [Mon, 10 Jan 2022 21:33:55 +0000 (13:33 -0800)]
A better profi rebalancer
This is an extension of **profi** post-processing step that rebalances counts
in CFGs that have basic blocks w/o probes (aka "unknown" blocks). Specifically,
the new version finds many more "unknown" subgraphs and marks more "unknown"
basic blocks as hot (which prevents unwanted optimization passes).
I see up to 0.5% perf on some (large) binaries, e.g., clang-10 and gcc-8.
The algorithm is still linear and yields no build time overhead.
Fabian Wolff [Tue, 18 Jan 2022 18:19:23 +0000 (19:19 +0100)]
[clang-tidy] Make `readability-container-data-pointer` more robust
Fixes PR#52245. I've also added a few test cases beyond PR#52245 that would also fail with the current implementation, which is quite brittle in many respects (e.g. it uses the `hasDescendant()` matcher to find the container that is being accessed, which is very easy to trick, as in the example in PR#52245).
I have not been able to reproduce the second issue mentioned in PR#52245 (namely that using the `data()` member function is suggested even for containers that don't have it), but I've added a test case for it to be sure.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D113863
Philip Reames [Tue, 18 Jan 2022 20:08:02 +0000 (12:08 -0800)]
[tests] Add coverage of writeonly attribute and operand bundle intersection
Philip Reames [Tue, 18 Jan 2022 19:46:43 +0000 (11:46 -0800)]
Autogen a test for ease of update
Craig Topper [Tue, 18 Jan 2022 19:42:25 +0000 (11:42 -0800)]
[RISCV] Remove special case for constant shift amount in FSHL/FSHR lowering to FSL/FSR.
Remove fshl/fshr with constant shift amount isel patterns. Replace
with fsr/fsl with constant isel patterns.
This hack was trying to preserve as much optimization opportunity
for fshl/fshr by constant as possible, but the conversion to
RISCVISD::FSR/FSL happens so late it probably isn't worth much.
The new isel patterns are needed by D117468 anyway.
Joseph Huber [Tue, 18 Jan 2022 19:43:49 +0000 (14:43 -0500)]
Revert "[Libomptarget] Fix external visibility for internal variables"
Reverting to investigate break on AMDGPU. This reverts commit
0203ff19602d9d90e03653062dbb19cc13afa956.
Joseph Huber [Tue, 18 Jan 2022 19:43:36 +0000 (14:43 -0500)]
Revert "[OpenMP] Remove hidden visibility for declare target variables"
Reverting to investigate break on AMDPGU. This reverts commit
d081bfcd17c1c704776a0964d239f19f6acde93d.
Casey Carter [Wed, 29 Dec 2021 22:28:58 +0000 (14:28 -0800)]
[libcxx][test] `unordered_meow` iterators are not portably non-bidi
MSVCSTL's are actually bidirectional.
Differential Revision: https://reviews.llvm.org/D117369
Vladislav Khmelevsky [Thu, 16 Dec 2021 15:59:01 +0000 (18:59 +0300)]
updateDWARFObjectAddressRanges: nullify low pc
In case the case the DW_AT_ranges tag already exists for the object the
low pc values won't be updated and will be incorrect in
after-bolt binaries.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D117216
Casey Carter [Wed, 29 Dec 2021 23:25:53 +0000 (15:25 -0800)]
[libcxx][test] compiler options are non-portable
... it's easier to suppress warnings internally, where we can detect the compiler.
* Rename `TEST_COMPILER_C1XX` to `TEST_COMPILER_MSVC`
* Rename all `TEST_WORKAROUND_C1XX_<meow>` to `TEST_WORKAROUND_MSVC_<meow>`
Differential Revision: https://reviews.llvm.org/D117422
Mircea Trofin [Tue, 18 Jan 2022 19:33:26 +0000 (11:33 -0800)]
Fix build break introduced by D115847
Because CoroEarly is also run, the `coroutine.presplit` attr should be
0.
Nikolas Klauser [Sat, 15 Jan 2022 18:41:33 +0000 (19:41 +0100)]
[libc++][NFC] Use _LIBCPP_DEBUG_ASSERT in <unordered_map>
Use `_LIBCPP_DEBUG_ASSERT` in <unordered_map>
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D117401
Nikolas Klauser [Mon, 17 Jan 2022 23:18:39 +0000 (00:18 +0100)]
[libc++][test] test in_in_result convertible requirements
Currently it is not checked that operator in_in_result<II1, II2>() SFINAEs away properly
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D117517
Peter Klausler [Fri, 7 Jan 2022 21:39:28 +0000 (13:39 -0800)]
[flang] Support substring references in NAMELIST input
Implements substring references into potentially partial CHARACTER
scalars and array elements in NAMELIST input.
Differential Revision: https://reviews.llvm.org/D117576
Alex Brachet [Tue, 18 Jan 2022 19:15:18 +0000 (19:15 +0000)]
[libc++] Use reserved identifier for template parameter
`T` is not a valid identifier for libc++ to use, use `_Tp` instead. Caught from D116957
Reviewed By: Quuxplusone
Differential Revision: https://reviews.llvm.org/D117582
Amir Aupov [Tue, 18 Jan 2022 19:16:36 +0000 (11:16 -0800)]
[BOLT][TEST] Update exceptions-instrumentation.test
Matching an exact byte offset is fragile if a different version of compiler
is used (e.g. distro clang).
Resolves an issue with running with BOLT_CLANG_EXE + clang-12
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D117440
Ellis Hoag [Tue, 18 Jan 2022 18:38:58 +0000 (10:38 -0800)]
[InstrProf][NFC] Add InstrProfInstBase base
The `InstrProfInstBase` class is for all `llvm.instrprof.*` intrinsics. In a
later diff we will add new instrinsic of this type. Also refactor some
logic in `InstrProfiling.cpp`.
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D117261
Matt Arsenault [Sat, 15 Jan 2022 19:37:34 +0000 (14:37 -0500)]
AMDGPU: Remove llvm.amdgcn.alignbit and handle bitcode upgrade to fshr
Adrian Tong [Tue, 18 Jan 2022 13:37:57 +0000 (13:37 +0000)]
[NFC] Test commit.
This is just a test commit to check whether I got commit permission.
Craig Topper [Tue, 18 Jan 2022 18:46:16 +0000 (10:46 -0800)]
Recommit "[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction register numbering."
This reverts the revert commit
e32838573929ac85fc4df3058593798d10ce4cd2.
Accidental demanded bits change has been removed. The demanded bits
code itself was remove in a pre-commit since it isn't tested.
Original commit message:
Previous we used the fshl/fshr operand ordering for simplicity. This
made things confusing when D117468 proposed adding intrinsics for
the instructions. We can't just use the generic funnel shifting
intrinsics because fsl/fsr have different functionality that should
be exposed to software.
Now we use rs1, rs3, rs2/shamt order which matches the instruction
printing order and the order used in this intrinsic header
https://github.com/riscv/riscv-bitmanip/blob/main-history/cproofs/rvintrin.h
Craig Topper [Tue, 18 Jan 2022 18:42:47 +0000 (10:42 -0800)]
[RISCV] Remove DemandedBits handling for FSR/FSL until we have test cases for it.
Testing may be easier after D117468. Right now we get demanded bits
optimizations done on ISD::FSHL/FSHR before they become FSR/FSL. This
makes it hard to test.
Matt Arsenault [Mon, 10 Jan 2022 02:21:14 +0000 (21:21 -0500)]
AMDGPU: Avoid enabling kernel workitem IDs with reqd_work_group_size
Matt Arsenault [Wed, 12 Jan 2022 01:15:47 +0000 (20:15 -0500)]
PostRAPseudos: Don't preserve kills on some implicit copy operands
This fixes a verifier error I ran into at -O0. A subregister copy had
an implicit kill of an overlapping superregister, which was partially
redefined by the copy. The preserved implicit operand killed
subregisters made live earlier in the sequence. AMDGPU already uses
similar logic for whether to preserve the kill of the superregister on
the final instruction if there's overlap.
Aaron Ballman [Tue, 18 Jan 2022 18:40:47 +0000 (13:40 -0500)]
Mark ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT as deprecated
C17 deprecated ATOMIC_VAR_INIT with the resolution of DR 485. C++
followed suit when adopting P0883R2 for C++20, but additionally chose
to deprecate ATOMIC_FLAG_INIT at the same time despite the macro still
being required in C. This patch marks both macros as deprecated when
appropriate to do so.
Craig Topper [Tue, 18 Jan 2022 18:29:37 +0000 (10:29 -0800)]
Revert "[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction register numbering."
This reverts commit
b634f8a663d56877663f5224a785d9f0263c4176.
I broke the SimplifyDemandedBits code, but we don't have tests.
River Riddle [Sat, 15 Jan 2022 07:34:09 +0000 (23:34 -0800)]
[mlir:Analysis] Move the LoopAnalysis library to Dialect/Affine/Analysis
The current state of the top level Analysis/ directory is that it contains two libraries;
a generic Analysis library (free from dialect dependencies), and a LoopAnalysis library
that contains various analysis utilities that originated from Affine loop transformations.
This commit moves the LoopAnalysis to the more appropriate home of `Dialect/Affine/Analysis/`,
given the use and intention of the majority of the code within it. After the move, if there
are generic utilities that would fit better in the top-level Analysis/ directory, we can move
them.
Differential Revision: https://reviews.llvm.org/D117351
Mark de Wever [Sat, 15 Jan 2022 12:48:54 +0000 (13:48 +0100)]
[libc++] Adds a test for std::fill_n.
The function `std::fill` requires a ForwardIterator, but `std::fill_n`
only requires an OutputIterator. Adds a test to validate `std::fill_n`
works with an OutputIterator.
Noticed this while working on LWG3539
format_to must not copy models of output_iterator<const charT&>
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D117395
Philip Reames [Tue, 18 Jan 2022 18:19:14 +0000 (10:19 -0800)]
Add test showing missed opt from pr53270
Chris Bieneman [Tue, 18 Jan 2022 17:01:36 +0000 (11:01 -0600)]
[NFC] Set gitattributes for line endings
A clean checkout of LLVM using core.autocrlf=on for Windows cannot pass
the LLVM test suite because several test input files rely on specific
line endings.
This change updates the line ending attributes for impacted tests and
re-normalizes a CRLF test case that was committed as LF to the git
index.
Arthur O'Dwyer [Wed, 5 Jan 2022 20:17:06 +0000 (15:17 -0500)]
[libc++] [test] Use hidden friends consistently in the test iterators.
Differential Revision: https://reviews.llvm.org/D117397
Joseph Huber [Tue, 18 Jan 2022 00:55:03 +0000 (19:55 -0500)]
[Libomptarget] Fix external visibility for internal variables
After the changes in D117362 made variables declared inside of a target
declare directive visible outside the plugin, some variables inside the
runtime were given visiblity that conflicted with their address space
type. This caused problems when shared or local memory was made
externally visible. This patch fixes this issue by making these
varialbes static within the module, therefore limiting their visibility
to being internal.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D117526
Joseph Huber [Fri, 14 Jan 2022 22:21:46 +0000 (17:21 -0500)]
[OpenMP] Remove hidden visibility for declare target variables
This patch changes the visiblity of variables declared within a declare
target directive. Variable declarations within a declare target
directive need to be externally visible to the plugin for initialization
or reading. Previously this would cause runtime errors where the named
global could not be found because it was not included in the symbol
table.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D117362
Joseph Huber [Fri, 14 Jan 2022 15:31:01 +0000 (10:31 -0500)]
[OpenMP] Mark device RTL variables as hidden
This patch changes the visibility of the `__omp_rtl_debug_kind` variable
to be hidden. These variables are only used by the plugin so they do not
need to be read externally. Previously the default visibility prevented
these variables from being completely eliminated in the module.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D117320
Craig Topper [Tue, 18 Jan 2022 17:26:28 +0000 (09:26 -0800)]
[RISCV] Make the operand order for RISCVISD::FSL(W)/FSR(W) match the instruction register numbering.
Previous we used the fshl/fshr operand ordering for simplicity. This
made things confusing when D117468 proposed adding intrinsics for
the instructions. We can't just use the generic funnel shifting
intrinsics because fsl/fsr have different functionality that should
be exposed to software.
Now we use rs1, rs3, rs2/shamt order which matches the instruction
printing order and the order used in this intrinsic header
https://github.com/riscv/riscv-bitmanip/blob/main-history/cproofs/rvintrin.h
Mircea Trofin [Thu, 13 Jan 2022 00:56:24 +0000 (00:56 +0000)]
[mlgo][inline] Improve global state tracking
The global state refers to the number of the nodes currently in the
module, and the number of direct calls between nodes, across the
module.
Node counts are not a problem; edge counts are because we want strictly
the kind of edges that affect inlining (direct calls), and that is not
easily obtainable without iteration over the whole module.
This patch avoids relying on analysis invalidation because it turned out
to be too aggressive in some cases. It leverages the fact that Node
objects are stable - they do not get deleted while cgscc passes are
run over the module; and cgscc pass manager invariants.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D115847
Fraser Cormack [Fri, 19 Nov 2021 21:06:35 +0000 (21:06 +0000)]
[VP] Propagate align parameter attr on VP gather/scatter to ISel
This patch fixes a case where the 'align' parameter attribute on the
pointer operands to llvm.vp.gather and llvm.vp.scatter was being dropped
during the conversion to the SelectionDAG. The default alignment equal
to the ABI type alignment of the vector type was kept. It also updates
the documentation to reflect the fact that the parameter attribute is
now properly supported.
The default alignment of these intrinsics was previously documented as
being equal to the ABI alignment of the *scalar* type, when in fact that
wasn't the case: the ABI alignment of the vector type was used instead.
This has also been fixed in this patch.
Reviewed By: simoll, craig.topper
Differential Revision: https://reviews.llvm.org/D114423
Tony Tye [Sat, 8 Jan 2022 18:48:14 +0000 (18:48 +0000)]
[AMDGPU][NFC] Add DWARF extension support for SIMD execution
- Add current iteration to the context of a DWARF expression evaluation.
- Add DW_AT_LLVM_iterations attribute to specify the number of
iterations executing concurrently.
- Add DF_OP_LLVM_push_iteration to support optimizations that result in
multiple iterations executing concurrently.
- Add DW_OP_LLVM_overlay and DW_OP_LLVM_bit_overlay to support
expressing the location of arrays that are promoted to vector
registers in SIMD vectorized loops.
- Generally clarify the difference between SIMT and SIMD execution.
- Change the DW_AT_LLVM_active_lane attribute to take location
description expression so that a loclist can be used to express
different vales at different program locations.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D117572
Mogball [Tue, 18 Jan 2022 17:36:09 +0000 (17:36 +0000)]
[mlir] NFC fix a typo in assembly format
LLVM GN Syncbot [Tue, 18 Jan 2022 17:28:57 +0000 (17:28 +0000)]
[gn build] Port
df51be85e4ae
Louis Dionne [Tue, 18 Jan 2022 15:34:32 +0000 (10:34 -0500)]
[libc++] Refactor stride_counting_iterator
Instead of storing the wrapped iterator inside the stride_counting_iterator,
store its base so we can have e.g. a stride_counting_iterator of an
input_iterator (which was previously impossible because input_iterators
are not copyable). Also a few other simplifications in stride_counting_iterator.
As a fly-by fix, remove the member base() functions, which are super
confusing.
Differential Revision: https://reviews.llvm.org/D116613
Louis Dionne [Mon, 10 Jan 2022 14:43:29 +0000 (09:43 -0500)]
[libc++] Split a few utilities out of __threading_support
This change is the basis for a further refactoring where I'm going to
split up the various implementations we have in __threading_support to
make that code easier to understand.
Note that I had to make __convert_to_timespec a template to break
circular dependencies. Concretely, we never seem to use it with anything
other than ::timespec, but I am wary of hardcoding that assumption as
part of this change, since I suspect there's a reason for going through
these hoops in the first place.
Differential Revision: https://reviews.llvm.org/D116944
Jan Svoboda [Tue, 18 Jan 2022 17:01:24 +0000 (18:01 +0100)]
[llvm] Remove uses of `std::vector<bool>`
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
This patch does just that for llvm.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D117121
Mogball [Tue, 18 Jan 2022 16:53:55 +0000 (16:53 +0000)]
[mlir] Replace StrEnumAttr -> EnumAttr in core dialects
Removes uses of `StrEnumAttr` in core dialects
Reviewed By: mehdi_amini, rriddle
Differential Revision: https://reviews.llvm.org/D117514
Sanjay Patel [Tue, 18 Jan 2022 16:07:17 +0000 (11:07 -0500)]
[SDAG] remove duplicate functionality when getting shift type for demanded bits; NFCI
This was noted as a potential cleanup in D117508.
getShiftAmountTy() has checks for vector, phase, etc. so it should
handle anything that the caller was trying to account for.