Jeremy Morse [Tue, 19 Oct 2021 09:24:12 +0000 (10:24 +0100)]
[DebugInfo][NFC] Zero-initialize a class field
This field gets assigned when the relevant object starts being used; but it
remains uninitialized beforehand. This risks introducing hard-to-detect
bugs if something changes, so zero-initialize the field.
Luke Benes [Tue, 19 Oct 2021 09:12:18 +0000 (10:12 +0100)]
[DebugInfo][InstrRef] Fix Wdangling-else warning in InstrRefLDVTest
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
dangling else.
Differential Revision: https://reviews.llvm.org/D112044
Michał Górny [Fri, 27 Aug 2021 16:55:37 +0000 (18:55 +0200)]
[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*
gdbserver does not expose combined ymm* registers but rather XSAVE-style
split xmm* and ymm*h portions. Extend value_regs to support combining
multiple registers and use it to create user-friendly ymm* registers
that are combined from split xmm* and ymm*h portions.
Differential Revision: https://reviews.llvm.org/D108937
Qiaojin.Bao [Mon, 18 Oct 2021 09:34:30 +0000 (17:34 +0800)]
[llvm-shlib] Fix windows build failed while llvm non-standalone building.
While build llvm-project as a sub-project on windows, met a build error:
libllvm-c.exports /llvm/bin\llvm-nm.exe: error: ...builds/rel64ninja/./lib/LLVMDemangle.lib: no such file or directory
The libllvm-c.exports, libllvm-c.args, and lib/*.lib should under LLVM_BINARY_DIR, using CMAKE_BINARY_DIR will cause 'no such file' error while llvm-project built as a sub-project.
Fangrui Song [Tue, 19 Oct 2021 08:09:40 +0000 (01:09 -0700)]
[Driver][Gnu] Support -shared -static: pass -shared to ld and use crtbeginS.o
This mode never works (mismatching crtbeginT.o and crtendS.o) and probably
unsupported by GCC on glibc based Linux distro (incorrect crtbeginT.o causes
linker error) but makes sense (-shared means building a shared object, -static
means avoid shared object dependencies) and can be used on musl based Linux
distro.
mingw supports this mode as well.
Christian Kühnel [Wed, 13 Oct 2021 15:14:57 +0000 (15:14 +0000)]
first draft of a written policy around git repos
This is a frist draft of a set of policies around new git repos and how we grant write access to our GitHub organisation.
This proposal is based on the discussions in:
https://github.com/llvm/llvm-iwg/issues/40
https://github.com/llvm/llvm-iwg/issues/51
Differential Revision: https://reviews.llvm.org/D111723
Jon Chesterfield [Tue, 19 Oct 2021 07:05:05 +0000 (08:05 +0100)]
[libomptarget] Refactor DeviceRTL prior to AMDGPU bringup
Subset of D111993. Fix typos, rename read to load.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D111999
Jonas Devlieghere [Tue, 19 Oct 2021 06:21:06 +0000 (23:21 -0700)]
[lldb] Fix nullptr dereference in AppleObjCRuntimeV2
Fix a potential nullptr dereference in AppleObjCRuntimeV2 by checking
the result of GetClassInfoUtilityFunction and returning a failure if
it's null.
The DynamicClassInfoExtractor was already doign the right thing, but the
SharedCacheClassInfoExtractor was missing this check.
Fangrui Song [Tue, 19 Oct 2021 05:38:41 +0000 (22:38 -0700)]
[tools] Delete redundant 'static' from namespace scope 'static const'. NFC
Fangrui Song [Tue, 19 Oct 2021 05:21:54 +0000 (22:21 -0700)]
[llvm-readobj] Delete redundant 'static' from namespace scope 'static const'. NFC
By default, such a non-template variable of non-volatile const-qualified type
having namespace-scope has internal linkage ([basic.link]), so no need for `static`.
Lang Hames [Tue, 19 Oct 2021 04:41:08 +0000 (21:41 -0700)]
[JITLink][x86-64] Lift GOT, PLT table managers into x86_64.h; reuse for MachO.
This lifts the global offset table and procedure linkage table builders out of
ELF_x86_64.h and into x86_64.h, renaming them with generic names
x86_64::GOTTableBuilder and x86_64::PLTTableBuilder. MachO_x86_64.cpp is updated
to use these classes instead of the older PerGraphGOTAndStubsBuilder tool.
Craig Topper [Tue, 19 Oct 2021 04:34:01 +0000 (21:34 -0700)]
[RISCV] Remove the HasSideEffects property from riscv_vector.td
It was being used to control the nothrow attribute on the builtins. The
nothrow attribute is for C++ exceptions. Even if the vector builtins
have side effects in IR, that's different than the nothrow attribute.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D112028
Craig Topper [Tue, 19 Oct 2021 04:26:17 +0000 (21:26 -0700)]
[RISCV] Split RISCV vector builtins into their own file and namespace.
Similar to SVE, this separates the RVV builtlins into their own
region of builtin IDs. Only those IDs are allowed to be used by
the builtin_alias attribute now.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D111923
Dave MacLachlan [Tue, 19 Oct 2021 04:01:40 +0000 (09:31 +0530)]
Fix small typo in Block ABI docs
I think the C++ code example had the wrong name for the block copy function.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D91815
Lang Hames [Tue, 19 Oct 2021 01:53:05 +0000 (18:53 -0700)]
[JITLink] Use DEBUG_WITH_TYPE, rather than defining DEBUG_TYPE.
This avoids defining DEBUG_TYPE in a public header.
Noah Shutty [Tue, 19 Oct 2021 01:40:57 +0000 (18:40 -0700)]
[Support][ThinLTO] Move ThinLTO caching to LLVM Support library
We would like to move ThinLTO’s battle-tested file caching mechanism to
the LLVM Support library so that we can use it elsewhere in LLVM.
Patch By: noajshu
Differential Revision: https://reviews.llvm.org/D111371
Hsiangkai Wang [Thu, 7 Oct 2021 11:30:33 +0000 (19:30 +0800)]
[RISCV] Reorder the vector register allocation order.
GPR uses argument registers as the first group of registers to allocate.
This patch uses vector argument registers, v8 to v23, as the first group
to allocate.
Differential Revision: https://reviews.llvm.org/D111304
Mogball [Tue, 19 Oct 2021 00:48:24 +0000 (00:48 +0000)]
[mlir] fix bugs with NamedAttrList
- `assign` with ArrayRef was calling `append`
- `assign` with empty ArrayRef was not clearing storage
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D112043
Lang Hames [Tue, 19 Oct 2021 01:11:48 +0000 (18:11 -0700)]
Simplify the TableManager class and move it into a public header.
Moves visitEdge into the TableManager derivatives, replacing the fixEdgeKind
methods in those classes. The visitEdge method takes on responsibility for
updating the edge target, as well as its kind.
Matthias Springer [Tue, 19 Oct 2021 00:08:38 +0000 (09:08 +0900)]
[mlir][scf] Add insideMutuallyExclusiveBranches helper
This helper function checks if two given ops are in mutually exclusive branches of the same scf::IfOp.
Differential Revision: https://reviews.llvm.org/D111957
Matthias Springer [Mon, 18 Oct 2021 23:59:32 +0000 (08:59 +0900)]
[mlir] Add enclosingOpOk parameter to properlyDominates
Differential Revision: https://reviews.llvm.org/D111959
Jim Ingham [Mon, 18 Oct 2021 23:52:15 +0000 (16:52 -0700)]
Follow-on to fix a test from
c5011aed9c297d6ddd8ee4f77453b215aa27554a.
I need to set a fake default platform for the UnitTest test to run on other
systems.
Arthur Eubanks [Mon, 18 Oct 2021 22:43:08 +0000 (15:43 -0700)]
[opt] Directly translate -O# to -passes='default<O#>'
Right now when we see -O# we add the corresponding 'default<O#>' into
the list of passes to run when translating legacy -pass-name. This has
the side effect of not using the default AA pipeline.
Instead, treat -O# as -passes='default<O#>', but don't allow any other
-passes or -pass-name. I think we can keep `opt -O#` as shorthand for
`opt -passes='default<O#>` but disallow anything more than just -O#.
Tests need to be updated to not use `opt -O# -pass-name`.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D112036
Arthur Eubanks [Mon, 18 Oct 2021 23:35:20 +0000 (16:35 -0700)]
[test] Remove tests pinned to the legacy PM
Now that the legacy PM is deprecated for the optimization pipeline, we
can start deleting legacy PM tests.
For tests that test both PMs, merge the RUN lines.
Delete tests specific to the legacy PM.
not-jenni [Mon, 18 Oct 2021 23:22:01 +0000 (16:22 -0700)]
[mlir][tosa] Adds a canonicalization to the transpose op if the perms are a no op
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D112037
Michael Jones [Wed, 1 Sep 2021 23:51:05 +0000 (23:51 +0000)]
[libc] add atof, strtof and strtod
Add the string to floating point conversion functions.
Long doubles aren't supported yet, but floats and doubles are. The
primary algorithm used is the Eisel-Lemire ParseNumberF64 algorithm,
with the Simple Decimal Conversion algorithm as backup.
Links for more information on the algorithms:
Number Parsing at a Gigabyte per Second, Software: Practice and
Experience 51 (8), 2021 (https://arxiv.org/abs/2101.11408)
https://nigeltao.github.io/blog/2020/eisel-lemire.html
https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html
Differential Revision: https://reviews.llvm.org/D109261
Craig Topper [Mon, 18 Oct 2021 22:56:03 +0000 (15:56 -0700)]
[RISCV][TableGen] Remove HasMaskedOffOperand as a member of RVVIntrinsic. NFC
This value is only used by the RVVIntrinsic constructor. We don't
need it to be a member.
Anshil Gandhi [Mon, 18 Oct 2021 22:51:20 +0000 (16:51 -0600)]
[HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols
By default clang emits complete contructors as alias of base constructors if they are the same.
The backend is supposed to emit symbols for the alias, otherwise it causes undefined symbols.
@yaxunl observed that this issue is related to the llvm options `-amdgpu-early-inline-all=true`
and `-amdgpu-function-calls=false`. This issue is resolved by only inlining global values
with internal linkage. The `getCalleeFunction()` in AMDGPUResourceUsageAnalysis also had
to be extended to support aliases to functions. inline-calls.ll was corrected appropriately.
Reviewed By: yaxunl, #amdgpu
Differential Revision: https://reviews.llvm.org/D109707
Craig Topper [Mon, 18 Oct 2021 18:47:15 +0000 (11:47 -0700)]
[RISCV] Fix typo in comment. NFC
Jim Ingham [Tue, 12 Oct 2021 17:55:24 +0000 (10:55 -0700)]
Add a "command container" hierarchy to allow users to add container nodes.
The point is to allow users with a related set of script based commands
to organize their commands in a hierarchy in the command set, rather than
having to have only top-level commands.
Differential Revision: https://reviews.llvm.org/D110298
modimo [Mon, 18 Oct 2021 22:26:01 +0000 (15:26 -0700)]
[InlineAdvisor][NFC] Fix tests added in D110658 V2
On Windows there's an *.exe suffix to opt that isn't present in Linux.
Remove the check for opt in the string
wren romano [Mon, 18 Oct 2021 19:55:54 +0000 (12:55 -0700)]
[mlir][sparse] Renaming variables for consistency/clarity
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D112029
Petr Hosek [Tue, 29 Sep 2020 00:37:20 +0000 (17:37 -0700)]
[CMake] Cache the compiler-rt library search results
There's a lot of duplicated calls to find various compiler-rt libraries
from build of runtime libraries like libunwind, libc++, libc++abi and
compiler-rt. The compiler-rt helper module already implemented caching
for results avoid repeated Clang invocations.
This change moves the compiler-rt implementation into a shared location
and reuses it from other runtimes to reduce duplication and speed up
the build.
Differential Revision: https://reviews.llvm.org/D88458
Tom Stellard [Mon, 18 Oct 2021 21:31:44 +0000 (14:31 -0700)]
repo-lockdown: Add pr comment and fix typo
Tom Stellard [Mon, 18 Oct 2021 21:18:17 +0000 (14:18 -0700)]
workflows: Migrate repo-lockdown to GitHub Actions
https://github.com/dessant/repo-lockdown/issues/6
modimo [Mon, 18 Oct 2021 21:19:41 +0000 (14:19 -0700)]
[InlineAdvisor][NFC] Fix tests added in D110658 on
Windows which outputs "is a directory" rather than "Is a directory" on error compared to linux
Simon Pilgrim [Mon, 18 Oct 2021 21:12:47 +0000 (22:12 +0100)]
[X86] combineMulToPMADDWD - replace ASHR(X,16) -> LSHR(X,16)
If we're using an ashr to sign-extend the entire upper 16 bits of the i32 element, then we can replace with a lshr. The sign bit will be correctly shifted for PMADDWD's implicit sign-extension and the upper 16 bits are zero so the upper i16 sext-multiply is guaranteed to be zero.
The lshr also has a better chance of folding with shuffles etc.
David Blaikie [Mon, 18 Oct 2021 21:09:34 +0000 (14:09 -0700)]
Suppress some bitwise-or-of-bool warnings with explicit int cast
These look like they have intentional side effects that would break from
shortcircuiting.
Arthur Eubanks [Mon, 18 Oct 2021 20:49:53 +0000 (13:49 -0700)]
[InlineCost] Add empty line between call sites when printing inline costs
Aart Bik [Fri, 15 Oct 2021 23:10:30 +0000 (16:10 -0700)]
[mlir][sparse] generalize sparse_tensor.convert on static/dynamic dimension sizes
This revison lifts the artificial restriction on having exact matches between
source and destination type shapes. A static size may become dynamic. We still
reject changing a dynamic size into a static size to avoid the need for a
runtime "assert" on the conversion. This revision also refactors some of the
conversion code to share same-content buffers.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D111915
Simon Pilgrim [Mon, 18 Oct 2021 20:42:40 +0000 (21:42 +0100)]
[X86] Regenerate testb-je-fusion.ll with common NOFUSION/FUSION prefixes
peter klausler [Wed, 13 Oct 2021 01:20:18 +0000 (18:20 -0700)]
[flang] Fold BTEST
Implements constant folding for BTEST intrinsic function.
Differential Revision: https://reviews.llvm.org/D111849
Craig Topper [Mon, 18 Oct 2021 20:26:35 +0000 (13:26 -0700)]
[RISCV] Use a lambda to avoid having the Support library depend on Option library.
RISCVISAInfo::toFeatures needs to allocate strings using
ArgList::MakeArgString, but toFeatures lives in Support and
MakeArgString lives in Option.
toFeature only has one caller, so the simple fix is to have that
caller pass a lamdba that wraps MakeArgString to break the
dependency.
Differential Revision: https://reviews.llvm.org/D112032
Matt Morehouse [Mon, 18 Oct 2021 16:08:36 +0000 (09:08 -0700)]
[x86] Implement a tagged-globals backend feature.
The feature tells the backend to allow tags in the upper bits of global
variable addresses. These tags will be ignored by upcoming CPUs with
the Intel LAM feature but may be used in instrumentation passes (e.g.,
HWASan).
This patch implements the feature by using @GOTPCREL relocations instead
of direct references to the locally defined global. Thus the full
tagged address can be loaded by a single instruction:
movq global@GOTPCREL(%rip), %rax
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D111343
Alexandros Lamprineas [Mon, 18 Oct 2021 18:24:05 +0000 (19:24 +0100)]
[DebugInfo][ARM] Fix incorrect debug information for RWPI accessed globals
When compiling for the RWPI relocation model the debug information is wrong:
* the debug location is described as { DW_OP_addr Var }
instead of { DW_OP_constNu Var DW_OP_bregX 0 DW_OP_plus }
* the relocation type is R_ARM_ABS32 instead of R_ARM_SBREL32
Differential Revision: https://reviews.llvm.org/D111404
Arthur Eubanks [Mon, 11 Oct 2021 19:57:30 +0000 (12:57 -0700)]
[NewPM] Add PipelineTuningOption to eagerly invalidate analyses
This trades off more compile time for less peak memory usage. Right now
it invalidates all function analyses after a module->function or
cgscc->function adaptor.
https://llvm-compile-time-tracker.com/compare.php?from=
1fb24fe85a19ae71b00875ff6c96ef1831dcf7e3&to=
cb28ddb063c87f0d5df89812ab2de9a69dd276db&stat=instructions
https://llvm-compile-time-tracker.com/compare.php?from=
1fb24fe85a19ae71b00875ff6c96ef1831dcf7e3&to=
cb28ddb063c87f0d5df89812ab2de9a69dd276db&stat=max-rss
For now this is just experimental.
See comments on why this may affect optimizations.
Reviewed By: asbirlea, nikic
Differential Revision: https://reviews.llvm.org/D111575
Alexey Bataev [Fri, 15 Oct 2021 16:47:50 +0000 (09:47 -0700)]
[SLP]Fix emission of the shrink shuffles.
Need to follow the order of the reused scalars from the
ReuseShuffleIndices mask rather than rely on the natural order.
Differential Revision: https://reviews.llvm.org/D111898
modimo [Mon, 18 Oct 2021 20:08:13 +0000 (13:08 -0700)]
[InlineAdvisor] Add -inline-replay-scope=<Function|Module> to control replay scope
The goal is to allow grafting an inline tree from Clang or GCC into a new compilation without affecting other functions. For GCC, we're doing this by extracting the inline tree from dwarf information and generating the equivalent remarks.
This allows easier side-by-side asm analysis and a trial way to see if a particular inlining setup provides benefits by itself.
Testing:
ninja check-all
Reviewed By: wenlei, mtrofin
Differential Revision: https://reviews.llvm.org/D110658
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/D111963
Michał Górny [Mon, 18 Oct 2021 20:04:36 +0000 (22:04 +0200)]
Revert "[lldb] [lldb-server] Refactor ConnectToRemote()"
This reverts commit
d8bc7e40ce1cdd8c1a3fac7937ce1ea85c262728. I've
linked the wrong Differential Revision.
Nikita Popov [Mon, 18 Oct 2021 19:47:15 +0000 (21:47 +0200)]
[ExpandMemCmp] Update CFG before DTU
The applyUpdates() API requires that the CFG is already updated,
so make sure to insert the new terminator first.
LLVM GN Syncbot [Mon, 18 Oct 2021 19:24:29 +0000 (19:24 +0000)]
[gn build] Port
8e46e34d2435
Petr Hosek [Mon, 18 Oct 2021 19:23:52 +0000 (12:23 -0700)]
Revert "[Support][ThinLTO] Move ThinLTO caching to LLVM Support library"
This reverts commit
92b8cc52bbc8194f2cd6a5f742b874969421afca since
it broke the gold plugin.
LLVM GN Syncbot [Mon, 18 Oct 2021 19:09:19 +0000 (19:09 +0000)]
[gn build] Port
92b8cc52bbc8
Noah Shutty [Mon, 18 Oct 2021 18:30:31 +0000 (11:30 -0700)]
[Support][ThinLTO] Move ThinLTO caching to LLVM Support library
We would like to move ThinLTO’s battle-tested file caching mechanism to
the LLVM Support library so that we can use it elsewhere in LLVM.
Patch By: noajshu
Differential Revision: https://reviews.llvm.org/D111371
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.