Simon Pilgrim [Tue, 19 Oct 2021 13:37:34 +0000 (14:37 +0100)]
[ADT] Add APInt::isNegatedPowerOf2() helper
Inspired by D111968, provide a isNegatedPowerOf2() wrapper instead of obfuscating code with (-Value).isPowerOf2() patterns, which I'm sure are likely avenues for typos.....
Differential Revision: https://reviews.llvm.org/D111998
Michał Górny [Tue, 19 Oct 2021 13:33:27 +0000 (15:33 +0200)]
Revert "[lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM"
This reverts commit
1c2c67b46b55a2a81ebc988c829e2eee13a4fec6.
Something's still wrong.
Matt Morehouse [Mon, 18 Oct 2021 20:34:16 +0000 (13:34 -0700)]
[HWASan] Use tagged-globals feature on x86.
Allows us to use the small code model when we disable relocation
relaxation.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D111344
Michał Górny [Tue, 19 Oct 2021 12:17:20 +0000 (14:17 +0200)]
[lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM
Fix incorrect values for value_regs, and incomplete values for
invalidate_regs in RegisterInfos_arm. The value_regs entry needs
to list only one base (i.e. larger) register that needs to be read
to get the value for this register, while invalidate_regs needs to list
all other registers (including pseudo-register) whose values would
change when this register is written to.
While at it, introduce helper macros for the definitions.
7a8ba4ffbeecb5070926b80bb839a4d80539f1ac fixed a similar problem
for ARM64.
Differential Revision: https://reviews.llvm.org/D112066
bakhtiyar [Tue, 19 Oct 2021 12:20:29 +0000 (05:20 -0700)]
Canonicalize max/min operations on integers.
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D112051
Louis Dionne [Mon, 18 Oct 2021 21:54:05 +0000 (17:54 -0400)]
[runtimes] Make sure LLVM_LIT_ARGS is set before including individual runtimes
Otherwise, the individual `check-cxx`, `check-cxxabi` and similar targets
will not know about `LLVM_LIT_ARGS`, and we'll end up running lit without
any argument.
Differential Revision: https://reviews.llvm.org/D112035
Valentin Clement [Tue, 19 Oct 2021 12:16:10 +0000 (14:16 +0200)]
[fir] Add FIRBuilder utility functions
Extract some code from the big ptach D111337. This patch
contains some utility functions from the FIRBuidler.
List of utility functions added:
- getRegion
- getModule
- getKindMap
- getRefType
- getVarLenSeqTy
- getRealType
- createNullConstant
- createRealConstant
- createRealZeroConstant
- createGlobal
- createGlobalConstant
- createStringLitOp
- getNamedFunction
- getNamedGlobal
- createFunction
- addNamedFunction
- createBool
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D112057
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Shraiysh Vaishay [Tue, 19 Oct 2021 11:48:51 +0000 (17:18 +0530)]
[MLIR][OpenMP] Added parseClauses
Code reorganized in OpenMPDialect.cpp to have all functions corresponding to an operation together.
Added parseClauses function to avoid code duplication while parsing clauses in OpenMP operations. Also added printers and verifiers for clauses, which are being used for multiple operations.
Reviewed By: kiranchandramohan, peixin
Differential Revision: https://reviews.llvm.org/D110903
Michał Górny [Tue, 19 Oct 2021 11:32:41 +0000 (13:32 +0200)]
[lldb] [ABI/X86] Refactor ABIX86::AugmentRegisterInfo()
Refactor ABIX86::AugmentRegisterInfo() and helper functions for better
readability. This also fixes listing eax & co. as potential subregs
on 32-bit systems.
Differential Revision: https://reviews.llvm.org/D108937
Michał Górny [Fri, 15 Oct 2021 14:38:09 +0000 (16:38 +0200)]
[lldb] [Host] Make Terminal methods return llvm::Error
Differential Revision: https://reviews.llvm.org/D111890
Adam Czachorowski [Thu, 30 Sep 2021 13:11:29 +0000 (15:11 +0200)]
[clangd] Add code completion of param name on /* inside function calls.
For example, if you have:
void foo(int bar);
foo(/*^
it should auto-complete to "bar=".
Because Sema callbacks for code completion in comments happen before we
have an AST we need to cheat in clangd by detecting completion on /*
before, moving cursor back by two characters, then running a simplified
verion of SignatureHelp to extract argument name(s) from possible
overloads.
Differential Revision: https://reviews.llvm.org/D110823
Raphael Isemann [Tue, 19 Oct 2021 10:43:23 +0000 (12:43 +0200)]
[lldb] Adjust udt-layout.test after MS mangling change
The demangled name no longer contains the redundant name since D111715.
Michał Górny [Tue, 19 Oct 2021 10:31:25 +0000 (12:31 +0200)]
Revert "[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*"
This reverts commit
5352ea4a721ef252129994111b83dc350ecc71da. It seems
to have broken the arm buildbot.
Jeremy Morse [Tue, 19 Oct 2021 10:07:49 +0000 (11:07 +0100)]
[DebugInfo][InstrRef] Avoid un-necessary densemap copies and comparisons
This is purely a performance patch: InstrRefBasedLDV used to use three
DenseMaps to store variable values, two for long term storage and one as a
working set. This patch eliminates the working set, and updates the long
term storage in place, thus avoiding two DenseMap comparisons and two
DenseMap assignments, which can be expensive.
Differential Revision: https://reviews.llvm.org/D111716
Pavel Labath [Mon, 18 Oct 2021 12:45:57 +0000 (14:45 +0200)]
[lldb] Reduce code duplication around inferior building
We had two sets of build<flavour> methods, whose bodies were largely
identical. This makes any kind of modification in their vicinity
repetitive and error-prone.
Replace each set with a single method taking an optional debug_info
parameter.
Differential Revision: https://reviews.llvm.org/D111989
Raphael Isemann [Tue, 19 Oct 2021 09:51:10 +0000 (11:51 +0200)]
[lldb] Allow dumping the state of all scratch TypeSystems
This adds the `target dump typesystem'`command which dumps the TypeSystem of the
target itself (aka the 'scratch TypeSystem'). This is similar to `target modules
dump ast` which dumps the AST of lldb::Modules associated with a selected
target.
Unlike `target modules dump ast`, the new command is not a subcommand of `target
modules dump` as it's not touching the modules of a target at all. Also unlike
`target modules dump ast` I tried to keep the implementation language-neutral,
so this patch moves our Clang `Dump` to the `TypeSystem` interface so it will
also dump the state of any future/downstream scratch TypeSystems (e.g., Swift).
That's also why the command just refers to a 'typesystem' instead of an 'ast'
(which is only how Clang is necessarily modelling the internal TypeSystem
state).
The main motivation for this patch is that I need to write some tests that check
for duplicates in the ScratchTypeSystemClang of a target. There is currently no
way to check for this at the moment (beside measuring memory consumption of
course). It's probably also useful for debugging LLDB itself.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D111936
Lasse Folger [Tue, 19 Oct 2021 10:03:19 +0000 (12:03 +0200)]
[lldb] change name demangling to be consistent between windows and linx
When printing names in lldb on windows these names contain the full type information while on linux only the name is contained.
This change introduces a flag in the Microsoft demangler to control if the type information should be included.
With the flag enabled demangled name contains only the qualified name, e.g:
without flag -> with flag
int (*array2d)[10] -> array2d
int (*abc::array2d)[10] -> abc::array2d
const int *x -> x
For globals there is a second inconsistency which is not yet addressed by this change. On linux globals (in global namespace) are prefixed with :: while on windows they are not.
Reviewed By: teemperor, rnk
Differential Revision: https://reviews.llvm.org/D111715
Raphael Isemann [Tue, 19 Oct 2021 09:34:08 +0000 (11:34 +0200)]
[lldb] Filter duplicates in Target::GetScratchTypeSystems
`Target::GetScratchTypeSystems` returns the list of scratch TypeSystems. The
current implementation is iterating over all LanguageType values and retrieves
the respective TypeSystem for each LanguageType.
All C/C++/Obj-C LanguageTypes are however mapped to the same
ScratchTypeSystemClang instance, so the current implementation adds this single
TypeSystem instance several times to the list of TypeSystems (once for every
LanguageType that we support).
The only observable effect of this is that `SBTarget.FindTypes` for builtin
types currently queries the ScratchTypeSystemClang several times (and also adds
the same result several times).
Reviewed By: bulbazord, labath
Differential Revision: https://reviews.llvm.org/D111931
Vladislav Vinogradov [Mon, 11 Oct 2021 15:25:14 +0000 (18:25 +0300)]
[mlir][RFC] Refactor layout representation in MemRefType
The change is based on the proposal from the following discussion:
https://llvm.discourse.group/t/rfc-memreftype-affine-maps-list-vs-single-item/3968
* Introduce `MemRefLayoutAttr` interface to get `AffineMap` from an `Attribute`
(`AffineMapAttr` implements this interface).
* Store layout as a single generic `MemRefLayoutAttr`.
This change removes the affine map composition feature and related API.
Actually, while the `MemRefType` itself supported it, almost none of the upstream
can work with more than 1 affine map in `MemRefType`.
The introduced `MemRefLayoutAttr` allows to re-implement this feature
in a more stable way - via separate attribute class.
Also the interface allows to use different layout representations rather than affine maps.
For example, the described "stride + offset" form, which is currently supported in ASM parser only,
can now be expressed as separate attribute.
Reviewed By: ftynse, bondhugula
Differential Revision: https://reviews.llvm.org/D111553
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