Kirill Stoimenov [Wed, 1 Feb 2023 22:00:13 +0000 (22:00 +0000)]
[LSAN] Add GetUserAddr function which returns the user visible address of an internal pointer
For HWASAN this would be the tagged address. It is the same pointer when pointer tagging is not used. Coincidently this also fixes some test which rely on comparing pointers.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D143121
Shivam Gupta [Thu, 2 Feb 2023 00:28:04 +0000 (05:58 +0530)]
Revert "[Clang] Add -Wtype-limits to -Wextra for GCC compatibility"
This reverts commit
95668c0d97e6184729f3a3e9621a58d9edffb6b0.
This discovers a warning in
https://reviews.llvm.org/rGa68d4b11465f5b3326be1dd820f59fac275b7581.
and broke the x86_64-linux sanitizer
buildbot: https://lab.llvm.org/buildbot/#/builders/37/builds/19910.
Petr Hosek [Wed, 1 Feb 2023 08:11:22 +0000 (08:11 +0000)]
[Driver][Fuchsia] Remove relative vtable multilib
We have made relative vtable the default for Fuchsia C++ ABI so this
is no longer needed.
Differential Revision: https://reviews.llvm.org/D143050
Mircea Trofin [Thu, 2 Feb 2023 00:27:44 +0000 (16:27 -0800)]
Fix windows bot breakages due to D143110
Craig Topper [Wed, 1 Feb 2023 23:29:06 +0000 (15:29 -0800)]
[RISCV] Slightly simplify how the X*_PD registers for Zdinx are declared. NFC
Instead of manually listing 16 different even numbers, use a range
and then multiply.
Mircea Trofin [Wed, 1 Feb 2023 22:01:55 +0000 (14:01 -0800)]
[mlgo] Make InteractiveModelRunner actually work with named pipes
Turns out raw_fd_stream doesn't work with named pipes, so we just need
to lower the abstraction. Updated the unittest accordingly. Because
mkfifo's path argument requires a certain naming pattern on Windows
(IIUC), restricted the test to Linux only.
Differential Revision: https://reviews.llvm.org/D143110
Kirill Stoimenov [Wed, 1 Feb 2023 22:01:32 +0000 (22:01 +0000)]
[LSAN] Enable some tests which are passing as is in HWASAN.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D143114
Michael Spencer [Wed, 1 Feb 2023 01:52:51 +0000 (17:52 -0800)]
[Clang][DependencyScanner] Remove secondary actions from -cc1
The -arcmt-action= and -objcmt-migrate* actions were being passed to
module builds. This caused these builds to fail, as they are secondary
actions that suppress emitting modules.
Differential Revision: https://reviews.llvm.org/D143040
Mitch Phillips [Wed, 1 Feb 2023 23:08:06 +0000 (15:08 -0800)]
Remove another unnecessary integer-check.
Same as
b3b940d1501e39563ac549c3a5a89b25ae8ab7b8
Mitch Phillips [Wed, 1 Feb 2023 23:04:06 +0000 (15:04 -0800)]
Remove unnecessary comparison.
Popped up after https://reviews.llvm.org/D142826 added extra flags to
-Wextra, which is used by our sanitizer buildbots
(https://lab.llvm.org/buildbot/#/builders/37/builds/19910).
This check seems unnecessary, it's a bad cargo-cult after the buffer
size was expanded to allow >= 4GiB after
https://reviews.llvm.org/rGd6c15b661ab0aabb00f1219ce4af7136938e67e2.
V Donaldson [Wed, 1 Feb 2023 20:52:42 +0000 (12:52 -0800)]
[flang] Allow compiler directives in the specification part of a module
Lowering code currently allows for directives inside a program or
subprogram, or outside any program unit. Directives may also appear
in the specification part of a module, as in:
module mm
interface
subroutine ss(aa)
!dir$ ignore_tkr(tkr) aa
integer :: aa(*)
end subroutine ss
end interface
end module
With some exceptions such as OpenMP directives, most directives are
currently ignored, so this code should generate an "ignoring all compiler
directives" message.
Guozhi Wei [Wed, 1 Feb 2023 22:48:31 +0000 (22:48 +0000)]
Revert "[GVN] Improve PRE on load instructions"
This reverts commit
5f1448fe1585b5677d5f0064e4eeac3b493d8a18.
Guozhi Wei [Wed, 1 Feb 2023 22:48:06 +0000 (22:48 +0000)]
Revert "[GVN] Don't count debug instructions when limit the number of checked instructions"
This reverts commit
f494b366ff8a076a72a8e1b7a6f401686d6eb0e6.
Peter Klausler [Thu, 19 Jan 2023 22:32:09 +0000 (14:32 -0800)]
[flang] Avoid crashing from recursion on very tall expression parse trees
In the parse tree visitation framework (Parser/parse-tree-visitor.h)
and in the semantic analyzer for expressions (Semantics/expression.cpp)
avoid crashing due to stack size limitations by using an iterative
traversal algorithm rather than straightforward recursive tree walking.
The iterative approach is the obvious one of building a work queue and
using it to (in the case of the parse tree visitor) call the visitor
object's Pre() and Post() routines on subexpressions in the same order
as they would have been called during a recursive traversal.
This change helps the compiler survive some artificial stress tests
and perhaps with future exposure to machine-generated source code.
Differential Revision: https://reviews.llvm.org/D142771
Peter Klausler [Wed, 1 Feb 2023 22:05:57 +0000 (14:05 -0800)]
[flang] Fix build warning
It's basically impossible to write a switch statement with a case
for every enumerator in an enum class if the cases each have a
return statement and get it to compile without warnings for all
of our build compilers & versions. Rewrite as a sequence of
if statements.
Nikolas Klauser [Tue, 31 Jan 2023 12:03:57 +0000 (13:03 +0100)]
[libc++] Look for Clang 17 when compiling clang-tidy checks
This allows compiling the clang-tidy checks when you only have ToT clang
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D142973
Kazu Hirata [Wed, 1 Feb 2023 21:54:51 +0000 (13:54 -0800)]
[flang] Fix a warning
This patch fixes:
flang/lib/Evaluate/check-expression.cpp:509:3: error: default label
in switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
Erik Desjardins [Wed, 1 Feb 2023 21:46:59 +0000 (13:46 -0800)]
[Clang] avoid relying on StringMap iteration order when roundtripping -analyzer-config
I am working on another patch that changes StringMap's hash function,
which changes the iteration order here, and breaks some tests,
specifically:
clang/test/Analysis/NSString.m
clang/test/Analysis/shallow-mode.m
with errors like:
generated arguments do not match in round-trip
generated arguments #1 in round-trip: <...> "-analyzer-config" "ipa=inlining" "-analyzer-config" "max-nodes=75000" <...>
generated arguments #2 in round-trip: <...> "-analyzer-config" "max-nodes=75000" "-analyzer-config" "ipa=inlining" <...>
To avoid this, sort the options by key, instead of using the default map
iteration order.
Reviewed By: jansvoboda11, MaskRay
Differential Revision: https://reviews.llvm.org/D142861
Craig Topper [Wed, 1 Feb 2023 21:38:03 +0000 (13:38 -0800)]
[RISCV] Reuse RISCVRegWithSubRegs class to shorten some code in RISCVRegisterInfo.td. NFC
Jan Svoboda [Wed, 1 Feb 2023 21:42:19 +0000 (13:42 -0800)]
[clang][deps] Give the fake file a unique name in by-module-name scans
When scanning dependencies of a module, the command line we're given doesn't have an input file, which the driver needs to be happy. We've been creating a fake in-memory input file named after the module. However, this can hide files/directories on the actual filesystem, leading to errors.
This patch works around that issue by generating a unique file name, which won't collide with the actual file system.
We could also change the driver APIs so that we're able to specify an "assumed" input file. This would be more work, though, since the driver assumes the input name comes from the actual command-line.
Depends on D140176.
Reviewed By: artemcm
Differential Revision: https://reviews.llvm.org/D140177
Jan Svoboda [Wed, 1 Feb 2023 21:35:11 +0000 (13:35 -0800)]
[clang][deps] NFC: Split out the module-based API from the TU-based API
For users of the C++ API, the return type of `getFullDependencies` doesn't make sense when asking for dependencies of a module. In the returned `FullDependenciesResult` instance, only `DiscoveredModules` is useful (the graph of modular dependecies). The `FullDeps` member is trying to describe a translation unit it was never given. Its command line also refers to a file in the in-memory VFS we create in the scanner, leaking the implementation detail.
This patch splits the API and improves layering and naming of the return types.
Depends on D140175.
Reviewed By: artemcm
Differential Revision: https://reviews.llvm.org/D140176
Jan Svoboda [Wed, 1 Feb 2023 21:03:11 +0000 (13:03 -0800)]
[clang][deps] Remove support for the deprecated driver API
This API is no longer necessary, so let's remove it to simplify the internal APIs.
Reviewed By: benlangmuir, artemcm
Differential Revision: https://reviews.llvm.org/D140175
Peter Klausler [Sat, 7 Jan 2023 01:49:15 +0000 (17:49 -0800)]
[flang] Check for global name conflicts (19.2)
Global names should be checked for conflicts even when not BIND(C).
Differential Revision: https://reviews.llvm.org/D142761
Owen Pan [Sat, 28 Jan 2023 10:51:36 +0000 (02:51 -0800)]
[clang-format] Support clang-format on/off line comments as prefix
Closes #60264.
Differential Revision: https://reviews.llvm.org/D142804
Amir Ayupov [Wed, 1 Feb 2023 20:35:46 +0000 (12:35 -0800)]
[BOLT][CMake] Add dependency on llvm_vcsrevision_h
The dependence is needed since Utils includes VCSRevision.h, and other
LLVM components that include this header also have the llvm_vcsrevision_h
dependency.
Fixes #60460.
Reviewed By: #bolt, ayermolo
Differential Revision: https://reviews.llvm.org/D143101
Tue Ly [Wed, 1 Feb 2023 19:25:25 +0000 (14:25 -0500)]
[libc][math] Fix setting exceptional value for tanf to work with gcc.
See https://github.com/llvm/llvm-project/issues/59866
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D143098
Peter Klausler [Thu, 5 Jan 2023 22:11:54 +0000 (14:11 -0800)]
[flang] Catch bad inquiries in specification expressions
When a descriptor inquiry or inquiry function's result is
not constant and is known to be impossible to correctly determine
at runtime, raise an error. For example, LEN(X) when X is
a local allocatable variable with deferred length.
Differential Revision: https://reviews.llvm.org/D142759
Lei Zhang [Wed, 1 Feb 2023 19:35:25 +0000 (19:35 +0000)]
[mlir][spirv] Fix vector type mismatch in UnifyAliasedResourcePass
For the cases where we have aliases of `vector<4xf16>` and
`vector<4xf32>`, we need to do casting before composite
construction.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D143042
Aditya Kumar [Wed, 1 Feb 2023 20:10:56 +0000 (12:10 -0800)]
add arcanist patch to fix arc diff
Another patch to fix arcanist on newer php versions. See previous patch
here: https://reviews.llvm.org/D129232
Authored by: Justin Stitt (justinstitt)
Reviewed by: nickdesaulniers, hiraditya, foad
Differential Revision: https://reviews.llvm.org/D131699
Peter Klausler [Tue, 3 Jan 2023 23:09:50 +0000 (15:09 -0800)]
[flang] Catch character length errors in pointer associations
When character lengths are known at compilation time, report an error
when a data target with a known length does not match the explicit length
of a pointer that is being associated with it; see 10.2.2.3 paragraph 5.
Differential Revision: https://reviews.llvm.org/D142755
Joseph Huber [Wed, 1 Feb 2023 19:52:22 +0000 (13:52 -0600)]
[Clang] Fix test after changing the order of input files
Summary:
Forget to update these tests after moving the input earlier.
Joseph Huber [Wed, 1 Feb 2023 19:48:27 +0000 (13:48 -0600)]
[LinkerWrapper] Adjust placement of input files for the linker
Summary:
The placement of input files can change the result of the linker. We
should put the input files earlier to avoid this.
Petr Hosek [Wed, 1 Feb 2023 09:45:35 +0000 (09:45 +0000)]
[Driver][Fuchsia] Support --emit-static-lib in Fuchsia driver
This allows building static libraries with Clang driver.
Differential Revision: https://reviews.llvm.org/D143092
Peter Klausler [Thu, 29 Dec 2022 18:07:10 +0000 (10:07 -0800)]
[flang] Catch statement function typing error
Emit an error message when the right-hand side expression of a statement function
definition cannot be converted to the type of the statement function.
Differential Revision: https://reviews.llvm.org/D142745
Craig Topper [Wed, 1 Feb 2023 18:55:35 +0000 (10:55 -0800)]
[RISCV] Move the even register check for rv32zdinx later in the matching process.
And remove the IsRV64 checks for isGPRAsFPR and isGPRPF64AsFPR.
Overall I think this results in a better diagnostic experience. We
now do a better job of matching Zdinx instructions even if the registers
aren't correct and report an error for missing features like RV64.
Unfortunately, this makes it difficult to recover the error location
for the invalid odd register when we do report it. But to make up
for it, I gave a more specific error message.
It doesn't look like binutils gives any warning or error for odd registers.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D142997
Nikolas Klauser [Fri, 20 Jan 2023 08:26:37 +0000 (09:26 +0100)]
[libc++] Forward ranges::sort to instantiations in the dylib
This patch removes `_WrapAlgPolicy` and related functionality. Instead, we explicitly forward to `__sort` now if we have an instantiation inside the dylib. If we don't we just call `__introsort`.
Reviewed By: ldionne, #libc
Spies: sstefan1, libcxx-commits
Differential Revision: https://reviews.llvm.org/D140824
usama hameed [Wed, 1 Feb 2023 19:06:19 +0000 (11:06 -0800)]
[Sanitizers] fix -fno-sanitize-link-runtime for darwin
rdar://
99200922
Differential Revision: https://reviews.llvm.org/D142421
Nikolas Klauser [Fri, 20 Jan 2023 07:13:32 +0000 (08:13 +0100)]
[libc++] Split ranges.transform.binary.pass.cpp up
`ranges.transform.binary.pass.cpp` took ~25s to compile. `ranges.transform.binary.range.pass.cpp` and `ranges.transform.binary.iterator.pass.cpp` take ~13s each.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D142183
Nikolas Klauser [Fri, 20 Jan 2023 08:18:07 +0000 (09:18 +0100)]
[libc++] Remove explicit instantiations of __insertion_sort_incomplete and __sort5 from the dylib
These instantiations were never visible, because they are only used in `__sort`, which is also explicitly instantiated in the dylib.
Reviewed By: ldionne, #libc
Spies: #libc_vendors, emaste, nemanjai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D142185
Tue Ly [Wed, 1 Feb 2023 18:37:55 +0000 (13:37 -0500)]
[libc][Obvious] Add a default clause to RoundingModeUtils.h to suppress gcc
warning.
Mitch Phillips [Wed, 1 Feb 2023 18:35:56 +0000 (10:35 -0800)]
Revert "Fix tsan problem where the per-thread shared_ptr() can be locked right before the cache is destroyed causing a race where it tries to remove an entry from a destroyed cache."
This reverts commit
bcc10817d5569172ee065015747e226280e9b698.
Reason: Broke the aarch64-asan bot. More information available in the
Phabricator review: https://reviews.llvm.org/D140931
Steven Wu [Wed, 1 Feb 2023 18:34:05 +0000 (10:34 -0800)]
[Module] Respect `-fno-pch-timestamps` when building modules
Always respect the FrontendOption to not include timestamps in PCH or
Modules when `-fno-pch-timestamps` is specified.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D141632
Stella Stamenova [Wed, 1 Feb 2023 18:25:20 +0000 (10:25 -0800)]
[mlir] Pin for the PyPi requirements for mlir
This change is pinning the requirements to a specific version (or a range) depending on the requirement. A couple of considerations:
* numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, and np.int which are used heavily in onnx-mlir
* not all versions of each package are available on every platform - to the best of my knowledge, these ranges should work on Ubuntu, CentOS and Windows
Adding a minimum and maximum version, or pinning to a specific versions where possible, helps with two major goals - security and maintainability. It gives us an opportunity to make sure that the packages being used are not part of a security attack as well as guaranteeing that they support the features that mlir depends on (see note about numpy deprecation).
Let me know if you are aware of better versions or ranges to pin to.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D142563
Mircea Trofin [Wed, 1 Feb 2023 18:23:28 +0000 (10:23 -0800)]
[mlgo] Allow logging the spec for the "advice", if needed
This is for the interactive model runner, so it can confirm the tensor
spec of the advice with its host.
Jorge Gorbe Moya [Wed, 1 Feb 2023 18:12:41 +0000 (10:12 -0800)]
[Hexagon] Use %t for output file in test introduced in
97d51e3fa8e8 (NFCI).
Felipe de Azevedo Piovezan [Fri, 6 Jan 2023 18:52:22 +0000 (15:52 -0300)]
Reland "[codegen] Store address of indirect arguments on the stack"
The commit was reverted due to a regression in debug information of an
optimized code test in lldb. This has since been addressed by:
1. rGf753e5be8239: [LiveDebugValues] Allow EntryValue with OP_deref
expressions
2. rG055f2f04e658: [mem2reg][debuginfo] Handle op_deref when converting
dbg.declare
Differential Revision: https://reviews.llvm.org/D141381
Petr Hosek [Wed, 1 Feb 2023 17:29:54 +0000 (17:29 +0000)]
[CMake] Save and restore CMAKE_EXE_LINKER_FLAGS manually
cmake_push_check_state and cmake_pop_check_state doesn't save and
restore CMAKE_EXE_LINKER_FLAGS so we need to do it manually.
Differential Revision: https://reviews.llvm.org/D143088
Joseph Huber [Wed, 1 Feb 2023 18:01:44 +0000 (12:01 -0600)]
[LinkerWrapper] Fix passing `-rpath` directly to clang
Summary:
This code passed the value of `-rpath` directly to the clang invocation.
If we're using the linker then it'll be fine. However, if the linker is
`gcc` as is the case when doing `-fopenmp-targets=x86_64` then this will
cause problems. This patch adds the `-Wl,-rpath,` to feed it to the
linker correctly.
Nikolas Klauser [Tue, 10 Jan 2023 00:56:53 +0000 (01:56 +0100)]
[libc++] Add a clang-tidy check to make sure we use _Uglyfied attribute names
Reviewed By: ldionne, #libc
Spies: krytarowski, jdoerfert, libcxx-commits
Differential Revision: https://reviews.llvm.org/D142322
Ramon de C Valle [Wed, 1 Feb 2023 16:42:28 +0000 (16:42 +0000)]
Add CFI integer types normalization
This commit adds a new option (i.e.,
`-fsanitize-cfi-icall-normalize-integers`) for normalizing integer types
as vendor extended types for cross-language LLVM CFI/KCFI support with
other languages that can't represent and encode C/C++ integer types.
Specifically, integer types are encoded as their defined representations
(e.g., 8-bit signed integer, 16-bit signed integer, 32-bit signed
integer, ...) for compatibility with languages that define
explicitly-sized integer types (e.g., i8, i16, i32, ..., in Rust).
``-fsanitize-cfi-icall-normalize-integers`` is compatible with
``-fsanitize-cfi-icall-generalize-pointers``.
This helps with providing cross-language CFI support with the Rust
compiler and is an alternative solution for the issue described and
alternatives proposed in the RFC
https://github.com/rust-lang/rfcs/pull/3296.
For more information about LLVM CFI/KCFI and cross-language LLVM
CFI/KCFI support for the Rust compiler, see the design document in the
tracking issue https://github.com/rust-lang/rust/issues/89653.
Reviewed By: pcc, samitolvanen
Differential Revision: https://reviews.llvm.org/D139395
Chris Cotter [Wed, 1 Feb 2023 17:38:30 +0000 (17:38 +0000)]
[llvm][NFC] Use move instead of copy
Summary: For functions that accept an rvalue reference type
parameter, use move to avoid copying the parameter.
These were found when implementing CppCoreGuideline F.18 in
clang-tidy.
Committed on behalf of ccotter (Chris Cotter)
Reviewers: Michael137 thieta
Differential Revision: https://reviews.llvm.org/D142825
Ayush Sahay [Wed, 1 Feb 2023 14:40:22 +0000 (20:10 +0530)]
[lldb] Enable TestFrameFormatNameWithArgs in case of cross compilation
TestFrameFormatNameWithArgs.test is enabled only in case of native
compilation but is applicable in case of cross compilation too. So,
provision support for enabling it in case of both, native and cross
compilation.
Reviewed By: Michael137
Differential Revision: https://reviews.llvm.org/D140839
LLVM GN Syncbot [Wed, 1 Feb 2023 17:25:52 +0000 (17:25 +0000)]
[gn build] Port
516e30175256
Steven Wu [Wed, 1 Feb 2023 17:24:44 +0000 (09:24 -0800)]
[NFC][Profile] Access profile through VirtualFileSystem
Make the access to profile data going through virtual file system so the
inputs can be remapped. In the context of the caching, it can make sure
we capture the inputs and provided an immutable input as profile data.
Reviewed By: akyrtzi, benlangmuir
Differential Revision: https://reviews.llvm.org/D139052
Florian Hahn [Wed, 1 Feb 2023 16:51:17 +0000 (16:51 +0000)]
[SCEV] Use fact that B >u 0 for A <u B in applyLoopGuards.
If LHS <u RHS holds, RHS should be guaranteed to be > 0. By using
using 'umax(RHS, 1) -1' instead of 'RHS - 1' the results in
applyLoopGuards can be improved in some cases.
Note that the TODO for the tests mentioned the max BTC being 11, but
unless I am missing something 10 should be correct.
https://alive2.llvm.org/ce/z/44nP7F
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D126503
Joe Nash [Tue, 31 Jan 2023 17:08:00 +0000 (12:08 -0500)]
[AMDGPU][NFC] More precise predicates on GFX9 f16 insts
Removes redundant Has16BitInsts and allows for future use
of OtherPredicates on V_DIV_FIXUP_F16_gfx9 and V_FMA_F16_gfx9
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D142990
Tue Ly [Sat, 28 Jan 2023 04:06:11 +0000 (23:06 -0500)]
[libc][math] Implement acoshf function correctly rounded to all rounding modes.
Implement acoshf function correctly rounded to all rounding modes.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D142781
Ingo Müller [Wed, 1 Feb 2023 14:29:02 +0000 (14:29 +0000)]
[mlir][scf] Fix typo in description of option of TestSCFForUtilsPass (NFC).
Reviewed By: ingomueller-net
Differential Revision: https://reviews.llvm.org/D143067
Yitzhak Mandelbaum [Thu, 26 Jan 2023 14:31:03 +0000 (14:31 +0000)]
[clang][dataflow] Relax validity assumptions in `UncheckedOptionalAccessModel`.
Currently, the interpretation of `swap` calls in the optional model assumes the
optional arguments are modeled (and therefore have valid storage locations and
values). This assumption is incorrect, for example, in the case of unmodeled
optional fields (which can be missing either value or location). This patch
relaxes these assumptions, to return rather than assert when either argument is
not modeled.
Differential Revision: https://reviews.llvm.org/D142710
Petar Avramovic [Wed, 1 Feb 2023 15:40:04 +0000 (16:40 +0100)]
AMDGPU/MC: Refactor decoders. Rework decoders for float immediates
decodeFPImmed creates immediate operand using register operand width,
but size of created immediate should correspond to OperandType for
RegisterOperand.
e.g. OPW128 could be used for RegisterOperands that use v2f64 v4f32
and v8f16. Each RegisterOperands would have different OperandType and
require that immediate is decoded using 64, 32 and 16 bit immediate
respectively.
decodeOperand_<RegClass> only provides width for register decoding,
introduce decodeOperand_<RegClass>_Imm<ImmWidth> that also provides
width for immediate decoding.
Refactor RegisterOperands:
- decoders get _Imm<ImmWidth> suffix in some cases
- removed unused RegisterOperands defined via multiclass
- use different RegisterOperand in a few places, new RegisterOperand's
decoder corresponds to the number of bits used for operand's encoding
Refactor decoder functions:
- add asserts for the size of encoding that will be decoded
- regroup them according to the method of decoding
decodeOperand_<RegClass> (register only, no immediate) decoders can now
create immediate of consistent size, use it for better diagnostic of
'invalid immediate'.
Differential Revision: https://reviews.llvm.org/D142636
Chris Cotter [Wed, 1 Feb 2023 15:50:23 +0000 (15:50 +0000)]
[lldb][NFC] Use move instead of copy
Summary: For functions that accept an rvalue reference type
parameter, use move to avoid copying the parameter.
These were found when implementing CppCoreGuideline F.18 in
clang-tidy.
Committed on behalf of ccotter (Chris Cotter)
Reviewers: Michael137
Differential Revision: https://reviews.llvm.org/D142824
Paul Robinson [Tue, 31 Jan 2023 23:22:25 +0000 (15:22 -0800)]
[Driver] Move PS4/PS5 header search path management to the driver
This follows how OpenBSD, FreeBSD, and NetBSD now work. (See
D138183 and D140817 for those cases.)
It also tidies up some code duplication that wasn't exactly right.
Alexey Karyakin [Wed, 1 Feb 2023 15:18:31 +0000 (07:18 -0800)]
[Hexagon] Disallow using the same register for Vy/Vx in vdeal/vshuff
Non-assignment forms of vshuff and vdeal use the first two registers
(Vy, Vx) as both inputs and outputs. It is not valid to use the same
register for both Vy and Vx. The double-write error was not detected
previously because of a special case, which is not actually necessary.
Differential Revision: https://reviews.llvm.org/D142251
Mikhail Goncharov [Wed, 1 Feb 2023 15:09:35 +0000 (16:09 +0100)]
Revert "Improve and enable folding of conditional branches with tail calls."
This reverts commit
c05ddc9cbc12b1f2038380f57a16c4ca98c614b7.
Fails under asan:
https://lab.llvm.org/buildbot/#/builders/168/builds/11637
Failed Tests (3):
LLVM :: CodeGen/X86/jump_sign.ll
LLVM :: CodeGen/X86/or-branch.ll
LLVM :: CodeGen/X86/tailcall-extract.ll
Nikolas Klauser [Wed, 1 Feb 2023 15:05:18 +0000 (16:05 +0100)]
Revert "[libc++] Fix ODR violation with __exception_guard in mixed exceptions builds"
This reverts commit
561105fb9d3a16f7fb8c718cc5da71b11f17a144.
This breaks C++03 with -fno-exceptions.
Valentin Clement [Wed, 1 Feb 2023 14:53:52 +0000 (15:53 +0100)]
[flang] Make EndProgramStmt a NOP + early return
Fix done in D143055 can be simpler by making EndProgramStmt a NOP
and dealing with the exit in `endNewFunction` in a centralize way.
Also add finalization when there is an early exit in the main
program.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D143065
Nikita Popov [Wed, 1 Feb 2023 13:34:38 +0000 (14:34 +0100)]
[ConstantFold] Fix incorrect inbounds inference for [0 x T] GEPs
Previously all indices into [0 x T] arrays were considered in
range, which resulted in us incorrectly inferring inbounds for
all GEPs of that form. We should not consider them in range here,
and instead bail out of the rewriting logic (which would divide
by zero).
Do continue to consider 0 always in range, to avoid changing
behavior for zero-index GEPs.
Joseph Huber [Tue, 31 Jan 2023 15:50:40 +0000 (09:50 -0600)]
[LinkerWrapper] Fix memory issues due to unguarded accesses to global state
There were intemittent errors in the linker wrapper when using the
sanitizers in parallel. First, this is because the `TempFiles` global
was not guarded when creating a new file. Second, even though the `Args`
list is passed as const, the internal state is mutable when adding a
string. So that needs to be guarded too.
Fixes https://github.com/llvm/llvm-project/issues/60437
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D142985
Nikita Popov [Wed, 1 Feb 2023 14:02:34 +0000 (15:02 +0100)]
[InstCombine] Add test for incorrect inbounds on [0 x i8] global (NFC)
Alexander Kornienko [Wed, 1 Feb 2023 12:23:04 +0000 (13:23 +0100)]
[libc++] Fix ODR violation with __exception_guard in mixed exceptions builds
This fix was proposed in https://reviews.llvm.org/D133661#4095018
Shivam Gupta [Wed, 1 Feb 2023 03:14:04 +0000 (08:44 +0530)]
[Clang] Add -Wtype-limits to -Wextra for GCC compatibility
GCC added the -Wtype-limits warning group to -Wextra around
GCC 4.4 and the group has some very helpful extra warnings
like tautological comparison type limit warnings
(comparingan unsigned int to see if it's positive, etc).
Fix https://github.com/llvm/llvm-project/issues/58375
Reviewed By: #clang-vendors, thesamesam
Differential Revision: https://reviews.llvm.org/D142826
Valentin Clement [Wed, 1 Feb 2023 13:45:53 +0000 (14:45 +0100)]
[flang] Make sure derived-type finalization is done before return
Finalization needs to be done before the terminator. In case
of end program, this was done after it and trigger a verifier error.
This patch fixes this case.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D143055
LLVM GN Syncbot [Wed, 1 Feb 2023 13:31:48 +0000 (13:31 +0000)]
[gn build] Port
ca50be8c896b
Florian Hahn [Wed, 1 Feb 2023 13:30:43 +0000 (13:30 +0000)]
[SCEV] Add test for applyLoopGuards with pointer induction.
Add an additional variant of the test added in
67b712024ca1f3c5.
Tim Northover [Wed, 1 Feb 2023 12:17:39 +0000 (12:17 +0000)]
[compiler-rt] initialize variables to silence warning. NFC.
They were being initialized anyway, I believe, but the logic was a bit
convoluted for the Clang warnings to detect so we were getting "variable 'EBX'
may be uninitialized when used here" later on.
Sergey Kachkov [Fri, 27 Jan 2023 08:54:25 +0000 (11:54 +0300)]
[GVN] Add pre-commit tests for address translation through select (D142705)
Differential Revision: https://reviews.llvm.org/D142706
Matthias Springer [Wed, 1 Feb 2023 11:58:39 +0000 (12:58 +0100)]
[mlir][tensor][bufferize] Implement getBufferType for CastOp
This interface method is used to compute the buffer type of a value during bufferization. It was missing. This is interface method is used during loop bufferization.
Also fix a bug where a cast from an unranked tensor to a ranked tensor type did not always apply a fully dynamic layout map on the result memref.
Differential Revision: https://reviews.llvm.org/D143063
Yitzhak Mandelbaum [Tue, 3 Jan 2023 15:41:38 +0000 (15:41 +0000)]
[clang][dataflow] Fix handling of `DeclRefExpr`s to `BindingDecl`s.
The invariants around `ReferenceValues` are subtle (arguably, too much so). That
includes that we need to take care not to double wrap them -- in cases where we
wrap a loc in an `ReferenceValue` we need to be sure that the pointee isn't
already a `ReferenceValue`. `BindingDecl` introduces another situation in which
this can arise. Previously, the code did not properly handle `BindingDecl`,
resulting in double-wrapped values, which broke other invariants (at least, that
struct values have an `AggregateStorageLocation`).
This patch adjusts the interpretation of `DeclRefExpr` to take `BindingDecl`'s
peculiarities into account. It also fixes the two tests which should have caught
this issue but were themselves (subtly) buggy.
Differential Revision: https://reviews.llvm.org/D140897
Andrew Savonichev [Wed, 1 Feb 2023 13:16:43 +0000 (16:16 +0300)]
[NVPTX] Implement NVPTX AliasAnalysis
NVPTXAliasAnalysis extends the default AA to take pointer address
spaces into account. The analysis assumes that pointers in different
address spaces do not alias, unless one of them is generic (flat)
address space.
The patch also implements pointsToConstantMemory (via
getModRefInfoMask) to expose semantic of the constant address space to
the optimizer as discussed in D112466.
Differential Revision: https://reviews.llvm.org/D124787
Peixin Qiao [Wed, 1 Feb 2023 13:09:02 +0000 (21:09 +0800)]
[flang] Support allocate array from scalar source in runtime
As Fortran 2018 9.7.1.2(7), the value of each element of allocate object
becomes the value of source when the allocate object is array and the
source is scalar.
Fix #60090.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142112
Ben Mudd [Mon, 23 Jan 2023 13:59:41 +0000 (13:59 +0000)]
[DebugInfo] Make debug intrinsics to track cloned values in JumpThreading
This patch causes debug value intrinsics outside of cloned blocks in the
Jump Threading pass to correctly point towards any derived values. If it cannot,
it kills them.
Reviewed By: probinson, StephenTozer
Differential Revision: https://reviews.llvm.org/D140404
Jonas Paulsson [Thu, 19 Jan 2023 23:00:32 +0000 (17:00 -0600)]
[SystemZ] Implement isGuaranteedNotToBeUndefOrPoisonForTargetNode().
Returning true from this method for PCREL_WRAPPER and PCREL_OFFSET avoids
problems when a PCREL_OFFSET node ends up with a freeze operand, which is not
handled or expected by the backend.
Fixes #60107
Reviewed By: uweigand, RKSimon
Differential Revision: https://reviews.llvm.org/D142971
Florian Hahn [Wed, 1 Feb 2023 12:02:54 +0000 (12:02 +0000)]
[SCEV] Add test for applyLoopGuards with pointer induction.
Extra test that crashes with earlier versions of D126503.
Kohei Yamaguchi [Wed, 1 Feb 2023 11:27:45 +0000 (16:57 +0530)]
[mlir][NFC] Clean and Fix broken Affine documentation
- Modified single-quote to back-quote at op name, etc.
- Remove a duplicated `affine.store` op's doc
- Fix broken links
- Move Syntax of `StoreOp` and `LoadOp` from Affine.md to AffineOps.td
Reviewed By: bondhugula, dcaballe
Differential Revision: https://reviews.llvm.org/D142858
Benjamin Kramer [Wed, 1 Feb 2023 11:04:19 +0000 (12:04 +0100)]
[InstCombine][NFC] Fold variable into assert
Avoids unused variable warnings when asserts are disabled.
Quentin Colombet [Thu, 19 Jan 2023 09:56:57 +0000 (10:56 +0100)]
[InstCombine] Don't replace unused `atomicrmw xchg` with `atomic store`
Following the discussion from https://reviews.llvm.org/D141277 and in
particular Ralf Jung's comment at
https://reviews.llvm.org/D141277#inline-1365148, replacing an unused `atomicrmw
xchg` into an `atomic store` is illegal even for release ordering.
Quoting Connor Horman from the rust lang discussion linked in that comment:
"An acquire operation A only synchronizes-with a release operation R if it
takes its value from R, or any store in the release sequence headed by R, which
is R, followed by the longest continuous sequence of read-modify-write
operations.
A regular store following R in the modification order would break the release
sequence, and if an acquire operation reads that store or something later, then
it loses any synchronization it might have already had."
This fixes https://github.com/llvm/llvm-project/issues/60418
Differential Revision: https://reviews.llvm.org/D142097
Jean Perier [Wed, 1 Feb 2023 10:43:22 +0000 (11:43 +0100)]
[flang][hlfir] Lower post f77 user calls
In lowering to HLFIR, deal with user calls involving a mix of:
- dummy with VALUE
- Polymorphism
- contiguous dummy
- assumed shape dummy
- OPTIONAL arguments
- NULL() passed to OPTIONAL arguments.
- elemental calls
Does not deal with assumed ranked dummy arguments.
This patch unifies the preparation of all arguments that must be passed
in memory and are not passed as allocatable/pointers.
For optionals, the same argument preparation is done, except the utility
that generates the IR for the argument preparation is called inside a
fir.if.
The addressing of array arguments in elemental calls is delayed so that
it can also happen during this argument preparation, and be placed in
the fir.if when the array may be absent.
Structure helpers are added to convey a prepared dummy argument and the
data that may be needed to do the clean-up after the call (temporary
storage deallocation or copy-out). And a utility is added to wrap
the preparation code inside a fir.if and convey these values through
the fir.if.
Certain aspects of this patch brings the HLFIR lowering support beyond
what the current lowering to FIR supports (e.g. handling of NULL(), handling
of optional in elemental calls, handling of copy-in/copy-out involving
polymorphic entities).
Differential Revision: https://reviews.llvm.org/D142695
Nicolas Vasilache [Mon, 30 Jan 2023 08:37:46 +0000 (00:37 -0800)]
[mlir][Linalg] Add a transform.structured.lower_unpack op
This revision introduces `transform.structured.lower_unpack` which allows
rewriting a `tensor.unpack` to `transpose` (`linalg.generic`) + `tensor.empty` + `tensor.collapse_shape` + `tensor.extract_slice`
The implementation is currently limited to static pack ops that do not have outer_dims permutations.
Differential Revision: https://reviews.llvm.org/D142889
David Sherwood [Wed, 1 Feb 2023 09:43:45 +0000 (09:43 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for multi-multi dots
Adds intrinsics for the following SME2 instructions:
* sdot (multi-multi, 2 and 4 vectors, 32-bit and 64-bit ZA)
* udot (multi-multi, 2 and 4 vectors, 32-bit and 64-bit ZA)
* usdot (multi-multi, 2 and 4 vectors)
* fdot (multi-multi, 2 and 4 vectors)
* bfdot (multi-multi, 2 and 4 vectors)
NOTE: These intrinsics are still in development and are subject to future changes.
Differential Revision: https://reviews.llvm.org/D142478
Guillaume Chatelet [Wed, 1 Feb 2023 09:34:46 +0000 (09:34 +0000)]
[NFC] Use GlobalObject::setAlignment that takes an Align in BitcodeReader
David Green [Wed, 1 Feb 2023 09:21:07 +0000 (09:21 +0000)]
[AArch64] Handle negative architecture features
Currently negative architecture features passes to clang like -Xclang
-target-feature -Xclang -v9.3a will end up _enabling_ dependant target
features (like FEAT_MOPS). This patch fixes that by ensuring we don't
enable dependant target features when !Enabled.
Fixes #60375
Differential Revision: https://reviews.llvm.org/D142963
Jonas Hahnfeld [Wed, 1 Feb 2023 09:14:56 +0000 (10:14 +0100)]
XFAIL new test available_externally_alias.ll on NVPTX
Guillaume Chatelet [Wed, 1 Feb 2023 09:13:57 +0000 (09:13 +0000)]
[NFC] Use GlobalObject::setAlignment that takes an Align in LLParser
Tobias Gysi [Wed, 1 Feb 2023 09:08:42 +0000 (10:08 +0100)]
[mlir][llvm] Opaque pointer support for atomic and call ops.
This revision adapts the printers and parsers of the LLVM Dialect
AtomicRMWOp, AtomicCmpXchgOp, CallOp, and InvokeOp to support both
opaque and typed pointers by printing the pointer types explicitly.
Previously, the printers and parser of these operations silently assumed
typed pointers. This assumption is problematic if a lowering or the
LLVM IR import produce LLVM Dialect with opaque pointers and the IR is
then printed and parsed, for example, when running mlir-translate. In
LLVM IR itself all tests with typed pointers are already gone. It is
thus important to start switching to opaque pointers.
This revision can be seen as a preparation step for the switch of the
LLVM Dialect to opaque pointers. Once printing and parsing works
seamlessly, all lowerings to LLVM Dialect can be switched to produce
opaque pointers. After a transition period, LLVM Dialect itself can by
simplified to support opaque pointers only.
Reviewed By: ftynse, Dinistro
Differential Revision: https://reviews.llvm.org/D142884
Matthias Springer [Wed, 1 Feb 2023 08:33:22 +0000 (09:33 +0100)]
[mlir][bufferization][NFC] Rename getAliasingOpOperand/getAliasingOpResult
* `getAliasingOpOperand` => `getAliasingOpOperands`
* `getAliasingOpResult` => `getAliasingOpResults`
Also a few minor code cleanups and better documentation.
Differential Revision: https://reviews.llvm.org/D142979
Simon Tatham [Tue, 31 Jan 2023 17:31:33 +0000 (17:31 +0000)]
[ARM] Allow selecting hard-float ABI in integer-only MVE.
Armv8.1-M can be configured to support the integer subset of the MVE
vector instructions, and no floating point. In that situation, the FP
and vector registers still exist, and so do the load, store and move
instructions that transfer data in and out of them. So there's no
reason the hard floating point ABI can't be supported, and you might
reasonably want to use it, for the sake of intrinsics-based code
passing explicit MVE vector types between functions.
But the selection of the hard float ABI in the backend was gated on
Subtarget->hasVFP2Base(), which is false in the case of integer MVE
and no FP.
As a result, you'd silently get the soft float ABI even if you
deliberately tried to select it, e.g. with clang options such as
--target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+nofp+mve
The hard float ABI should have been gated on the weaker condition
Subtarget->hasFPRegs(), because the only requirement for being able to
pass arguments in the FP registers is that the registers themselves
should exist.
I haven't added a new test, because changing the existing
CodeGen/Thumb2/float-ops.ll test seemed sufficient. But I've added a
comment explaining why the results are expected to be what they are.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D142703
Jonas Hahnfeld [Mon, 23 Jan 2023 13:09:48 +0000 (14:09 +0100)]
[CodeGen] Filter out available_externally aliases
The Language Reference says that aliases can have available_externally
linkage if their aliasee is an available_externally global value. Using
this kind of aliases resulted in crashes during code generation, filter
them out (the same that the AsmPrinter also filters out GlobalVariables
in emitSpecialLLVMGlobal(); Functions are discarded in the machine pass
infrastructure).
Differential Revision: https://reviews.llvm.org/D142352
wanglei [Wed, 1 Feb 2023 03:27:52 +0000 (11:27 +0800)]
[LoongArch] Support getHostCPUName and getHostCPUFeatures
Reviewed By: xen0n, MaskRay
Differential Revision: https://reviews.llvm.org/D142950
Lorenzo Chelini [Tue, 31 Jan 2023 13:25:14 +0000 (14:25 +0100)]
[MLIR] Propagate unpack through element-wise ops
Introduce `pushDownUnPackOpThroughElemGenericOp` to propagate producer
unpack operation through an element-wise linalg.generic operation. This
pattern complements `BubbleUpPackOpThroughElemGenericOp`. The general
idea is to bubble up tensor.pack as much as possible while pushing down
tensor.unpack as much as possible, and canonicalize away symmetrical
tensor.pack and tensor.unpack operations.
Currently, `pushDownUnPackOpThroughElemGenericOp` expects a single
tensor.unpack operation as the producer of one of the linalg.generic's
operands.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D142523
Noah Goldstein [Wed, 1 Feb 2023 05:23:29 +0000 (23:23 -0600)]
Make `prefetchit{0/1}` emit an assembler warning if the operand is not rip-rel
Without a rip-rel operand, `prefetchit{0/1}` is a nop. This is a
reasonable mistake for someone to make and is almost certainly not
what they are after.
This matches the same warning in `gas`.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D142797