Commit Graph

449422 Commits

Author SHA1 Message Date
David Spickett
ae361d3d90 [LLDB] Remove return value from DumpRegisterValue
No one ever checks it. Also convert to early return.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D141687
2023-01-23 10:52:20 +00:00
Guillaume Chatelet
9c4c32a3d0 Revert D142108 "[libc][NFC] Detect host CPU features using try_compile instead of try_run."
Build bots are failing.
https://lab.llvm.org/buildbot/#/builders/90/builds/44634

This reverts commit 9acc2f37bd.
2023-01-23 10:43:34 +00:00
Luca Di Sera
ddbe14084d Add clang_CXXMethod_isExplicit to libclang
The new method is a wrapper of `CXXConstructorDecl::isExplicit` and
`CXXConversionDecl::isExplicit`, allowing the user to recognize whether
the declaration pointed to by a cursor was marked with the explicit
specifier.

An export for the function, together with its documentation, was added
to "clang/include/clang-c/Index.h" with an implementation provided in
"clang/tools/libclang/CIndex.cpp".

The implementation is based on similar `clang_CXXMethod`
implementations, returning a falsy unsigned value when the cursor is not
a declaration, is not a declaration for a constructor or conversion
function or is not a relevant declaration that was marked with the
`explicit` specifier.

The new symbol was added to "clang/tools/libclang/libclang.map" to be
exported, under the LLVM16 tag.

"clang/tools/c-index-test/c-index-test.c" was modified to print a
specific tag, "(explicit)", for cursors that are recognized by
`clang_CXXMethod_isExplicit`.

Two new regression files, "explicit-constructor.cpp" and
"explicit-conversion-function.cpp", were added to "clang/test/Index", to
ensure that the behavior of the new function is correct for constructors
and conversion functions, respectively.

The "get-cursor.cpp", "index-file.cpp" and
"recursive-cxx-member-calls.cpp" regression files in "clang/test/Index"
were updated as they were affected by the new "(explicit)" tag.

A binding for the new function was added to libclang's python's
bindings, in "clang/bindings/python/clang/cindex.py", as the
"is_explicit_method" method under `Cursor`.

An accompanying test was added to
"clang/bindings/python/tests/cindex/test_cursor.py", mimicking the
regression tests for the C side.

The current release note for Clang, "clang/docs/ReleaseNotes.rst" was
modified to report the new addition under the "libclang" section.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D140756
2023-01-23 11:30:38 +01:00
Dimitry Andric
abf399737e Revert "[compiler-rt][builtins] Skip building (b)float16 support on i386-freebsd"
This reverts commit 45368c7558.

There were some unexpected failures in aarch64 and arm buildbots, I will
have to investigate why these suddenly fell over.
2023-01-23 11:22:28 +01:00
Nikita Popov
474f20ba26 [Verifier] Check that !nonnull metadata is empty
!nonnull expectes an empty metadata argument, so check that this
is the case in the verifier. This came up as a problem in
https://reviews.llvm.org/D141386.

This requires dropping the verifier call in the compatibility-6.0.ll
test (which is not present in any of the other bitcode compatibility
tests). The original input unfortunately used typo'd nonnull
metadata.
2023-01-23 11:16:49 +01:00
Matt Arsenault
65420c8041 DAG: Use getNegatedExpression in combineMinNumMaxNum
Computing the negated RHS expression just to see if it compares equal
and throw it away feels dirty.
2023-01-23 06:07:23 -04:00
Matt Arsenault
3b80d02992 DAG: Look through fneg when trying to create unsafe minnum/maxnum
This makes most sense for isFNegFree targets, but shouldn't make
things worse without it. This avoids AMDGPU test regressions in a
future patch.

For some reason APFloat::compareAbsoluteValue is private, so compute
the neg of the constants.
2023-01-23 06:07:22 -04:00
Shivam Gupta
586ce6ac9e [MLIR][NFC] Fix a memset in MemRefUtils.h
found by PVS-Studio - https://pvs-studio.com/en/blog/posts/cpp/1003/, N10.
memset function expects to take int as the second actual argument,
but receives a pointer. Here, the first and the second argument of
the function are mixed up.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D142310
2023-01-23 15:15:30 +05:30
Michael Buch
bee8860525 [clang][DebugInfo] Don't canonicalize names in template argument list for alias templates
**Summary**

This patch customizes the `CGDebugInfo` printing policy to stop canonicalizing
the template arugment list in `DW_AT_name` for alias templates. The motivation for
this is that we want to be able to use the `TypePrinter`s support for
omitting defaulted template arguments when emitting `DW_AT_name`.

For reference, GCC currently completely omits the template arguments
when emitting alias template DIEs.

**Testing**

* Added unit-test

Differential Revision: https://reviews.llvm.org/D142268
2023-01-23 09:43:17 +00:00
Timm Bäder
d54ae905d1 [clang][Interp][NFC] Rename InlineDescptor::IsMutable to IsFieldMutable 2023-01-23 10:32:51 +01:00
Shivam Gupta
051bf9cd76 [Flang] fix a copy-paste error in scope.cpp
found by PVS-Studio.

Reviewed By: jeanPerier, klausler

Differential Revision: https://reviews.llvm.org/D142306
2023-01-23 14:57:12 +05:30
Timm Bäder
8f15c4c2a0 [clang][Interp][NFC] Add Record::getDestructor()
Unused for now but will be used in later commits.
2023-01-23 10:19:34 +01:00
Timm Bäder
284bd95e80 [clang][Interp][NFC] Remove unused using alias 2023-01-23 10:19:34 +01:00
Guillaume Chatelet
9acc2f37bd [libc][NFC] Detect host CPU features using try_compile instead of try_run.
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.

Differential Revision: https://reviews.llvm.org/D142108
2023-01-23 09:05:53 +00:00
Valentin Clement
262dad4a81 [flang] Deal with NULL() passed as actual arg to unlimited polymorphic dummy
NULL() passed as actual argument to a procedure with an optional
dummy argument is represented with `fir.box<none>` type. When the dummy
argument is polymoprhic or unlimited polymorphic, the SelectOp will complain
if the types of the two arguments are not identical. Add a conversion from
`fir.box<none>` to `fir.class<none>` in that case.
Other situations with optional will require a fir.rebox and will be done in
a follow up patch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D142203
2023-01-23 09:49:59 +01:00
Jannik Silvanus
4dbf3f2e8e [LangRef] Require i8s to be naturally aligned
It is widely assumed that i8 is naturally aligned (i8:8),
and that hence i8s can be used to access arbitrary bytes.

As discussed in https://discourse.llvm.org/t/status-of-overaligned-i8,
this patch makes this assumption explicit, by documenting it in
the LangRef, and enforcing it when parsing a data layout string.

Historically, there have been data layouts that violate this requirement,
notably the old DXIL data layout that aligns i8 to 32 bits.

A previous patch (df1a74a) enabled importing modules with invalid data layouts
using override callbacks.
Users who wish to continue importing modules with overaligned i8s (e.g. DXIL)
thus need to provide a data layout override callback that fixes the
data layout, at minimum by setting natural alignment for i8.

Any further adjustments to the module (e.g. adding padding bytes if necessary)
need to be done after module import. In the case of DXIL, this should not be
necessary, because i8 usage in DXIL is very limited and its alignment actually
does not matter, see
https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst#primitive-types

Differential Revision: https://reviews.llvm.org/D142211
2023-01-23 09:31:04 +01:00
Johannes Doerfert
f341807ea5 [Attributor] Add initial support for vectors in AAPointerInfo
While full support requires more work (see TODOs), this allows us to
handle vector writes with a single constant value properly. For now,
we can handle the same constant values stored to all elements if
everything is of a fixed size.
2023-01-22 23:20:32 -08:00
Johannes Doerfert
538cd2e883 [Attributor] Multi-range accesses can be exact
Even if we have multiple access ranges, the access can be exact. It is
not a MUST access but that is taken care of elsewhere. The tests were
wrong as they contained uninitialized memory. When the memory is
initialized it works as expected.
2023-01-22 23:18:55 -08:00
Johannes Doerfert
129faec711 [OpenMP] Identify non-aligned barriers executed in an aligned context
Even if a barrier does not enforce aligned execution, it will
effectively be like an aligned barrier if it is executed by all threads
in an aligned way. We lack control flow divergence analysis here so we
can only do (basic block) local reasoning for now.
2023-01-22 21:42:07 -08:00
LLVM GN Syncbot
0326ee790a [gn build] Port 7458908f12 2023-01-23 04:09:18 +00:00
Johannes Doerfert
8e124515cd [OpenMP][FIX] Ensure not to dereference a nullptr 2023-01-22 20:06:23 -08:00
Nikolas Klauser
06385491a6 [libc++] Refactor clang-query checks to clang-tidy checks to get less obscure error messages
Also remove clang-query related code, since it's unused now.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D141805
2023-01-23 05:01:28 +01:00
Nikolas Klauser
7458908f12 [libc++] Improve binary size when using __transaction
__exception_guard is a no-op in -fno-exceptions mode to produce better code-gen. This means that we don't provide the strong exception guarantees. However, Clang doesn't generate cleanup code with exceptions disabled, so even if we wanted to provide the strong exception guarantees we couldn't. This is also only relevant for constructs with a stack of -fexceptions > -fno-exceptions > -fexceptions code, since the exception can't be caught where exceptions are disabled. While -fexceptions > -fno-exceptions is quite common (e.g. libc++.dylib > -fno-exceptions), having another layer with exceptions enabled seems a lot less common, especially one that tries to catch an exception through -fno-exceptions code.

Fixes https://github.com/llvm/llvm-project/issues/56783

Reviewed By: ldionne, Mordante, huixie90, #libc

Spies: EricWF, alexfh, hans, joanahalili, libcxx-commits

Differential Revision: https://reviews.llvm.org/D133661
2023-01-23 04:57:32 +01:00
Wang, Xin10
88eae6ef9f [DAGCombine]Expand usage of CreateBuildVecShuffle to make full use of vector ops
Now, when llc encounters the case that contains a lot of
extract_vector_elt and a BUILD_VECTOR, it will replace these to
vector_shuffle to decrease the size of code, the actions are done in
createBuildVecShuffle in DAGCombiner.cpp, but now the code cannot handle
the case that the size of source vector reg is more than twice the dest
size.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D139685
2023-01-23 11:45:38 +08:00
Kazu Hirata
8ab77a78ba [Support] Use llvm::byteswap in SwapByteOrder.h (NFC)
This patch defines ByteSwap_{32,64} and getSwappedBytes with
llvm::byteswap.

It's tempting to define something like:

  template <typename T,
            typename = std::enable_if_t<std::is_integral_v<T>>>
  inline T getSwappedBytes(T C) { return llvm::byteswap(C); }

But this doesn't work.  The host compiler would issue:

  error: call to 'getSwappedBytes' is ambiguous

while compiling lldb/source/Utility/UUID.cpp.
2023-01-22 19:14:33 -08:00
Johannes Doerfert
7db6a45e16 [OpenMP][FIX] Adjust enum size to avoid assertion after D142320 2023-01-22 18:31:26 -08:00
Yaxun (Sam) Liu
c487b84d75 [HIP] Change default offload arch to gfx906
Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D142246
2023-01-22 20:26:30 -05:00
Matt Arsenault
0ee04a1e3c ARM: Add baseline test for fneg + fcmp + select combine 2023-01-22 21:21:15 -04:00
Sergei Barannikov
b47cdc6ce8 [MC] Replace single-case switch with an if (NFC)
Same as e5f746e9 but for MasmParser.
2023-01-23 04:09:07 +03:00
Ben Shi
029f669db3 [AVR] Emit 'eicall' for devices with large program memory
Fixes https://github.com/llvm/llvm-project/issues/58856

Reviewed By: aykevl

Differential Revision: https://reviews.llvm.org/D142298
2023-01-23 09:06:10 +08:00
Johannes Doerfert
43c1c59f73 [OpenMP] Merge barrier elimination into AAExecutionDomain
With this patch we track aligned barriers in AAExecutionDomain and also
delete unnecessary barriers there. This allows us to eliminate barriers
across blocks, across functions, and in the presence of complex accesses
that do not force a barrier. Further, we can use the collected
information to enable store-load forwarding in a threaded environment
(follow up patch).

Differential Revision: https://reviews.llvm.org/D140463
2023-01-22 16:34:59 -08:00
Sergei Barannikov
e5f746e9bb [MC] Replace a switch with two 'if's (NFC)
This simplifies logic a bit and helps to reduce the future diff.
2023-01-23 03:14:20 +03:00
Shilei Tian
693358d787 [OpenMP][DeviceRTL][NFC] Use OMPTgtExecModeFlags from llvm/include/llvm/Frontend/OpenMP/OMPDeviceConstants.h
This patch makes preparation for a series that will enable per-kernel information
used in both host and device runtime. Some variables/enums, such as `OMPTgtExecModeFlags`,
have to be shared by both of them. A new header `OMPDeviceConstants.h` is added,
containing code that will be shared by them. We will introduce more variables soon.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D142320
2023-01-22 19:10:54 -05:00
Johannes Doerfert
2275e325e4 [OpenMP] Guarding restrictions are required only for guarding
If we do not guard code during SPMDzation, we do not need to check
conditions for successfull guarding. That is, even if some code is
executed in different modes, it does not prevent SPMDzation if there is
no guarded code in there.
2023-01-22 15:53:42 -08:00
Johannes Doerfert
ea3c24932a [OpenMP][FIX] Properly update ParallelLevels tracker 2023-01-22 15:52:45 -08:00
Johannes Doerfert
e68313f100 [OpenMP][FIX] Use thread id not team id for masked section 2023-01-22 15:45:00 -08:00
Kazu Hirata
32ce06bbf2 [Support] Use llvm::bit_floor in PowerOf2Floor (NFC) 2023-01-22 14:34:43 -08:00
Kazu Hirata
e599094038 [llvm] Use llvm::bit_ceil (NFC)
In both of these cases, the arguments to Log2_32_Ceil are known to be
nonzero.
2023-01-22 14:05:14 -08:00
Kazu Hirata
ca7e849720 [llvm] Use llvm::bit_floor (NFC)
In all these cases, the arguments to Log2_32 are known to be nonzero,
so we don't have to worry about "1 << -1".
2023-01-22 13:41:23 -08:00
Dimitry Andric
45368c7558 [compiler-rt][builtins] Skip building (b)float16 support on i386-freebsd
Since bfloat16 and float16 support is not available for i386-freebsd,
the `truncdfbf2.c` and `truncsfbf2.c` builtin sources should be skipped
when targeting that platform, and `COMPILER_RT_HAS_FLOAT16` should not
be defined.

However, the CMake configuration stage runs its tests with the default
target, which normally is amd64-freebsd, so it will detect both bfloat16
and float16 support.

Move adding of the `COMPILER_RT_HAS_FLOAT16` define to the `foreach()`
loop where all the supported architectures are handled, and do not
enable it when targeting i386-freebsd.

Also remove the bfloat16 sources from the `i386_SOURCES` list, when
targeting i386-freebsd.

Differential Revision: https://reviews.llvm.org/D136044
2023-01-22 22:16:51 +01:00
Kazu Hirata
caa99a01f5 Use llvm::popcount instead of llvm::countPopulation(NFC) 2023-01-22 12:48:51 -08:00
Aaron Puchert
0b5cb41dd0 [CMake] Look up target subcomponents in LLVM_AVAILABLE_LIBS
In an installation using the all-contained libLLVM.so, individual
components are not available as targets, so we have to look them up in
LLVM_AVAILABLE_LIBS just like llvm_map_components_to_libnames does it.
Here I don't think we need the capitalized names though because we know
the right capitalization. But I might be wrong.

This is required by dragonffi, who call llvm_map_components_to_libnames
on a list containing ${LLVM_NATIVE_ARCH}. Downstream bug report:
https://bugzilla.opensuse.org/show_bug.cgi?id=1180748.

Differential Revision: https://reviews.llvm.org/D96670
2023-01-22 21:36:26 +01:00
Roman Lebedev
0cdf030cf8 [SCEV] getRangeRefIter(): don't forget to recurse into casts
I'm not really sure the problem can be nicely exposed via a lit test,
since we don't give up on range calculation for deeply nested ranges,
but if i add an assertion that those opcodes are never encountered,
the assertion fails in a number of existing tests.

In reality, the iterative approach is still pretty partial:
1. `Seen` should not be there. We want the last instance of expression, not the first one
2. There should be a check that `getRangeRefIter()` does not self-recurse
2023-01-22 23:28:02 +03:00
Roman Lebedev
4f9f0b480f [NFC][SCEV] Reflow getRangeRefIter() into an exhaustive switch
And, this shows a bug in the original code:
why do we not recurse into casts?

If i add an assertion that those opcodes are never encountered,
the assertion fails in a number of existing tests.
2023-01-22 23:28:02 +03:00
Roman Lebedev
42aaab3b45 [NFC][SCEV] GetMinTrailingZerosImpl(): deduplicate handling
`scPtrToInt` recieves same treatment as normal n-ary ops.
2023-01-22 23:28:01 +03:00
Roman Lebedev
a09b5a0cfc [NFC][SCEV] Reflow GetMinTrailingZerosImpl() into an exhaustive switch 2023-01-22 23:28:01 +03:00
Florian Hahn
31d46ca8aa [Dominators] Introduce DomTreeNodeTraits to allow customization. (NFC)
This patch introduces DomTreeNodeTraits for customization. Clients can implement
DomTreeNodeTraitsCustom to provide custom ParentPtr, getEntryNode and getParent.
There's also a default specialization if DomTreeNodeTraitsCustom is not implemented,
that assume a Function-like NodeT. This is what is used for the existing DominatorTree
and MachineDominatorTree.

The main motivation for this patch is using DominatorTreeBase across all
regions of a VPlan, see D140513.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D142162
2023-01-22 20:22:41 +00:00
Piotr Fusik
898b5c9f5e [NFC] Fix "form/from" typos
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D142007
2023-01-22 20:05:51 +01:00
Kazu Hirata
8e4dc4cfb8 [Support] Use functions from bit.h (NFC)
This patch makes the following replacements:

  countLeadingZeros  -> llvm::countl_zero
  countTrailingZeros -> llvm::countr_zero
  countPopulation    -> llvm::popcount
2023-01-22 10:41:13 -08:00
Simon Pilgrim
dd8ecde00b [ADT] llvm::bit_cast - use __builtin_bit_cast if available
If the compiler supports __builtin_bit_cast we should try to use it instead of std::memcpy (and avoid including the cstring header).

Differential Revision: https://reviews.llvm.org/D142305
2023-01-22 18:21:08 +00:00