Lang Hames [Sun, 31 Oct 2021 17:07:14 +0000 (10:07 -0700)]
[ORC][ORC-RT] Switch MachO EH/TLV registration from EPC-calls to alloc actions.
MachOPlatform used to make an EPC-call (registerObjectSections) to register the
eh-frame and thread-data sections for each linked object with the ORC runtime.
Now that JITLinkMemoryManager supports allocation actions we can use these
instead of an EPC call. This saves us one EPC-call per object linked, and
manages registration/deregistration in the executor, rather than the controller
process. In the future we may use this to allow JIT'd code in the executor to
outlive the controller object while still being able to be cleanly destroyed.
Since the code for allocation actions must be available when the actions are
run, and since the eh-frame registration code lives in the ORC runtime itself,
this change required that MachO eh-frame support be split out of
macho_platform.cpp and into its own macho_ehframe_registration.cpp file that has
no other dependencies. During bootstrap we start by forcing emission of
macho_ehframe_registration.cpp so that eh-frame registration is guaranteed to be
available for the rest of the bootstrap process. Then we load the rest of the
MachO-platform runtime support, erroring out if there is any attempt to use
TLVs. Once the bootstrap process is complete all subsequent code can use all
features.
Lang Hames [Sun, 31 Oct 2021 05:10:47 +0000 (22:10 -0700)]
[JITLink] Fix alloc action call signature in InProcessMemoryManager.
Alloc actions should return a CWrapperFunctionResult. JITLink does not have
access to this type yet, due to library layering issues, so add a cut-down
version with a fixme.
Craig Topper [Fri, 29 Oct 2021 16:52:36 +0000 (09:52 -0700)]
[RISCV] Expand scalable vector bswap. Fix crash for bitreverse.
Fix LegalizeVectorOps to not try shuffle or unrolling expansions for
scalable vectors.
Differential Revision: https://reviews.llvm.org/D112236
Kazu Hirata [Sun, 31 Oct 2021 14:57:36 +0000 (07:57 -0700)]
[CodeGen] Use make_early_inc_range (NFC)
Kazu Hirata [Sun, 31 Oct 2021 14:57:34 +0000 (07:57 -0700)]
[CodeGen, Target] Use MachineBasicBlock::terminators (NFC)
Kazu Hirata [Sun, 31 Oct 2021 14:57:32 +0000 (07:57 -0700)]
[Transforms] Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC)
Jake Egan [Sun, 31 Oct 2021 13:48:54 +0000 (09:48 -0400)]
[DWARF] Standardize checks and remove verbose where possible in DWARF tests
This patch removes the verbose option from tests that do not need it and simplifies the checks. For tests that do have the verbose option, the checks were standardized to be more readable and consistent.
Reviewed By: shchenz, dblaikie
Differential Revision: https://reviews.llvm.org/D112636
Jake Egan [Sun, 31 Oct 2021 13:32:56 +0000 (09:32 -0400)]
[AIX] Disable cfi-version test on AIX
`.debug_frame` is not emitted on AIX, so this patch disables the test.
Reviewed By: shchenz, jsji
Differential Revision: https://reviews.llvm.org/D112593
Alex Zinenko [Sun, 31 Oct 2021 08:37:20 +0000 (09:37 +0100)]
[mlir][python] allow for detaching operations from a block
Provide support for removing an operation from the block that contains it and
moving it back to detached state. This allows for the operation to be moved to
a different block, a common IR manipulation for, e.g., module merging.
Also fix a potential one-past-end iterator dereference in Operation::moveAfter
discovered in the process.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D112700
Matthias Springer [Sun, 31 Oct 2021 07:58:48 +0000 (16:58 +0900)]
[mlir][linalg][bufferize][NFC] Add bufferizesToAliasOnly
The list of operations that do neither read nor write, but create an alias when bufferizing inplace, is getting longer. This commit adds a helper function so that we do not have to spell out the entire list each time.
Differential Revision: https://reviews.llvm.org/D112515
Matthias Springer [Sun, 31 Oct 2021 07:52:27 +0000 (16:52 +0900)]
[mlir][linalg][bufferize] tensor::CastOp is an alias-only op
tensor::CastOp by itself does not bufferize to memory read/write.
Differential Revision: https://reviews.llvm.org/D112514
Fangrui Song [Sun, 31 Oct 2021 06:31:38 +0000 (23:31 -0700)]
[ELF] Make getImplicitAddend return 0 for R_ARM_V4BX. NFC
Will be useful if we move R_ARM_V4BX handling around.
Fangrui Song [Sun, 31 Oct 2021 04:58:43 +0000 (21:58 -0700)]
[ELF][Mips] Use R_DTPREL for R_MIPS_TLS_DTPREL*
Kazu Hirata [Sun, 31 Oct 2021 02:00:23 +0000 (19:00 -0700)]
[MachineCSE] Use make_early_inc_range (NFC)
Kazu Hirata [Sun, 31 Oct 2021 02:00:21 +0000 (19:00 -0700)]
[clang, llvm] Use Optional::getValueOr (NFC)
Kazu Hirata [Sun, 31 Oct 2021 02:00:19 +0000 (19:00 -0700)]
Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC)
Lang Hames [Sat, 30 Oct 2021 22:43:21 +0000 (15:43 -0700)]
[ORC] Move CWrapperFunctionResult out of the detail:: namespace.
This type has been moved up into the llvm::orc::shared namespace.
This type was originally put in the detail:: namespace on the assumption that
few (if any) LLVM source files would need to use it. In practice it has been
needed in many places, and will continue to be needed until/unless
OrcTargetProcess is fully merged into the ORC runtime.
Nico Weber [Sat, 30 Oct 2021 02:25:23 +0000 (22:25 -0400)]
[lld/mac] Fix mislink with ICF
When comparing relocations against two symbols, ICF's equalsConstant() did not
look at the value of the two symbols. With subsections_via_symbols, the value
is usually 0 but not always: In particular, it isn't 0 for constants in string
and literal sections. Since we ignored the value, comparing two constant string
symbols or two literal symbols always compared the 0th's element, so functions
in the same TU always compared as equal.
This can cause mislinks, and, with -dead_strip, crashes.
Fixes PR52349, see that bug for lots of details and examples of mislinks.
While here, make the existing assembly in icf-literals.s a bit more realistic
(use leaq instead of movq with strings, and use foo(%rip) instead of
foo@gotpcrel(%rip)). This has no interesting effect, it just maybe makes the
test look a bit less surprising.
Differential Revision: https://reviews.llvm.org/D112862
Danil Stefaniuc [Sat, 30 Oct 2021 21:48:26 +0000 (14:48 -0700)]
[formatters] Add a libstdcpp formatter for multiset and unify tests across stdlibs
This diff adds a data formatter for libstdcpp's multiset. Besides, it improves and unifies the tests for multiset for libcxx and libstdcpp for maintainability.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D112785
Frederic Cambus [Thu, 14 Oct 2021 12:36:12 +0000 (14:36 +0200)]
[clang][scan-build] Use uname -s to detect the operating system.
We only need the operating system name, not all information.
Differential Revision: https://reviews.llvm.org/D111797
Danil Stefaniuc [Sat, 30 Oct 2021 19:53:19 +0000 (12:53 -0700)]
[formatters] Add a libstdcpp formatter for multimap and unify modify tests across stdlibs
This diff adds a data formatter for libstdcpp's multimap. Besides, it improves and unifies the tests for multimap for libcxx and libstdcpp for maintainability.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D112752
Shilei Tian [Sat, 30 Oct 2021 18:43:59 +0000 (14:43 -0400)]
[OpenMP][DeviceRTL] Fixed an issue that causes hang in SU3
The synchronization at the end of parallel region cannot make sure all threads
exit the scope. As a result, the assertions right after it might be hit, and
further the `state::assumeInitialState(IsSPMD)` in `__kmpc_target_deinit` may
not hold as well. We either add a synchronization right after the parallel region,
or remove the assertions and assuptions. Here we choose the first one as those
assertions and assumptions can help optimizations.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D112861
Ludovic Jozeau [Sat, 30 Oct 2021 16:42:51 +0000 (17:42 +0100)]
[docs][clang-format] warn on \code block indentation error
There is an indentation issue in Format.h causing the html to not render correctly
It's a `\code` block in the documentation of SpacesInLineComment
- fix intentation of `SpacesInLineComment`
- warn on indentation error
- also warn on `\code` `\endcode` mismatch
- generate precise warnings
- fix some minor and style issues:
- avoid confusion with the built-in `type` function
- fix wrong print on `os.sys.stderr` (instead of `sys.stderr`)
- use `with as` pattern for files
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D112572
xndcn [Fri, 29 Oct 2021 14:45:18 +0000 (22:45 +0800)]
[mlir][spirv] Add conversions from arith.bitcast, std.br, std.cond_br to spirv.
Differential Revision: https://reviews.llvm.org/D112819
Erik Larsson [Sat, 30 Oct 2021 16:23:55 +0000 (17:23 +0100)]
[clang-format] Add --staged/--cached option to git-clang-format
When running git-clang-format in a pre-commit hook it's very useful to be able to tell git-clang-format to only look at the --staged/--cached files and not the working directory.
Note this patch is a rebase/fork from {D41147 } which is a fork of {D15465 }
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, lodato
Differential Revision: https://reviews.llvm.org/D90996
Co-authored-by: Mark Lodato <lodato@google.com>
Kazu Hirata [Sat, 30 Oct 2021 15:43:43 +0000 (08:43 -0700)]
[Hexagon] Remove chksetELFHeaderEFlags (NFC)
The function was introduced without any use on Nov 9, 2015 in commit
7cd0892729801c45b170918159bc249bd9ee2b6b.
Kazu Hirata [Sat, 30 Oct 2021 15:43:41 +0000 (08:43 -0700)]
[Hexagon] Remove ValidArch (NFC)
This function seems to be unused for at least one year.
Kazu Hirata [Sat, 30 Oct 2021 15:43:39 +0000 (08:43 -0700)]
[Hexagon] Remove unused struct InstTy (NFC)
Roman Lebedev [Sat, 30 Oct 2021 14:36:23 +0000 (17:36 +0300)]
[NFCI] Introduce `ICmpInst::compare()` and use it where appropriate
As noted in https://reviews.llvm.org/D90924#inline-1076197
apparently this is a pretty common pattern,
let's not repeat it yet again, but have it in a common place.
There may be some more places where it could be used,
but these are the most obvious ones.
David Green [Sat, 30 Oct 2021 13:27:38 +0000 (14:27 +0100)]
[ValueTracking] Teach computeConstantRange that the maximum value of a half is 65504
The maximal value of a half is 0x7bff, which is 65504 when converted to
an integer. This patch teaches that to computeConstantRange to compute a
constant range with the correct maximum value.
https://alive2.llvm.org/ce/z/BV_Spb
https://alive2.llvm.org/ce/z/Nwuqvb
The maximum value for a float converted in the same way is 3.4e38, which
requires 129bits of data. I have not added that here as integer types so
larger are rare, compared to integers types larger than 17 bits require
for half floats.
The MVE tests change because instsimplify happens to be run as a part of
the backend, where it doesn't tend to for other backends.
Differential Revision: https://reviews.llvm.org/D112694
Groverkss [Sat, 30 Oct 2021 12:09:03 +0000 (17:39 +0530)]
[MLIR] FlatAffineConstraints: Ensure dimensionalities match when calling mergeLocalIds
This patch reorders mergeLocalIds usage to merge locals only after number of
dimensions and symbols are same. This does not change any functionality
because it does not matter in what order identifiers are merged, since
the reason to do it is to ensure that two FACs are aligned.
The order ensured in this patch simplifies a subsequent patch to improve
mergeLocalIds which requires dimensions and symbols to be aligned.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D112841
Raphael Isemann [Sat, 30 Oct 2021 11:29:36 +0000 (13:29 +0200)]
[lldb][NFC] Modernize for-loops in ModuleList
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D112379
Raphael Isemann [Sat, 30 Oct 2021 11:22:48 +0000 (13:22 +0200)]
[lldb] Make SBType::IsTypeComplete more consistent by forcing the loading of definitions
Currently calling SBType::IsTypeComplete returns true for record types if and
only if the underlying record in our internal Clang AST has a definition.
The function however doesn't actually force the loading of any external
definition from debug info, so it currently can return false even if the type is
actually defined in a program's debug info but LLDB hasn't lazily created the
definition yet.
This patch changes the behaviour to always load the definition first so that
IsTypeComplete now consistently returns true if there is a definition in the
module/target.
The motivation for this patch is twofold:
* The API is now arguably more useful for the user which don't know or care
about the internal lazy loading mechanism of LLDB.
* With D101950 there is no longer a good way to ask a Decl for a definition
without automatically pulling in a definition from the ExternalASTSource. The
current behaviour doesn't seem useful enough to justify the necessary
workarounds to preserve it for a time after D101950.
Note that there was a test that used this API to test lazy loading of debug info
but that has been replaced with TestLazyLoading by now (which just dumps the
internal Clang AST state instead).
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D112615
Raphael Isemann [Sat, 30 Oct 2021 11:13:57 +0000 (13:13 +0200)]
[lldb] Update field offset/sizes when encountering artificial members such as vtable pointers
`DWARFASTParserClang::ParseSingleMember` turns DWARF DIEs that describe
struct/class members into their respective Clang representation (e.g.,
clang::FieldDecl). It also updates a record of where the last field
started/ended so that we can speculatively fill any holes between a field and a
bitfield with unnamed bitfield padding.
Right now we are completely ignoring 'artificial' members when parsing the DWARF
of a struct/class. The only artificial member that seems to be emitted in
practice for C/C++ seems to be the vtable pointer.
By completely skipping both the Clang AST node creation and the updating of the
last-field record, we essentially leave a hole in our layout with the size of
our artificial member. If the next member is a bitfield we then speculatively
fill the hole with an unnamed bitfield. During CodeGen Clang inserts an
artificial vtable pointer into the layout again which now occupies the same
offset as the unnamed bitfield. This later brings down Clang's
`CGRecordLowering::insertPadding` when it checks that none of the fields of the
generated record layout overlap.
Note that this is not a Clang bug. We explicitly set the offset of our fields in
LLDB and overwrite whatever Clang makes up.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D112697
Christudasan Devadasan [Fri, 22 Oct 2021 11:20:05 +0000 (07:20 -0400)]
GlobalISel/Utils: Use incoming regbank while constraining the superclasses
Register operands with superclasses can possibly have multiple regBanks
if they have different register types. The regBank ambiguity resolved
during regbankselect should be used to constrain the operand regclass
instead of obtaining one from the MCInstrDesc.
This is a prerequisite patch for D109300 that introduces allocatable AV_*
Superclasses for AMDGPU by combining both VGPRs and AGPRs and we want to
restrain the regclass to either A or V based on the incoming regbank.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D112323
Raphael Isemann [Sat, 30 Oct 2021 11:00:07 +0000 (13:00 +0200)]
[ASTImporter] Remove ASTNodeImporter::IsStructuralMatch overload for EnumConstantDecl
1. Moves the check to ASTStructuralEquivalence.cpp like all the other checks.
2. Adds the missing checks for identifier and init expression. Also add the
respective tests for that stuff.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D112804
David Green [Sat, 30 Oct 2021 11:08:17 +0000 (12:08 +0100)]
[ARM] Add some fp convert with saturate MVE tests. NFC
Nikolas Klauser [Sat, 30 Oct 2021 10:53:10 +0000 (12:53 +0200)]
[libc++] reformatted test_allocator.h
reformatted test_allocator.h by request of @ldionne for D110994
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112219
Mark de Wever [Sat, 23 Oct 2021 12:57:47 +0000 (14:57 +0200)]
[libc++][format] Mark LWG-issues as complete.
Most of the code has been implemented using the eel.is draft. It seems
some issues were inplemented but not marked as completed yet.
Note the wording of LWG-3372 has been implemented, but has been changed
in the current draft due to P2216, see D110494.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112363
Mark de Wever [Sat, 23 Oct 2021 12:29:10 +0000 (14:29 +0200)]
[libc++][format] Use preferred_name attribute.
This was suggested by @vitaut in D110494.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112362
Mark de Wever [Thu, 28 Oct 2021 15:48:27 +0000 (17:48 +0200)]
[libc++] Update clang-format to C++20.
We now use clang-format-13 which has the option SpacesInAngles. This
allows us to switch the default language version to C++20, which should
avoid breaking code when formatting due to the adding of whitespace.
For example `u8"foo"` no longer is formatted as `u8 "foo"`.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D112728
Mark de Wever [Thu, 28 Oct 2021 15:41:35 +0000 (17:41 +0200)]
[libc++] Remove Clang-11 support.
Since we no longer officially support Clang 11 remove the work-arounds
for this version.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D112727
David Green [Sat, 30 Oct 2021 08:06:21 +0000 (09:06 +0100)]
[InstCombine] Fix type of constant in canonicalizeClampLike
As a followup to D108049, one of the constants could now be generated
with an incorrect type, now that the input could be truncated.
Kazu Hirata [Sat, 30 Oct 2021 03:26:09 +0000 (20:26 -0700)]
Ensure newlines at the end of files (NFC)
Kazu Hirata [Sat, 30 Oct 2021 03:26:07 +0000 (20:26 -0700)]
Use {DenseSet,SmallPtrSet}::contains (NFC)
Lang Hames [Sat, 30 Oct 2021 03:06:03 +0000 (20:06 -0700)]
[ORC] Move all pass config into MachOPlatformPlugin::modifyPassConfig.
NFC, this just makes it easier to see and reason about pass ordering.
Vladimir Vereschaka [Sat, 30 Oct 2021 01:26:10 +0000 (18:26 -0700)]
[CMake] Update Cmake cache file for Win to ARM Linux cross builds. NFC
Workaround to fix broken remote execution for the libunwind tests.
https://reviews.llvm.org/D112082
wren romano [Fri, 29 Oct 2021 23:03:59 +0000 (16:03 -0700)]
[mlir][sparse] Improve handling of dynamic-sizes for sparse=>dense conversion
Allows the result to be more dynamically-sized than the source.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D112854
Phoebe Wang [Fri, 29 Oct 2021 23:59:19 +0000 (07:59 +0800)]
[X86][NFC] Pre-commit test to show prolog insert problem
Duncan P. N. Exon Smith [Fri, 29 Oct 2021 23:50:10 +0000 (16:50 -0700)]
Support: Remove sys::path::is_style_native()
Remove sys::path::is_style_native(), which was added alongside
is_style_windows() and is_style_posix().
Thinking a bit about the windows forward-slash style variant in
https://reviews.llvm.org/D111879, it's not clear to me how the new
sys::path::is_style_native() should behave for them.
- Should it return true for both `windows_slash` and
`windows_backslash`?
- Should it return true for only one of them?
I can think of hypothetical uses and justifications for either one, and
I could also imagine clients guessing either behaviour when just looking
at the function name in code.
Call sites will probably be more clear if they don't use this function,
and instead write out the code:
```
// Is "S" the coarse-grained native style?
if (is_style_windows(S) == is_style_windows(Style::native))
// Is "S" the fine-grained native style?
if (is_style_windows(S) == is_style_windows(Style::native) &&
preferred_separator(S) == preferred_separator(Style::native))
```
Can always add this again if someone needs it and can justify one
behaviour over the other, but for now might as well avoid growing users.
Duncan P. N. Exon Smith [Thu, 21 Oct 2021 18:01:41 +0000 (11:01 -0700)]
Support: Reduce stats in fs::copy_file on Darwin
fs::copy_file() on Darwin has a nice optimization to clone the file when
possible. Change the implementation to use clonefile() directly, instead
of the higher-level copyfile(). The latter does the wrong thing for
symlinks, which requires calling `stat` first...
With that out of the way, optimistically call clonefile() all the time,
and then for any error that's recoverable try again with copyfile()
(without the COPYFILE_CLONE flag, as before).
Differential Revision: https://reviews.llvm.org/D112250
Jonas Devlieghere [Fri, 29 Oct 2021 23:29:06 +0000 (16:29 -0700)]
[llvm] Include LLVM_ENABLE_RUNTIMES in the cross compilation invocation
Forward the LLVM_ENABLE_RUNTIMES cmake variable in the cross compilation
invocation.
Now that passing libcxx must be specified in LLVM_ENABLE_RUNTIMES
instead of LLVM_ENABLE_PROJECTS, the LLDB's sanity check for libcxx
trips up (in the cross compilation case) because the runtimes are not
forwarded. This patch fixes that.
Differential revision: https://reviews.llvm.org/D112855
Duncan P. N. Exon Smith [Fri, 29 Oct 2021 23:24:11 +0000 (16:24 -0700)]
Joe Loser [Fri, 29 Oct 2021 23:04:32 +0000 (19:04 -0400)]
[libc++] Ensure valid view for view_interface template parameter
Some types that inherit from `view_interface` do not meet the
preconditions. This came up during discussion
in https://reviews.llvm.org/D112631. Currently, the behavior is IFNDR,
but the preconditions can be easily checked, so let's do so.
In particular, we know each public member function calls the
`__derived()` private function, so we can do the check there. We
intentionally do it as a `static_assert` instead of a `requires` clause
to avoid hard erroring in some cases, such as with incomplete types. An
example hard error is:
```
llvm-project/build/include/c++/v1/__ranges/view_interface.h:48:14: note: because 'sizeof(_Tp)' would be invalid: invalid application of 'sizeof' to an incomplete type 'MoveOnlyForwardRange'
requires { sizeof(_Tp); } &&
^
llvm-project/build/include/c++/v1/__ranges/view_interface.h:73:26: error: no matching member function for call to '__derived'
return ranges::begin(__derived()) == ranges::end(__derived());
^~~~~~~~~
llvm-project/libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp:187:31: note: in instantiation of function template specialization 'std::ranges::view_interface<MoveOnlyForwardRange>::empty<Mov
eOnlyForwardRange>' requested here
assert(!std::move(moveOnly).empty());
```
Reviewed By: Quuxplusone, Mordante, #libc
Differential Revision: https://reviews.llvm.org/D112665
Jonas Devlieghere [Fri, 29 Oct 2021 22:30:38 +0000 (15:30 -0700)]
[llvm] Disable xar on macOS 12.0 and later
The xar file format has been deprecated since macOS 12.0, causing a
warning to be printed:
warning: 'xar_open' is deprecated: first deprecated in macOS 12.0 -
xar is a deprecated file format and should not be used.
Disable xar support when the macosx deployment target is greater or
equal to 12.0.
Differential revision: https://reviews.llvm.org/D112849
Alexander Batashev [Fri, 29 Oct 2021 21:35:15 +0000 (14:35 -0700)]
Disable lockdown for external forks by default
GitHub Actions can be used in external forks, and this
workflow breaks all pull-requests for those who use both
GitHub Pull Requests and GitHub Actions.
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D112801
Joseph Huber [Fri, 29 Oct 2021 21:43:28 +0000 (17:43 -0400)]
[OpenMP] Fix assert macro expr
Summary:
A previous patch changed the check and mistakenly only did `!expr` when
this is a macro expansion and could only apply to the left side of an
expression.
Stanislav Mekhanoshin [Wed, 27 Oct 2021 18:40:33 +0000 (11:40 -0700)]
[AMDGPU] Fix global isel for kernels using agprs on gfx90a
With Global ISel getReservedRegs() is called before function is
regbank selected for the first time. Defer caching of usesAGPRs()
in this case.
Differential Revision: https://reviews.llvm.org/D112644
Valentin Clement [Fri, 29 Oct 2021 21:20:50 +0000 (23:20 +0200)]
[fir] Add base of the FIR to LLVM IR pass
This patch adds the base of the FIR to LLVM IR Dialect conversion pass.
It currently can convert the following operations:
- fir.global
- fir.has_value
- fir.address_of
- fir.undefined
This patch is part of the upstreaming effort from fir-dev branch. It does not
cover all FIR operations in order to have small patches. Several patches will
follow to convert other operations.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D112845
Florian Hahn [Fri, 29 Oct 2021 20:58:42 +0000 (21:58 +0100)]
[DSE] Support redundant stores eliminated by memset.
This patch adds support to remove stores that write the same value
as earlier memesets.
It uses isOverwrite to check that a memset completely overwrites a later
store. The candidate store must store the same bytewise value as the
byte stored by the memset.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D112321
David Blaikie [Wed, 20 Oct 2021 18:14:01 +0000 (11:14 -0700)]
Cleanup a few more PR36048 skips
Hopefully these were also fixed bi r343545 /
7fd4513920d2fed533ad420976529ef43eb42a35
Differential Revision: https://reviews.llvm.org/D112165
Jacques Pienaar [Fri, 29 Oct 2021 21:06:33 +0000 (14:06 -0700)]
[mlir][ods] Fix incorrectly generated attribute name.
In prefixed accessor on OpAdaptor.
Zarko Todorovski [Fri, 29 Oct 2021 18:32:03 +0000 (14:32 -0400)]
[clang][NFC] Inclusive terms: Replace uses of whitelist in clang/lib/StaticAnalyzer
Replace variable and functions names, as well as comments that contain whitelist with
more inclusive terms.
Reviewed By: aaron.ballman, martong
Differential Revision: https://reviews.llvm.org/D112642
Joseph Huber [Fri, 29 Oct 2021 19:49:56 +0000 (15:49 -0400)]
[OpenMP] Use the assertion formatting from assert.h
This patch changes the `assert_assume` function used for internal
assumptions in the device runtime to use a more standard formatting for
the assumption message.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D112842
Nikita Popov [Fri, 29 Oct 2021 20:40:16 +0000 (22:40 +0200)]
[BasicAA] Extract linear expression multiplication (NFC)
Extract a common method for multiplying a linear expression by a
factor.
Alex Lorenz [Fri, 29 Oct 2021 19:59:01 +0000 (12:59 -0700)]
[clang] Make 'align-mismatch' warning work without an associated function declaration
This change fixes a crash where a NULL fd was used to emit a diagnostic.
Instead of crashing, just avoid printing the declaration name when there's no
associated function declaration.
Differential Revision: https://reviews.llvm.org/D109402
Sam Clegg [Fri, 29 Oct 2021 20:30:41 +0000 (13:30 -0700)]
Revert "[WebAssembly] Fix debug locations for ExplicitLocals pass"
This reverts commit
a66451ebbe450a5e9dc6baf0c4e9f5738df589a2.
This caused a failure when integrated with emscripten:
https://ci.chromium.org/ui/p/emscripten-releases/builders/try/linux/
b8832019855439718609/overview
Aart Bik [Fri, 29 Oct 2021 03:56:45 +0000 (20:56 -0700)]
[mlir][sparse] refine the mixed width sparse conversion test
Added a type with different pointer/index bit width. Also
added some sanity CHECKs on the stored indices.
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D112778
Nikita Popov [Fri, 29 Oct 2021 20:22:12 +0000 (22:22 +0200)]
[BasicAA] Don't treat non-inbounds GEP as nsw
The scale multiplication is only guaranteed to be nsw if the GEP
is inbounds (or the multiplication is trivial). Previously we were
only considering explicit muls in GEP indices.
Jacques Pienaar [Fri, 29 Oct 2021 20:29:48 +0000 (13:29 -0700)]
[mlir] Flip accessors to prefixed form (NFC)
Change these missed during/added after the last update.
Sam Clegg [Fri, 29 Oct 2021 16:58:56 +0000 (09:58 -0700)]
[lld][WebAssembly] Generate TLS relocation code also when linking statically
Previously relocations were only generated for PIC output, but
relocations for TLS GOT entries are always needed when shared
memory is enabled, not just in PIC mode.
This means that the `__wasm_apply_global_tls_relocs` is now
generated even for statically linked (non-PIC) output. Without
this the globals that hold the addresses of TLS symbols are
not set correctly.
Differential Revision: https://reviews.llvm.org/D112833
Guillaume Chatelet [Fri, 29 Oct 2021 20:25:55 +0000 (20:25 +0000)]
Revert "[libc] Add more robust compile time architecture detection"
This reverts commit
a72e2499865b55cb007b63673100c06cc85faf97.
Richard Smith [Fri, 29 Oct 2021 20:12:51 +0000 (13:12 -0700)]
Properly determine the end location of an ObjCObjectPointerType.
After rGa9db0a804a53, we correctly determined the end for pointer types
like `id` that are spelled without a `*`, but incorrectly determined the
end for pointer types spelled with a `*`.
Arthur O'Dwyer [Thu, 14 Oct 2021 21:02:43 +0000 (17:02 -0400)]
[libc++] Implement LWG3369, tweak CTAD for std::span.
The original bug doesn't reproduce on Clang, allegedly because of
https://bugs.llvm.org/show_bug.cgi?id=44484
We already test STL's exact test case, in "span.cons/deduct.pass.cpp",
which I'm touching just for the heck of it.
Differential Revision: https://reviews.llvm.org/D111838
Arthur O'Dwyer [Fri, 29 Oct 2021 20:12:59 +0000 (14:12 -0600)]
[libc++] [doc] Mark LWG3398 as complete.
This was done in D108054.
Guillaume Chatelet [Fri, 29 Oct 2021 20:13:57 +0000 (20:13 +0000)]
[libc] Add more robust compile time architecture detection
We may want to restrict the detected platforms to only `x86_64` and `aarch64`.
There are still custom detection in api.td but I don't think we can handle these:
- config/linux/api.td:205
- config/linux/api.td:199
Differential Revision: https://reviews.llvm.org/D112818
Nick Desaulniers [Fri, 29 Oct 2021 20:14:02 +0000 (13:14 -0700)]
[SparcISelLowering] avoid emitting libcalls to __muloti4 and __mulodi4
These compiler-rt-only symbols aren't available in libgcc. Similar to
D108842, D108844, and D108926.
Fixes: pr/52043
Reviewed By: craig.topper, rengolin
Differential Revision: https://reviews.llvm.org/D112750
Miguel Raz Guzmán Macedo [Fri, 29 Oct 2021 20:10:43 +0000 (13:10 -0700)]
[doc] Typo fix in NewPassManager.rst
Simple typo fix.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D112780
wren romano [Fri, 29 Oct 2021 20:00:12 +0000 (13:00 -0700)]
[mlir][sparse] Renaming CPP macros for clarity
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D112771
Sanjay Patel [Fri, 29 Oct 2021 19:47:14 +0000 (15:47 -0400)]
[x86] limit vector increment fold to allow load folding
The tests are based on the example from:
https://llvm.org/PR52032
I suspect that it looks worse than it actually is. :)
That is, llvm-mca says there's no uop/timing difference with the
load folding and pcmpeq vs. broadcast on Haswell (and probably
other targets).
The load-folding definitely makes the code smaller, so it's good
for that at least. So this requires carving a narrow hole in the
transform to get just this case without changing others that look
good as-is (in other words, the transform still seems good for
most examples).
Differential Revision: https://reviews.llvm.org/D112464
Sanjay Patel [Fri, 29 Oct 2021 19:32:18 +0000 (15:32 -0400)]
[x86] make mayFold* helpers visible to more files; NFC
The first function is needed for D112464, but we might
as well keep these together in case the others can be
used someday.
Sanjay Patel [Fri, 29 Oct 2021 18:47:36 +0000 (14:47 -0400)]
[InstCombine] fix comments to match code; NFC
Guillaume Chatelet [Fri, 29 Oct 2021 19:42:51 +0000 (19:42 +0000)]
[libc][NFC] Fix typo and unused variable
Differential Revision: https://reviews.llvm.org/D112823
Michał Górny [Fri, 29 Oct 2021 18:46:32 +0000 (20:46 +0200)]
[lldb] [gdb-remote] Fix processing generic regnums
Fix regression in processing generic regnums that was introduced
in
fa456505b80b0cf83647a1b26713e4d3b38eccc2 ("[lldb] [gdb-remote]
Refactor getting remote regs to use local vector"). Since then,
the "generic" field was wrongly interpreted as integer rather than
string constant.
Thanks to Ted Woodward for noticing and providing the correct code.
modimo [Fri, 29 Oct 2021 19:09:28 +0000 (12:09 -0700)]
[InlineAdvisor] Add fallback/format switches and negative remark processing to Replay Inliner
Adds the following switches:
1. --sample-profile-inline-replay-fallback/--cgscc-inline-replay-fallback: controls what the replay advisor does for inline sites that are not present in the replay. Options are:
1. Original: defers to original advisor
2. AlwaysInline: inline all sites not in replay
3. NeverInline: inline no sites not in replay
2. --sample-profile-inline-replay-format/--cgscc-inline-replay-format: controls what format should be generated to match against the replay remarks. Options are:
1. Line
2. LineColumn
3. LineDiscriminator
4. LineColumnDiscriminator
Adds support for negative inlining decisions. These are denoted by "will not be inlined into" as compared to the positive "inlined into" in the remarks.
All of these together with the previous `--sample-profile-inline-replay-scope/--cgscc-inline-replay-scope` allow tweaking in how to apply replay. In my testing, I'm using:
1. --sample-profile-inline-replay-scope/--cgscc-inline-replay-scope = Function to only replay on a function
2. --sample-profile-inline-replay-fallback/--cgscc-inline-replay-fallback = NeverInline since I'm feeding in only positive remarks to the replay system
3. --sample-profile-inline-replay-format/--cgscc-inline-replay-format = Line since I'm generating the remarks from DWARF information from GCC which can conflict quite heavily in column number compared to Clang
An alternative configuration could be to do Function, AlwaysInline, Line fallback with negative remarks which closer matches the final call-sites. Note that this can lead to unbounded inlining if a negative remark doesn't match/exist for one reason or another.
Updated various tests to cover the new switches and negative remarks
Testing:
ninja check-all
Reviewed By: wenlei, mtrofin
Differential Revision: https://reviews.llvm.org/D112040
Duncan P. N. Exon Smith [Fri, 22 Oct 2021 01:33:24 +0000 (18:33 -0700)]
Support: Use sys::path::is_style_{posix,windows}() in a few places
Use the new sys::path::is_style_posix() and is_style_windows() in a few
places that need to detect the system's native path style.
In llvm/lib/Support/Path.cpp, this patch removes most uses of the
private `real_style()`, where is_style_posix() and is_style_windows()
are just a little tidier.
Elsewhere, this removes `_WIN32` macro checks. Added a FIXME to a
FileManagerTest that seemed fishy, but maintained the existing
behaviour.
Differential Revision: https://reviews.llvm.org/D112289
modimo [Wed, 27 Oct 2021 22:59:35 +0000 (15:59 -0700)]
[SampleProfile] Add all callsites to AllCandidates if InlineReplay is in effect
Replay in sample profiling needs to be asked on candidates that may not have counts or below the threshold. If replay is in effect for a function make sure these are captured and also imported during thinLTO.
Testing:
ninja check-all
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D112033
Roman Lebedev [Fri, 29 Oct 2021 18:58:02 +0000 (21:58 +0300)]
[NFC][LoopDeletion] Count the number of broken backedges
Those don't contribute to the number of deleted loops.
Joseph Huber [Mon, 18 Oct 2021 16:02:59 +0000 (12:02 -0400)]
[OpenMP][Docs] Add documentation for device RTL debugging
Add documentation for the debugging features in the OpenMP device
runtime library.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D112010
Joseph Huber [Mon, 18 Oct 2021 15:41:43 +0000 (11:41 -0400)]
[OpenMP] Check output of malloc in the device for debug
A common problem is the device running out of global heap memory and
crashing due to a nullptr dereference when using the data sharing stack.
This explicitly checks that a nullptr was not returned by malloc when
debugging field 1 is enabled.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D112005
Joseph Huber [Mon, 18 Oct 2021 15:14:07 +0000 (11:14 -0400)]
[OpenMP] Use function tracing RAII for runtime functions.
This patch adds support for using function tracing features to track the
executino of runtime functions in the device runtime library. This is
enabled by first compiling the new runtime with
`-fopenmp-target-debug=3` and running with
`LIBOMPTARGET_DEVICE_RTL_DEBUG=3`. The output only tracks team 0 and
thread 0 so there isn't much output when using a generic region.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D112002
Amara Emerson [Fri, 29 Oct 2021 18:34:53 +0000 (11:34 -0700)]
[AArch64][GlobalISel] Fix an crash in RBS due to a new regclass being added.
rdar://
84674985
Duncan P. N. Exon Smith [Thu, 16 Sep 2021 00:48:57 +0000 (20:48 -0400)]
Support: Expose sys::path::is_style_{posix,windows,native}()
Expose three helpers in namespace llvm::sys::path to detect the
path rules followed by sys::path::Style.
- is_style_posix()
- is_style_windows()
- is_style_native()
This are constexpr functions that that will allow a bunch of
path-related code to stop checking `_WIN32`.
Originally I looked at adding system_style(), analogous to
sys::endian::system_endianness(), but future patches (from others) will
add more Windows style variants for slash preferences. These helpers
should be resilient to that change, allowing callers to detect basic
path rules.
Differential Revision: https://reviews.llvm.org/D112288
Sanjay Patel [Fri, 29 Oct 2021 18:21:36 +0000 (14:21 -0400)]
[InstCombine] allow vector splat matching for bitwise logic folds
These transforms are also likely missing a one-use check,
but that's another patch.
Sanjay Patel [Fri, 29 Oct 2021 17:12:38 +0000 (13:12 -0400)]
[InstCombine] add tests for bitwise logic folds; NFC
Roman Lebedev [Fri, 29 Oct 2021 18:09:22 +0000 (21:09 +0300)]
[NFC][PhaseOrdering] Add additional loop deletion tests
Test thanks to Michael Kuklinski from #llvm,
originally inspired by Daniel Lemire's https://lemire.me/blog/2021/10/26/in-c-is-empty-faster-than-comparing-the-size-with-zero/
peter klausler [Wed, 27 Oct 2021 18:45:11 +0000 (11:45 -0700)]
[flang] Fix combined folding of FINDLOC/MAXLOC/MINLOC
The tests for folding these intrinsics neglected to name the
logical scalars with a leading "test_", so test failures caused
by recent work to implement a combined constant folding facility
for these intrinsics wasn't catching some bugs. This patch fixes
the tests and the bugs.
Differential Revision: https://reviews.llvm.org/D112741
Stanislav Mekhanoshin [Fri, 22 Oct 2021 19:07:42 +0000 (12:07 -0700)]
[InstCombine] Fold `(~(a | b) & c) | ~(a | c)` into `~((b & c) | a)`
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%or1 = or i4 %b, %a
%not1 = xor i4 %or1, -1
%or2 = or i4 %a, %c
%not2 = xor i4 %or2, -1
%and = and i4 %not2, %b
%or3 = or i4 %and, %not1
ret i4 %or3
}
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%and = and i4 %c, %b
%or = or i4 %and, %a
%or3 = xor i4 %or, -1
ret i4 %or3
}
Transformation seems to be correct!
```
Differential Revision: https://reviews.llvm.org/D112338
peter klausler [Mon, 25 Oct 2021 22:05:39 +0000 (15:05 -0700)]
[flang] Fix crash on "call system_clock(count_max=j)"
An erroneous entry in the intrinsics table causes semantics to
crash on a call to system_clock if the optional "count_max="
argument appears and "count=" does not.
Differential Revision: https://reviews.llvm.org/D112738
Michael Jones [Tue, 26 Oct 2021 23:39:23 +0000 (16:39 -0700)]
[libc] add fast path to string to float conversion
Add the fast path first described by Clinger [1] with additions by Gay [2].
This speeds up conversion by about 10% by handling numbers with fewer digits
more efficiently.
[1] Clinger WD. How to Read Floating Point Numbers Accurately.
SIGPLAN Not 1990 Jun;25(6):92–101. https://doi.org/10.1145/93548.93557.
[2] Gay DM, Correctly rounded binary-decimal and decimal-binary conversions;
1990. AT&T Bell Laboratories Numerical Analysis Manuscript 90-10.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D112580