Andrew Young [Sat, 16 Oct 2021 01:29:33 +0000 (18:29 -0700)]
[MLIR] Expose optional attribute parsing functions
The functionality already exists in AsmParser to parse optional ArrayAttrs and
StringAttrs, but only if they are added to a NamedAttrList. This moves the
code to parse an optional attribute and add it to an list into a common
template, and exposes the simpler functionality of just parsing the optional
attributes.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D111918
Jim Ingham [Mon, 18 Oct 2021 18:29:04 +0000 (11:29 -0700)]
Fix Linux error in TestBreakInLoadedDylib.py.
Adding the to be loaded dylib to the extra images causes the breakpoint
to be found in the image added to the target on Linux (though not on
Darwin). So adjust the test for this difference.
Mikhail Maltsev [Mon, 18 Oct 2021 18:12:42 +0000 (19:12 +0100)]
[libcxx] Make allocator<T>:allocate throw bad_array_new_length
Currently the member functions std::allocator<T>::allocate,
std::experimental::pmr::polymorphic_allocator::allocate and
std::resource_adaptor<T>::do_allocate throw an exception of type
std::length_error when the requested size exceeds the maximum size.
According to the C++ standard ([allocator.members]/4,
[mem.poly.allocator.mem]/1), std::allocator<T>::allocate and
std::pmr::polymorphic_allocator::allocate must throw a
std::bad_array_new_length exception in this case.
The patch fixes the issue with std::allocator<T>::allocate and changes
the type the exception thrown by
std::experimental::pmr::resource_adaptor<T>::do_allocate to
std::bad_array_new_length as well for consistency.
The patch resolves LWG 3237, LWG 3038 and LWG 3190.
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D110846
Aaron Ballman [Mon, 18 Oct 2021 17:59:07 +0000 (13:59 -0400)]
Fix crash when diagnosing a CTAD failure in an array new expression
This appears to be a think-o where the developer was trying to check for a null
pointer but was actually checking (redundantly) whether the optional held a
valid value or not. We now properly check the pointer for null.
This fixes PR51547.
Louis Dionne [Mon, 18 Oct 2021 17:58:31 +0000 (13:58 -0400)]
[libc++][NFC] Reorganize release notes
Several entries were in the wrong place, such as API changes appearing
under "Build System Changes". This commit shuffles stuff so it sits under
the right section.
Jim Ingham [Sat, 16 Oct 2021 01:37:47 +0000 (18:37 -0700)]
Add tests for the other variants of BreakpointCreateBySourceRegex.
I added some tests for the case where the breakpoints take immediately
to the extant test case, and made a new test case for when the source
regex breakpoint will be set in a dlopen-ed library.
I also noticed when doing this that "lldbutil.run_to_source_breakpoint
can't handle the case where the breakpoint will be in a dlopen-ed
library, since it requires the breakpoint to have at least 1 location
before run. I fixed that by adding a parameter to say whether a
before run location is expected.
Differential Revision: https://reviews.llvm.org/D111920
Eugene Zhulenev [Mon, 18 Oct 2021 16:06:09 +0000 (09:06 -0700)]
[mlir] Update approximation range for Tanh operation
Use wider range for approximating Tanh to match results computed in Eigen with AVX.
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D112011
Louis Dionne [Thu, 7 Oct 2021 20:19:11 +0000 (16:19 -0400)]
[runtimes] Use the new "runtimes" build by default and deprecate other builds
This commit makes the new "runtimes" build (with <monorepo>/runtimes as
the root of the CMake invocation) the default way of building libc++.
The other supported way of building libc++ is the "bootstrapping" build,
where `<monorepo>/llvm` is used as the root of the CMake invocation.
All other ways of building libc++ are deprecated effective immediately.
There should be no use-case for building libc++ that isn't supported by
one of these two builds, and the two new builds work on all environments
and are lightweight. They will also make it possible to greatly simplify
the build infrastructure of the runtimes, which is currently way too
convoluted.
Differential Revision: https://reviews.llvm.org/D111356
Caitlyn Cano [Thu, 1 Jul 2021 20:41:51 +0000 (20:41 +0000)]
[mlir] SPIR-V: add sin, cos, log, sqrt OCL ops
Differential Revision: https://reviews.llvm.org/D111884
Yonghong Song [Mon, 18 Oct 2021 17:35:14 +0000 (10:35 -0700)]
[NFC][BPF] fix comments and rename functions related to BTF_KIND_DECL_TAG
There are no functionality change.
Fix some comments and rename processAnnotations() to
processDeclAnnotations() to avoid confusion when later
BTF_KIND_TYPE_TAG is introduced (https://reviews.llvm.org/D111199).
Jon Roelofs [Thu, 14 Oct 2021 19:15:35 +0000 (12:15 -0700)]
[AArch64][GlobalISel] combine and + [la]sr => ubfx
https://godbolt.org/z/h8ejrG4hb
rdar://
83597585
Differential Revision: https://reviews.llvm.org/D111839
Florian Hahn [Mon, 18 Oct 2021 17:21:48 +0000 (18:21 +0100)]
[LV] Update test that was missed in
e844f05397b72.
Yonghong Song [Mon, 18 Oct 2021 17:13:53 +0000 (10:13 -0700)]
BPF: fix a bug in IRPeephole pass
Commit
009f3a89d833 ("BPF: remove intrindics @llvm.stacksave()
and @llvm.stackrestore()") implemented IRPeephole pass to remove
llvm.stacksave()/stackrestore() instrinsics.
Buildbot reported a failure:
UNREACHABLE executed at ../lib/IR/LegacyPassManager.cpp:1445!
which is:
llvm_unreachable("Pass modifies its input and doesn't report it");
The code has changed but the implementation didn't return true
for changing. This patch fixed this problem.
Erich Keane [Mon, 18 Oct 2021 16:45:36 +0000 (09:45 -0700)]
Fix a comment in SemaSYCL to make sure I can commit
Jake Egan [Mon, 18 Oct 2021 17:07:45 +0000 (13:07 -0400)]
[AIX] Disable tests failing due to lack of 64-bit XCOFF object file support
The following tests are failing because 64-bit XCOFF object files are not currently supported on AIX. This patch disables these tests on AIX for now.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D111887
Ben Langmuir [Mon, 18 Oct 2021 16:38:35 +0000 (09:38 -0700)]
[JITLink][NFC] Fix Wdangling-else warning in LinkGraphTests
Fix a dangling else that gcc-11 warned about. The EXPECT_EQ macro
expands to an if-else, so the whole construction contains a hidden
hangling else.
Florian Hahn [Mon, 18 Oct 2021 16:55:48 +0000 (17:55 +0100)]
[LoopUtils] Simplify addRuntimeCheck to return a single value.
This simplifies the return value of addRuntimeCheck from a pair of
instructions to a single `Value *`.
The existing users of addRuntimeChecks were ignoring the first element
of the pair, hence there is not reason to track FirstInst and return
it.
Additionally all users of addRuntimeChecks use the second returned
`Instruction *` just as `Value *`, so there is no need to return an
`Instruction *`. Therefore there is no need to create a redundant
dummy `and X, true` instruction any longer.
Effectively this change should not impact the generated code because the
redundant AND will be folded by later optimizations. But it is easy to
avoid creating it in the first place and it allows more accurately
estimating the cost of the runtime checks.
Jacques Pienaar [Mon, 18 Oct 2021 17:00:37 +0000 (10:00 -0700)]
[mlir] Flipping Test dialect to prefixed form _Both
Starting with a mostly NFC change to be able to differentiate between
mechanical changes from ones that require more detailed review.
This will be used to flush out flow before flipping dialects used
outside local testing. As this dialect is not intended to be used
generally rather than in tests in core, I will not be following 2 week
staging approach here.
Craig Topper [Mon, 18 Oct 2021 16:45:08 +0000 (09:45 -0700)]
[RISCV] Rewrite forwardCopyWillClobberTuple to not assume that there are exactly 32 registers. NFC
This function was copied from ARM where register pairs/triples/quads can wrap around the 32 encoding space. So register 31 can pair with register 0. This is not true for RISCV vectors. The spec specifically mentions the possibility of a future encoding that has more than 32 registers.
This patch removes the modulo from the code and directly checks that destination register is in the source register range and not the beginning of the range. Though I don't expect an identity copy will occur.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D111467
LLVM GN Syncbot [Mon, 18 Oct 2021 16:52:00 +0000 (16:52 +0000)]
[gn build] Port
009f3a89d833
Yonghong Song [Fri, 15 Oct 2021 04:16:19 +0000 (21:16 -0700)]
BPF: remove intrindics @llvm.stacksave() and @llvm.stackrestore()
Paul Chaignon reported a bpf verifier failure ([1]) due to using
non-ABI register R11. For the test case, llvm11 is okay while
llvm12 and later generates verifier unfriendly code.
The failure is related to variable length array size.
The following mimics the variable length array definition
in the test case:
struct t { char a[20]; };
void foo(void *);
int test() {
const int a = 8;
char tmp[AA + sizeof(struct t) + a];
foo(tmp);
...
}
Paul helped bisect that the following llvm commit is
responsible:
552c6c232872 ("PR44406: Follow behavior of array bound constant
folding in more recent versions of GCC.")
Basically, before the above commit, clang frontend did constant
folding for array size "AA + sizeof(struct t) + a" to be 68,
so used alloca for stack allocation. After the above commit,
clang frontend didn't do constant folding for array size
any more, which results in a VLA and llvm.stacksave/llvm.stackrestore
is generated.
BPF architecture API does not support stack pointer (sp) register.
The LLVM internally used R11 to indicate sp register but it should
not be in the final code. Otherwise, kernel verifier will reject it.
The early patch ([2]) tried to fix the issue in clang frontend.
But the upstream discussion considered frontend fix is really a
hack and the backend should properly undo llvm.stacksave/llvm.stackrestore.
This patch implemented a bpf IR phase to remove these intrinsics
unconditionally. If eventually the alloca can be resolved with
constant size, r11 will not be generated. If alloca cannot be
resolved with constant size, SelectionDag will complain, the same
as without this patch.
[1] https://lore.kernel.org/bpf/
20210809151202.GB1012999@Mem/
[2] https://reviews.llvm.org/D107882
Differential Revision: https://reviews.llvm.org/D111897
AndreyChurbanov [Mon, 18 Oct 2021 16:48:30 +0000 (19:48 +0300)]
[OpenMP] libomp: add check of task function pointer for NULL.
This patch allows to simplify compiler implementation on "taskwait nowait"
construct. The "taskwait nowait" is semantically equivalent to the empty task.
Instead of creating an empty routine as a task entry, compiler can just send
NULL pointer to the runtime. Then the runtime will make all the work with
dependences and return because of the absent task routine.
Differential Revision: https://reviews.llvm.org/D112015
Kazu Hirata [Mon, 18 Oct 2021 16:33:42 +0000 (09:33 -0700)]
Use llvm::erase_if (NFC)
Kirill Stoimenov [Thu, 14 Oct 2021 19:36:07 +0000 (12:36 -0700)]
[Sanitizers] Replaced getMaxPointerSizeInBits with getPointerSizeInBits, which was causing failures for 32bit x86.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D111829
Arthur Eubanks [Wed, 6 Oct 2021 20:57:29 +0000 (13:57 -0700)]
Reland [clang] Pass -clear-ast-before-backend in Clang::ConstructJob()
This clears the memory used for the Clang AST before we run LLVM passes.
https://llvm-compile-time-tracker.com/compare.php?from=
d0a5f61c4f6fccec87fd5207e3fcd9502dd59854&to=
b7437fee79e04464dd968e1a29185495f3590481&stat=max-rss
shows significant memory savings with no slowdown (in fact -O0 slightly speeds up).
For more background, see
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068930.html.
Turn this off for the interpreter since it does codegen multiple times.
Relanding with fix for -print-stats: D111973
Differential Revision: https://reviews.llvm.org/D111270
Mogball [Mon, 18 Oct 2021 16:04:17 +0000 (16:04 +0000)]
[mlir][docs] Fix name of get arith->LLVM patterns in docs
Simon Pilgrim [Mon, 18 Oct 2021 16:00:22 +0000 (17:00 +0100)]
[ADT] Fix Wshift-overflow gcc warning in isPowerOf2 unit test
Mircea Trofin [Mon, 18 Oct 2021 15:53:40 +0000 (08:53 -0700)]
[NFC] ProfileSummary: const a bunch of members and fields.
It helps readability and maintainability (don't need to chase down
writes to a field I see is const, for example)
Mathieu Fehr [Mon, 18 Oct 2021 15:45:53 +0000 (15:45 +0000)]
[mlir][NFC] Provide accessor for TableGen record for constraints
Besides accessing the record, there is currently no way to access all possible
constraint informations, such as the base constraint of a variadic constraint
for example.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D111719
Mathieu Fehr [Mon, 18 Oct 2021 15:37:26 +0000 (15:37 +0000)]
[mlir] Add AnyAttrOf tablegen attribute constraint
AnyAttrOf, similar to AnyTypeOf, expects the attribute to be one of the
given attributes.
For instance, `AnyAttrOf<[I32Attr, StrAttr]>` expects either a `I32Attr`,
or a `StrAttr`.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D111739
Arthur Eubanks [Mon, 18 Oct 2021 05:48:35 +0000 (22:48 -0700)]
[clang] Disable -clear-ast-before-backend with -print-stats
We still need access to various things in the ASTContext when printing stats.
Differential Revision: https://reviews.llvm.org/D111973
gbreynoo [Mon, 18 Oct 2021 15:38:33 +0000 (16:38 +0100)]
[LLD][TEST] Add testing for negative addends for R_X86_64_32 and R_X86_64_PC32 relocations
This change is derived from a test case we have locally but I could not
see an equivalent in LLD's testing.
Differential Revision: https://reviews.llvm.org/D111803
River Riddle [Mon, 18 Oct 2021 15:17:40 +0000 (15:17 +0000)]
[mlir] Fix tsan failure in PassCrashRecovery
Don't set printOpOnDiagnostic, as this is not safe to call from a threaded context.
Differential Revision: https://reviews.llvm.org/D111752
Louis Dionne [Mon, 18 Oct 2021 15:21:16 +0000 (11:21 -0400)]
[libc++][NFC] Fix typo in test
River Riddle [Mon, 18 Oct 2021 15:07:23 +0000 (15:07 +0000)]
[mlir] Add support for specifying printing flags when adding an op to a Diagnostic
This removes edge cases where the default flags we want to use
during printing (e.g. local scope, eliding attributes, etc.)
get missed/dropped.
Differential Revision: https://reviews.llvm.org/D111761
Gil Rapaport [Tue, 21 Sep 2021 15:02:30 +0000 (18:02 +0300)]
[LV] Record memory widening decisions (NFCI)
Record widening decisions for memory operations within the planned recipes and
use the recorded decisions in code-gen rather than querying the cost model.
Differential Revision: https://reviews.llvm.org/D110479
Jon Chesterfield [Mon, 18 Oct 2021 15:03:01 +0000 (16:03 +0100)]
[libomptarget] Pass OMP_TARGET_OFFLOAD env variable through to tests
Useful for OMP_TARGET_OFFLOAD=MANDATORY when testing
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D111995
Ahmed Taei [Fri, 8 Oct 2021 23:23:46 +0000 (16:23 -0700)]
Allow only valid vector.shape_cast transitive folding
When folding A->B->C => A->C only accept A->C that is valid shape cast
Reviewed By: ThomasRaoux, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D111473
Juneyoung Lee [Mon, 18 Oct 2021 14:03:47 +0000 (23:03 +0900)]
Louis Dionne [Fri, 24 Sep 2021 16:04:12 +0000 (12:04 -0400)]
[libc++] Add the std::views::reverse range adaptor
Differential Revision: https://reviews.llvm.org/D110426
Jessica Clarke [Mon, 18 Oct 2021 14:10:17 +0000 (15:10 +0100)]
[Mips] Add glue between CopyFromReg, CopyToReg and RDHWR nodes for TLS
The MIPS ABI requires the thread pointer be accessed via rdhwr $3, $r29.
This is currently represented by (CopyToReg $3, (RDHWR $29)) followed by
a (CopyFromReg $3). However, there is no glue between these, meaning
scheduling can break those apart. In particular, PR51691 is a report
where PseudoSELECT_I was moved to between the CopyToReg and CopyFromReg,
and since its expansion uses branches, it split the def and use of the
physical register between two basic blocks, resulting in the def being
eliminated and the use having no def. It also seems possible that a
similar situation could arise splitting up the CopyToReg from the RDHWR,
causing the RDHWR to use a destination register other than $3, violating
the ABI requirement.
Thus, add glue between all three nodes to ensure they aren't split up
during instruction selection. No regression test is added since any test
would be implictly relying on specific scheduling behaviour, so whilst
it might be testing that glue is preventing reordering today, changes to
scheduling behaviour could result in the test no longer being able to
catch a regression here, as the reordering might no longer happen for
other unrelated reasons.
Fixes PR51691.
Reviewed By: atanasyan, dim
Differential Revision: https://reviews.llvm.org/D111967
Simon Pilgrim [Mon, 18 Oct 2021 13:58:55 +0000 (14:58 +0100)]
[ADT] Add some basic APInt::isPowerOf2() unit test coverage
rkayaith [Mon, 18 Oct 2021 14:00:39 +0000 (16:00 +0200)]
[mlir][python] Add 'loc' property to ops
Add a read-only `loc` property to Operation and OpView
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D111972
Raphael Isemann [Mon, 18 Oct 2021 13:49:37 +0000 (15:49 +0200)]
[lldb] Fix missing dependency on libc++ from LLDB test suite on non-Darwin platforms
Right now we only set a dependency on libc++ when the host is Darwin, which
means that libc++ in the build directory is in some undefined state when running
the test suite (it can be fully built, out-of-date or missing). Depending on
whether we have a system libc++ (which LLDB also supports running the libc++
tests against), the outcome is that we sometimes skip the libc++ tests or we run
the tests against a mix of ToT-libc++/system-libc++ (e.g., we compile against
the ToT-libc++ headers and link against the system libc++ library).
This can be demonstrated via `export LIT_FILTER=TestDataFormatterLibcxxSet ninja
check-lldb-api` (or any other libc++ test) and then gradually building parts of
libc++ in the same build (which will slowly change the test behaviour from
`UNSUPPORTED` to various failures to passing depending on how much of libcxx is
built at test time).
Note that this effectively re-enables the (unintentionally) disabled libc++
formatter tests on Linux. Don't revert this if it breaks a libc++ LLDB test,
instead please @skipIf decorate the failing test (as it was probably already
failing before this commit).
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D111981
Peter Waller [Mon, 18 Oct 2021 13:43:49 +0000 (13:43 +0000)]
[InstCombine][DebugInfo] Remove superflous assertion, add test [2/2]
Accidentally committed a prior version of this patch. This is the
correct version.
Kerry McLaughlin [Mon, 18 Oct 2021 12:32:41 +0000 (13:32 +0100)]
[SVE][CodeGen] Fix predicate for add/sub + element count patterns
The patterns added in D111441 should use the HasSVEorStreamingSVE
predicate. This changes one incorrect use of HasSVE with the new
patterns.
Andrew Wei [Mon, 18 Oct 2021 13:11:24 +0000 (21:11 +0800)]
[AArch64] Improve shuffle vector by using wider types
Try to widen element type to get a new mask value for a better permutation
sequence, so that we can use NEON shuffle instructions, such as zip1/2,
UZP1/2, TRN1/2, REV, INS, etc.
For example:
shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 7, i32 2, i32 3>
is equivalent to:
shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> <i32 3, i32 1>
Finally, we can get:
mov v0.d[0], v1.d[1]
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D111619
Pavel Labath [Mon, 18 Oct 2021 13:22:10 +0000 (15:22 +0200)]
[lldb] Delete TestStandardUnwind
It's been broken (not failing, but not testing anything either) for
quite some time now, and nobody noticed. It also (by design) tests
stepping through libc code, which makes it completely non-hermetic.
It's not worth reviving such a test.
Sanjay Patel [Mon, 18 Oct 2021 12:43:01 +0000 (08:43 -0400)]
[Analysis] add utility function for unary shuffle mask creation
This is NFC-intended for the callers. Posting in case there are
other potential users that I missed.
I would also use this from VectorCombine in a patch for:
https://llvm.org/PR52178 ( D111901 )
Differential Revision: https://reviews.llvm.org/D111891
Balazs Benics [Mon, 18 Oct 2021 12:57:24 +0000 (14:57 +0200)]
[analyzer] Allow matching non-CallExprs using CallDescriptions
Fallback to stringification and string comparison if we cannot compare
the `IdentifierInfo`s, which is the case for C++ overloaded operators,
constructors, destructors, etc.
Examples:
{ "std", "basic_string", "basic_string", 2} // match the 2 param std::string constructor
{ "std", "basic_string", "~basic_string" } // match the std::string destructor
{ "aaa", "bbb", "operator int" } // matches the struct bbb conversion operator to int
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D111535
Balazs Benics [Mon, 18 Oct 2021 12:57:24 +0000 (14:57 +0200)]
[analyzer][NFC] Refactor CallEvent::isCalled()
Refactor the code to make it more readable.
It will set up further changes, and improvements to this code in
subsequent patches.
This is a non-functional change.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D111534
Balazs Benics [Mon, 18 Oct 2021 12:57:24 +0000 (14:57 +0200)]
[analyzer][NFC] Add unittests for CallDescription and split the old ones
This NFC change accomplishes three things:
1) Splits up the single unittest into reasonable segments.
2) Extends the test infra using a template to select the AST-node
from which it is supposed to construct a `CallEvent`.
3) Adds a *lot* of different tests, documenting the current
capabilities of the `CallDescription`. The corresponding tests are
marked with `FIXME`s, where the current behavior should be different.
Both `CXXMemberCallExpr` and `CXXOperatorCallExpr` are derived from
`CallExpr`, so they are matched by using the default template parameter.
On the other hand, `CXXConstructExpr` is not derived from `CallExpr`.
In case we want to match for them, we need to pass the type explicitly
to the `CallDescriptionAction`.
About destructors:
They have no AST-node, but they are generated in the CFG machinery in
the analyzer. Thus, to be able to match against them, we would need to
construct a CFG and walk on that instead of simply walking the AST.
I'm also relaxing the `EXPECT`ation in the
`CallDescriptionConsumer::performTest()`, to check the `LookupResult`
only if we matched for the `CallDescription`.
This is necessary to allow tests in which we expect *no* matches at all.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D111794
Sylvestre Ledru [Mon, 18 Oct 2021 12:56:18 +0000 (14:56 +0200)]
Remove also Block-ABI-Apple.txt from the Makefile
Simon Pilgrim [Mon, 18 Oct 2021 12:46:10 +0000 (13:46 +0100)]
[X86][Costmodel] Add SSE2 sub-128bit vXi32/f32 stride 2 interleaved store costs
Differential Revision: https://reviews.llvm.org/D111941
Simon Pilgrim [Mon, 18 Oct 2021 12:13:57 +0000 (13:13 +0100)]
[X86][Costmodel] Add SSE2 sub-128bit vXi8/16 stride 2 interleaved store costs
Differential Revision: https://reviews.llvm.org/D111941
Pavel Labath [Mon, 18 Oct 2021 12:11:47 +0000 (14:11 +0200)]
[lldb] Fix PDB/compilands.test for a3939e1
@vladaindjic [Mon, 18 Oct 2021 09:33:21 +0000 (11:33 +0200)]
[OpenMP][OMPT] thread_num determination for programs with explicit tasks
__ompt_get_task_info_internal is now able to determine the right value of the
“thread_num” argument during the execution of an explicit task.
During the execution of a while loop that iterates over the ancestor tasks
hierarchy, the “prev_team” variable was always set to “team” variable at the
beginning of each loop iteration.
Assume that the program contains a parallel region which encloses an explicit
task executed by the worker thread of the region. Also assume that the tool
inquires the “thread_num” of a worker thread for the implicit task that
corresponds to the region (task at “ancestor_level == 1”) and expects to
receive the value of “thread_num > 0”.
After the loop finishes, both “team” and “prev_team” variables are equal and
point to the team information of the parallel region.
The “thread_num” is set to “prev_team->t.t_master_tid”, that is equal to
“team->t.t_master_tid”. In this case, “team->t.t_master_tid” is 0, since
the master thread of the region is the initial master thread of the program.
This leads to a contradiction.
To prevent this, “prev_team” variable is set to “team” variable only at the
time when the loop that has already encountered the implicit task (“taskdata”
variable contains the information about an implicit task) continues iterating
over the implicit task’s ancestors, if any.
After the mentioned loop finishes, the “prev_team” variable might be equal to
NULL. This means that the task at requested “ancestor_level” belongs to the
innermost parallel region, so the “thread_num” will be determined by calling
the “__kmp_get_tid”.
To prove that this patch works, the test case “explicit_task_thread_num.c” is
provided.
It contains the example of the program explained earlier in the summary.
Differential Revision: https://reviews.llvm.org/D110473
Joachim Protze [Mon, 18 Oct 2021 11:33:22 +0000 (13:33 +0200)]
[OpenMP][Tests][NFC] Work around ICC bug
Older intel compilers miss the privatization of nested loop variables for
doacross loops. Declaring the variable in the loop makes the test more
robust.
Joachim Protze [Mon, 18 Oct 2021 09:31:35 +0000 (11:31 +0200)]
[OpenMP][Tests][NFC] Flagging OMPT tests as XFAIL for Intel compilers
With Intel 19 compiler the teams tests fail to link while trying to link
liboffload.
Simon Pilgrim [Mon, 18 Oct 2021 11:36:29 +0000 (12:36 +0100)]
[Sema] haveSameParameterTypes - replace repeated isNull() test with assertions
As reported on https://pvs-studio.com/en/blog/posts/cpp/0771/ (Snippet 2) - (and mentioned on rGdc4259d5a38409) we are repeating the T1.isNull() check instead of checking T2.isNull() as well, and at this point neither should be null - so we're better off with an assertion.
Differential Revision: https://reviews.llvm.org/D107347
Stephen Tozer [Mon, 18 Oct 2021 10:56:06 +0000 (11:56 +0100)]
[DebugInfo] Correctly handle arrays with 0-width elements in GEP salvaging
Fixes an issue where GEP salvaging did not properly account for GEP
instructions which stepped over array elements of width 0 (effectively a
no-op). This unnecessarily produced long expressions by appending
`... + (x * 0)` and potentially extended the number of SSA values used
in the dbg.value. This also erroneously triggered an assert in the
salvage function that the element width would be strictly positive.
These issues are resolved by simply ignoring these useless operands.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D111809
Peter Waller [Mon, 18 Oct 2021 09:30:57 +0000 (09:30 +0000)]
[AArch64][SVE][CodeGen] Add tests for RSHRN{T,B} instructions
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D111735
Peter Waller [Wed, 13 Oct 2021 15:13:56 +0000 (15:13 +0000)]
[InstCombine][DebugInfo] Remove superflous assertion, add test
When this code was added, an unnecessary assertion slipped in which we
now hit in real code.
Add a test to defend against it firing again.
Jay Foad [Mon, 18 Oct 2021 10:39:36 +0000 (11:39 +0100)]
[AMDGPU] Remove unused VirtRegMap analysis. NFC.
Jeremy Morse [Mon, 18 Oct 2021 10:37:51 +0000 (11:37 +0100)]
[DebugInfo][InstrRef] Avoid a crash during DBG_PHI maintenence
With D110105, the isDebug flag for register uses is now a proxy for whether
the instruction is a debug instruction; that causes DBG_PHIs to have their
operands updated by calls to updateDbgUsersToReg, which is the correct
behaviour. However: that function only expects to receive DBG_VALUE
instructions and asserts such.
This patch splits the updating-action into a lambda, and applies it to the
appropriate operands for each kind of debug instruction. Tested with an
ARM test that stimulates this function: I've added some DBG_PHI
instructions that should be updated in the same way as DBG_VALUEs.
Differential Revision: https://reviews.llvm.org/D108641
Michał Górny [Sun, 17 Oct 2021 14:06:19 +0000 (16:06 +0200)]
[lldb] [lldb-server] Refactor ConnectToRemote()
Refactor ConnectToRemote() to improve readability and make future
changes easier:
1. Replace static buffers with std::string.
2. When handling errors, prefer reporting the actual error over dumb
'connection status is not success'.
3. Move host/port parsing directly into reverse_connection condition
that is its only user, and simplify it to make its purpose (verifying
that a valid port is provided) clear.
4. Use llvm::errs() and llvm::outs() instead of fprintf().
Differential Revision: https://reviews.llvm.org/D11196
Max Kazantsev [Mon, 18 Oct 2021 10:12:42 +0000 (17:12 +0700)]
Revert "[NFC] [LoopPeel] Change the way DT is updated for loop exits"
This reverts commit
fa16329ae0721023376f24c7577b9020d438df1a.
See comments in discussion. Merged by mistake, not entirely getting what
the problem was.
Shivam Gupta [Mon, 18 Oct 2021 09:43:32 +0000 (15:13 +0530)]
[NFC] Remove Block-ABI-Apple.txt
This file was rewritten in rst format in clang/docs/Block-ABI-Apple.rst
Lasse Folger [Mon, 18 Oct 2021 09:59:13 +0000 (11:59 +0200)]
[lldb][NFC] clang format change
clang format on some demangling files
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D111934
Pavel Labath [Mon, 18 Oct 2021 09:59:01 +0000 (11:59 +0200)]
[lldb] Fix SymbolFilePDBTests for a3939e1
Jan Svoboda [Mon, 18 Oct 2021 09:19:08 +0000 (11:19 +0200)]
[clang][modules] Delay creating `IdentifierInfo` for names of explicit modules
When using explicit Clang modules, some declarations might unexpectedly become invisible.
This is caused by the mechanism that loads PCM files passed via `-fmodule-file=<path>` and creates an `IdentifierInfo` for the module name. The `IdentifierInfo` creation takes place when the `ASTReader` is in a weird state, with modules that are loaded but not yet set up properly. This patch delays the creation of `IdentifierInfo` until the `ASTReader` is done with reading the PCM.
Note that the `-fmodule-file=<name>=<path>` form of the argument doesn't suffer from this issue, since it doesn't create `IdentifierInfo` for the module name.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D111543
Jay Foad [Mon, 18 Oct 2021 09:33:24 +0000 (10:33 +0100)]
[AMDGPU] Add link to bug
Jeremy Morse [Mon, 18 Oct 2021 09:26:09 +0000 (10:26 +0100)]
Fix signed/unsigned comparison after
b5426ced71280
gcc11 warns that this counter causes a signed/unsigned comaprison when it's
later compared with a SmallVector::difference_type. gcc appears to be
correct, clang does not warn one way or the other.
Jay Foad [Fri, 15 Oct 2021 10:32:02 +0000 (11:32 +0100)]
Remove the verifyAfter mechanism that was replaced by D111397
Differential Revision: https://reviews.llvm.org/D111872
Jay Foad [Fri, 15 Oct 2021 10:26:48 +0000 (11:26 +0100)]
Add new MachineFunction property FailsVerification
TargetPassConfig::addPass takes a "bool verifyAfter" argument which lets
you skip machine verification after a particular pass. Unfortunately
this is used in generic code in TargetPassConfig itself to skip
verification after a generic pass, only because some previous target-
specific pass damaged the MIR on that specific target. This is bad
because problems in one target cause lack of verification for all
targets.
This patch replaces that mechanism with a new MachineFunction property
called "FailsVerification" which can be set by (usually target-specific)
passes that are known to introduce problems. Later passes can reset it
again if they are known to clean up the previous problems.
Differential Revision: https://reviews.llvm.org/D111397
Piotr Sobczak [Fri, 15 Oct 2021 08:56:20 +0000 (10:56 +0200)]
[AMDGPU] Add patterns for i8/i16 local atomic load/store
Add patterns for i8/i16 local atomic load/store.
Added tests for new patterns.
Copied atomic_[store/load]_local.ll to GlobalISel directory.
Differential Revision: https://reviews.llvm.org/D111869
Kai Luo [Mon, 18 Oct 2021 09:17:04 +0000 (09:17 +0000)]
[AIX][cmake] Set atomics related macros when build with xlclang
Set `HAVE_CXX_ATOMICS_WITHOUT_LIB` or `HAVE_LIBATOMIC` when build LLVM with xlclang. With these macros set, libraries like libLLVMSupport are able to know whether it's necessary to add `-latomic` to dependent system libs. If `HAVE_LIBATOMIC` is set, `llvm-config --system-libs` appends `-latomic` to its output.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D111782
Fraser Cormack [Fri, 15 Oct 2021 13:24:53 +0000 (14:24 +0100)]
[SelectionDAG] Fix illegal widening of scalable-vector loads
The process of widening simple vector loads attempts to use a load of a
wider vector type if the original load is sufficiently aligned to avoid
memory faults.
However this optimization is only legal when performed on fixed-length
vector types. For scalable vector types this is invalid (unless vscale
happens to be 1).
This patch does increase the likelihood of compiler crashes (from
`FindMemType` failing to find a suitable type) but this now better
matches how widening non-simple loads, insufficiently-aligned loads, and
scalable-vector stores are handled.
Patches will be introduced later by which loads and stores can be
widened on targets with support for masked or predicated operations.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D111885
Luo, Yuanke [Mon, 11 Oct 2021 12:17:48 +0000 (20:17 +0800)]
[X86] Prefer VEX encoding in X86 assembler.
This patch is to order the AVX instructions ahead of AVX512 instructions
in the matching table so that the AVX instructions can be matched first.
Thanks Craig and Shengchen for the idea.
Differential Revision: https://reviews.llvm.org/D111538
Michał Górny [Fri, 15 Oct 2021 20:17:42 +0000 (22:17 +0200)]
[lldb] [Utility] Remove Status::WasInterrupted() along with its only use
Remove Status::WasInterrupted() that checks whether the underlying error
code matches EINTR. ProcessGDBRemote::ConnectToDebugserver() is its
only call site, and it does not seem correct there. After all, EINTR
is precisely when we want to retry, not stop retrying. Furthermore,
it should not really matter since we should be catching EINTR
immediately via llvm::sys::RetryAfterSignal() but that's another story.
Differential Revision: https://reviews.llvm.org/D111908
Florian Hahn [Mon, 18 Oct 2021 08:48:43 +0000 (09:48 +0100)]
[AArch64][GISel] Add 8/16 bit uaddo lowering tests.
Precommit tests for D111888.
Stanislav Mekhanoshin [Fri, 15 Oct 2021 20:07:32 +0000 (13:07 -0700)]
[AMDGPU] Divergence driven selection for fused bitlogic
The change adds divergence predicates for fused logical operations.
The problem with selecting a scalar fused op such as S_NOR_B32 is
that it does not have a VALU counterpart and will be split in
moveToVALU. At the same time it prevents selection of a better
opcode on the VALU side (such as V_OR3_B32) which does not have a
counterpart on SALU side.
XNOR opcodes are left as is and selected as scalar to get advantage
of the SIInstrInfo::lowerScalarXnor() code which can commute
operations to keep one of two opcodes on SALU if possible. See
xnor.ll test for this.
Differential Revision: https://reviews.llvm.org/D111907
Adrian Kuegel [Mon, 18 Oct 2021 07:37:31 +0000 (09:37 +0200)]
Fix bazel build.
This is a temporary fix, better would be to avoid including
llvm/Option/ArgList.h from a Support source file.
Differential Revision: https://reviews.llvm.org/D111974
Pavel Labath [Fri, 15 Oct 2021 11:07:39 +0000 (13:07 +0200)]
[lldb] Return StringRef from PluginInterface::GetPluginName
There is no reason why this function should be returning a ConstString.
While modifying these files, I also fixed several instances where
GetPluginName and GetPluginNameStatic were returning different strings.
I am not changing the return type of GetPluginNameStatic in this patch, as that
would necessitate additional changes, and this patch is big enough as it is.
Differential Revision: https://reviews.llvm.org/D111877
Raphael Isemann [Mon, 18 Oct 2021 07:53:45 +0000 (09:53 +0200)]
Fix cyclic header dependency between Support<->Option due to RISCVISAInfo
This was introduced in D105168 which added RISCVISAInfo.h.
Haojian Wu [Tue, 12 Oct 2021 14:13:09 +0000 (16:13 +0200)]
[Parse] Improve diagnostic and recovery when there is an extra override in the outline method definition.
The clang behavior was poor before this patch:
```
void B::foo() override {}
// Before: clang emited "expcted function body after function
// declarator", and skiped all contents until it hits a ";", the
// following function f() is discarded.
// VS
// Now "override is not allowed" with a remove fixit, and following f()
// is retained.
void f();
```
Differential Revision: https://reviews.llvm.org/D111883
Jingu Kang [Fri, 15 Oct 2021 22:25:23 +0000 (23:25 +0100)]
[AArch64] Fixed a bug on AArch64MIPeepholeOpt
Create new virtual register for the definition of new AND instruction and
replace old register by the new one to keep SSA form.
Differential Revision: https://reviews.llvm.org/D109963
Bing1 Yu [Mon, 18 Oct 2021 07:41:06 +0000 (15:41 +0800)]
[MachineSink] Compile time improvement for large testcases which has many kill flags
We did a experiment and observed dramatic decrease on compilation time which spent on clearing kill flags.
Before:
Number of BasicBlocks:33357
Number of Instructions:162067
Number of Cleared Kill Flags:32869
Time of handling kill flags(ms):1.607509e+05
After:
Number of BasicBlocks:33357
Number of Instructions:162067
Number of Cleared Kill Flags:32869
Time of handling kill flags:3.987371e+03
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D111688
Qiu Chaofan [Mon, 18 Oct 2021 07:27:49 +0000 (15:27 +0800)]
[PowerPC] Implement scheduling model for Power10
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D110855
Lang Hames [Mon, 18 Oct 2021 05:57:04 +0000 (22:57 -0700)]
[JITLink] Add comments, rename types for visitExistingEdges utility.
The "Fixers" name was a hangover from an earlier draft of the patch. "Visitors"
fits the function name(s).
Max Kazantsev [Mon, 18 Oct 2021 03:23:05 +0000 (10:23 +0700)]
[NFC] [LoopPeel] Change the way DT is updated for loop exits
When peeling a loop, we assume that the latch has a `br` terminator and
that all loop exits are either terminated with an `unreachable` or have
a terminating deoptimize call. So when we peel off the 1st iteration, we
change the IDom of all loop exits to the peeled copy of
`NCD(IDom(Exit), Latch)`. This works now, but if we add logic to support
loops with exits that are followed by a block with an `unreachable` or a
terminating deoptimize call, changing the exit's idom wouldn't be enough
and DT would be broken.
For example, let `Exit1` and `Exit2` are loop exits, and each of them
unconditionally branches to the same `unreachable` terminated block. So
neither of the exits dominates this unreachable block. If we change the
IDoms of the exits to some peeled loop block, we don't update the
dominators of the unreachable block. Currently we just don't get to the
peeling logic, saying that we can't peel such loops.
With this NFC we just insert edges from cloned exiting blocks to their
exits after peeling each iteration (we accumulate the insertion updates
and then after peeling apply the updates to DT).
This patch was a part of D110922.
Patch by Dmitry Makogon!
Differential Revision: https://reviews.llvm.org/D111611
Reviewed By: mkazantsev
Jonas Devlieghere [Mon, 18 Oct 2021 02:12:19 +0000 (19:12 -0700)]
[lldb] Skip target variable test on AS
Kazu Hirata [Sun, 17 Oct 2021 20:50:29 +0000 (13:50 -0700)]
[clang] Use llvm::erase_if (NFC)
Simon Pilgrim [Sun, 17 Oct 2021 19:34:17 +0000 (20:34 +0100)]
[CostModel][X86] Add mul by positive/negative power-of-2 constants tests
We have backend optimizations for these, but currently the costmodel doesn't match them
Valentin Clement [Sun, 17 Oct 2021 18:54:49 +0000 (20:54 +0200)]
[fir] Add IfBuilder and utility functions
In order to reduct the size of D111337. The IfBuilder and the two
utility functions genIsNotNull and genIsNull have been extracted in
a separate patch with dedicated unittests.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: Leporacanthicus
Differential Revision: https://reviews.llvm.org/D111796
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Simon Pilgrim [Sun, 17 Oct 2021 17:51:15 +0000 (18:51 +0100)]
[CostModel][X86] Add div/rem by negative power-of-2 constants
We have backend optimizations for these (like we do for power-of-2 divisions), but currently the costmodel doesn't match them
Simon Pilgrim [Sun, 17 Oct 2021 17:12:59 +0000 (18:12 +0100)]
[X86][SLM] Fix BitTest+Set uops + port usage
Both ports are required for BitTest ops. Update the uops counts + port usage based off the most recent llvm-exegesis captures and what Intel AoM / Agner reports as well.
Simon Pilgrim [Sat, 16 Oct 2021 20:41:21 +0000 (21:41 +0100)]
[X86][SLM] Fix uops for PCMPISTR/PCMPISTR instructions
Based off a recent llvm-exegesis capture and what Intel AoM / Agner reports as well.
Simon Pilgrim [Sat, 16 Oct 2021 20:35:12 +0000 (21:35 +0100)]
[X86][SLM] Fix uops for PCLMULQDQ
Based off a recent llvm-exegesis capture and what Intel AoM / Agner reports as well.
Simon Pilgrim [Sat, 16 Oct 2021 20:29:24 +0000 (21:29 +0100)]
[X86][SLM] +1uop for PSHUFBrm xmm
Extra 1uop for folded pshufb ops, based off a recent llvm-exegesis capture and what Intel AoM / Agner reports as well.