533529 Commits

Author SHA1 Message Date
Stephen Tozer
c4667c5aa6
[DebugInfo][Reassociate] Propagate source locs when factoring add->mul (#134829)
As part of reassociating add instructions, we may factorize some of the
adds and produce a mul instruction; this patch propagates the source
location of the reassociated tree of instructions to the new mul.

Found using https://github.com/llvm/llvm-project/pull/107279.
2025-04-09 17:07:45 +01:00
Andreas Jonson
94f6f0334d
[InstCombine] handle trunc to i1 in foldLogOpOfMaskedICmps. (#128861)
proof: https://alive2.llvm.org/ce/z/pu8WmX

fixes #128778
2025-04-09 18:07:34 +02:00
Stephen Tozer
5039bf4e26
[DebugInfo][Inline] Propagate source locs when simplifying cond branches (#134827)
During inlining, we may opportunistically simplify conditional branches
(incl. switches) to unconditional branches if, after inlining, their
destination is fixed. While we do this, we should propagate any
DILocation attached to the original branch to the simplified branch,
which this patch enables.

Found using https://github.com/llvm/llvm-project/pull/107279.
2025-04-09 16:52:05 +01:00
Matthias Springer
a00a61d59b
[mlir][IR] Improve error message when parsing incorrect type (#134984)
Improve error messages when parsing an incorrect type.

Before:
```
invalid kind of type specified
```

After:
```
invalid kind of type specified: expected builtin.tensor, but found 'tensor<*xi32>'
```

This error message is produced when a certain operand/result type is
expected according to an op's TableGen definition, but a different type
is parsed. Type constraints (which may have nice error messages) are
checked after parsing a type. If an incorrect type is parsed, we never
get to the point of printing type constraint error messages. This may
discourage users from specifying C++ classes with type constraints.
(Explicitly specifying C++ classes is beneficial because the
auto-generated C++ code will have richer type information; explicit
casts are unnecessary, etc.) See #134981 for an example where specifying
additional type information with type constraints (e.g.,
`LLVM_AnyVector`) lead to worse error messages.

Note: In order to generate a better error message, the parser must
retrieve a type's name from the C++ class. TableGen-generated type
classes always have a `name` field, but hand-written C++ type classes
may not. The `HasStaticName` template was copied from
`DialectImplementation.h` (`HasStaticDialectName`).
2025-04-09 17:49:47 +02:00
Stephen Tozer
9344b2196c
[DebugInfo][Inlining] Propagate inlined resume source loc to new br (#134826)
As part of inlining an invoke instruction, we may replace an inlined
resume instruction with a simple branch to the landing pad block. When
this happens, we should also propagate the resume's DILocation to this
branch, which this patch enables.

Found using https://github.com/llvm/llvm-project/pull/107279.
2025-04-09 16:42:06 +01:00
Nick Sarnie
68ee56d150
[clang][OpenMP][SPIR-V] Fix addrspace of global constants (#134399)
SPIR-V has strict address space rules, constant globals cannot be in the
default address space.

The OMPIRBuilder change was required for lit tests to pass, we were
missing an addrspacecast.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-04-09 15:41:53 +00:00
Jay Foad
b010554d2d
[IR] Reduce use of getCalledFunction in Verifier. NFCI. (#134978)
This is mostly just a simplification. getCalledFunction is a best-effort
thing so the verifier should not be relying on it in most cases, except
for intrinsic calls where we are guaranteed that the called function is
known, but most of those cases can be handled with
CallBase::getIntrinsicID instead.

---------

Co-authored-by: Tim Gymnich <tim@gymni.ch>
2025-04-09 16:39:35 +01:00
Fraser Cormack
b0338c3d6c
[libclc] Move shuffle/shuffle2 to the CLC library (#135000)
This commit moves the shuffle and shuffle2 builtins to the CLC library.
In so doing it makes the headers simpler and re-usable for other builtin
layers to hook into the CLC functions, if they wish.

An additional gentype utility has been made available, which provides a
consistent vector-size-or-1 macro for use.

The existing __CLC_VECSIZE is defined but empty which is useful in
certain applications, such as in concatenation with a type to make a
correctly sized scalar or vector type. However, this isn't usable in the
same preprocessor lines when wanting to check for specific vector sizes,
as e.g., '__CLC_VECSIZE == 2' resolves to '== 2' which is invalid. In
local testing this is also useful for the geometric builtins which are
only available for scalar types and vector types of 2, 3, or 4 elements.

No codegen changes are observed, except the internal shuffle/shuffle2
utility functions are no longer made publicly available.
2025-04-09 15:52:25 +01:00
ivangarcia44
5083e80c14
Folding extract_strided_metadata input into reinterpret_cast (#134845)
We can always fold the input of a extract_strided_metadata operator to
the input of a reinterpret_cast operator, because they point to the same
memory. Note that the reinterpret_cast does not use the layout of its
input memref, only its base memory pointer which is the same as the base
pointer returned by the extract_strided_metadata operator and the base
pointer of the extract_strided_metadata memref input.

Operations like expand_shape, collapse_shape, and subview are lowered to
a pair of extract_strided_metadata and reinterpret_cast like this:
      
%base_buffer, %offset, %sizes:2, %strides:2 =
memref.extract_strided_metadata %input_memref :
memref<ID1x...xIDNxBaseType> -> memref<f32>, index, index, index, index,
index

%reinterpret_cast = memref.reinterpret_cast %base_buffer to offset:
[%o1], sizes: [%d1,...,%dN], strides: [%s1,...,%N] : memref<f32> to
memref<OD1x...xODNxBaseType >

In many cases the input of the extract_strided_metadata input can be
passed directly into the input of the reinterpret_cast operation like
this (see how %base_buffer is replaced by %input_memref in the
reinterpret_cast above and the input type is updated):

%base_buffer, %offset, %sizes:2, %strides:2 =
memref.extract_strided_metadata %input_memref :
memref<ID1x...xIDNxBaseType> -> memref<f32>, index, index, index, index,
index
%reinterpret_cast = memref.reinterpret_cast %input_memref to offset:
[%o1], sizes: [%d1,...,%dN], strides: [%s1,...,%N] :
memref<ID1x...xIDNxBaseType> to memref<OD1x...xODNxBaseType >

When dealing with static dimensions, the extract_strided_metatdata will
become deadcode and we end up only with a reinterpret_cast:

%reinterpret_cast = memref.reinterpret_cast %input_memref to offset:
[%o1], sizes: [%d1,...,%dN], strides: [%s1,...,%N] :
memref<ID1x...xIDNxBaseType> to memref<OD1x...xODNxBaseType >

Note that reinterpret_cast only reads the base memory pointer from the
input memref (%input_memref above), which is equivalent to the
%base_buffer returned by the extract_strided_metadata operation. Hence
it is legal always to use the extract_strided_metadata input memref
directly in the reinterpret_cast. Note that since this is a pointer,
this operation is legal even when the base pointer values are modified
between the operation pair.

@matthias-springer 
@joker-eph 
@sahas3
@Hanumanth04
@dixinzhou
@rafaelubalmw

---------

Co-authored-by: Ivan Garcia <igarcia@vdi-ah2ddp-178.dhcp.mathworks.com>
2025-04-09 16:50:16 +02:00
Alexey Bataev
076318bd78 [SLP]Use proper order when calculating costs for geps/extracts to correctly identify profitability
Need to reorder properly the scalars, when evaluating the costs for the
external uses/geps to prevent differences in the calculating of the
profitability costs, used to choose between gather/compressed loads.

Fixes https://github.com/llvm/llvm-project/pull/132099#issuecomment-2789627454
2025-04-09 07:43:23 -07:00
David Spickett
fb73086dd2
Revert "[flang][nfc] Support volatility in Fir ops" (#135034)
Reverts llvm/llvm-project#134858

Fails to build when shared libraries are enabled:
https://lab.llvm.org/buildbot/#/builders/80/builds/12361
```
: && /usr/local/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libFIRDialect.so.21.0git -o lib/libFIRDialect.so.21.0git tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIRAttr.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIRDialect.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIRType.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FirAliasTagOpInterface.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FortranVariableInterface.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/Inliner.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/lib:"  lib/libCUFAttrs.so.21.0git  lib/libFIRDialectSupport.so.21.0git  lib/libLLVMAsmPrinter.so.21.0git  lib/libMLIRBuiltinToLLVMIRTranslation.so.21.0git  lib/libMLIROpenMPToLLVM.so.21.0git  lib/libMLIRLLVMToLLVMIRTranslation.so.21.0git  lib/libMLIRFuncToLLVM.so.21.0git  lib/libMLIRArithToLLVM.so.21.0git  lib/libMLIRArithAttrToLLVMConversion.so.21.0git  lib/libMLIRArithTransforms.so.21.0git  lib/libMLIRBufferizationTransforms.so.21.0git  lib/libMLIRBufferizationDialect.so.21.0git  lib/libMLIRSparseTensorDialect.so.21.0git  lib/libMLIRSCFDialect.so.21.0git  lib/libMLIRFuncTransforms.so.21.0git  lib/libMLIRShardingInterface.so.21.0git  lib/libMLIRMeshDialect.so.21.0git  lib/libMLIRVectorDialect.so.21.0git  lib/libMLIRTensorDialect.so.21.0git  lib/libMLIRParallelCombiningOpInterface.so.21.0git  lib/libMLIRMaskableOpInterface.so.21.0git  lib/libMLIRMaskingOpInterface.so.21.0git  lib/libMLIRVectorInterfaces.so.21.0git  lib/libMLIRControlFlowToLLVM.so.21.0git  lib/libMLIRControlFlowDialect.so.21.0git  lib/libMLIRMemRefToLLVM.so.21.0git  lib/libMLIRLLVMCommonConversion.so.21.0git  lib/libMLIRMemRefUtils.so.21.0git  lib/libMLIRAffineDialect.so.21.0git  lib/libMLIRMemRefDialect.so.21.0git  lib/libMLIRArithUtils.so.21.0git  lib/libMLIRComplexDialect.so.21.0git  lib/libMLIRArithDialect.so.21.0git  lib/libMLIRCastInterfaces.so.21.0git  lib/libMLIRInferIntRangeCommon.so.21.0git  lib/libMLIRShapedOpInterfaces.so.21.0git  lib/libMLIRDialect.so.21.0git  lib/libMLIRDialectUtils.so.21.0git  lib/libMLIROpenMPDialect.so.21.0git  lib/libMLIROpenACCMPCommon.so.21.0git  lib/libMLIRTargetLLVMIRExport.so.21.0git  lib/libMLIRDLTIDialect.so.21.0git  lib/libMLIRLLVMIRTransforms.so.21.0git  lib/libMLIRTransforms.so.21.0git  lib/libMLIRUBDialect.so.21.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.21.0git  lib/libMLIRFuncDialect.so.21.0git  lib/libMLIRNVVMDialect.so.21.0git  lib/libMLIRTranslateLib.so.21.0git  lib/libMLIRParser.so.21.0git  lib/libMLIRBytecodeReader.so.21.0git  lib/libMLIRAsmParser.so.21.0git  lib/libMLIRTransformUtils.so.21.0git  lib/libMLIRSubsetOpInterface.so.21.0git  lib/libMLIRValueBoundsOpInterface.so.21.0git  lib/libMLIRDestinationStyleOpInterface.so.21.0git  lib/libMLIRRewrite.so.21.0git  lib/libMLIRRewritePDL.so.21.0git  lib/libMLIRPDLToPDLInterp.so.21.0git  lib/libMLIRPass.so.21.0git  lib/libMLIRAnalysis.so.21.0git  lib/libMLIRInferIntRangeInterface.so.21.0git  lib/libMLIRLoopLikeInterface.so.21.0git  lib/libMLIRPresburger.so.21.0git  lib/libMLIRViewLikeInterface.so.21.0git  lib/libMLIRPDLInterpDialect.so.21.0git  lib/libMLIRPDLDialect.so.21.0git  lib/libLLVMFrontendOpenMP.so.21.0git  lib/libLLVMTransformUtils.so.21.0git  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMRemarks.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMTargetParser.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/lib && :
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::CharBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir12CharBoxValue4dumpEv[_ZNK3fir12CharBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::CharBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::PolymorphicValue::dump() const':
FIROps.cpp:(.text._ZNK3fir16PolymorphicValue4dumpEv[_ZNK3fir16PolymorphicValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::PolymorphicValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::ArrayBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir13ArrayBoxValue4dumpEv[_ZNK3fir13ArrayBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::ArrayBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::CharArrayBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir17CharArrayBoxValue4dumpEv[_ZNK3fir17CharArrayBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::CharArrayBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::ProcBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir12ProcBoxValue4dumpEv[_ZNK3fir12ProcBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::ProcBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::BoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir8BoxValue4dumpEv[_ZNK3fir8BoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::BoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::MutableBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir15MutableBoxValue4dumpEv[_ZNK3fir15MutableBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::MutableBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::ExtendedValue::dump() const':
FIROps.cpp:(.text._ZNK3fir13ExtendedValue4dumpEv[_ZNK3fir13ExtendedValue4dumpEv]+0x18): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::ExtendedValue const&)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
2025-04-09 15:41:45 +01:00
Joel E. Denny
ad9f6d3cee
[PGO][Offload] Use %profdata in PGO tests (#135015)
So that the wrong llvm-profdata is not picked up from PATH.
2025-04-09 10:40:46 -04:00
Matt Arsenault
54cdc75857
clang/AMDGPU: Stop looking for hip.bc in device libs (#134801)
This has been an empty library since January 2023
2025-04-09 16:39:50 +02:00
Vy Nguyen
e3f5a1bfc5
[LLDB][NFC]Also includes the error in log msg. (#134922)
Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-04-09 10:23:48 -04:00
Matt Arsenault
d99cdd7fba MachineRegisterInfo: Remove trailing whitespace 2025-04-09 16:09:24 +02:00
Zhaoxuan Jiang
e24c9e7a0c
[IR] improve hashing quality for ValueInfo (#132917)
The current hashing quality for `ValueInfo` is poor because it uses
pointers as the hash value, which can negatively impact performance in
various places that use a `DenseSet`/`Map` of `ValueInfo`. In one
observed case, `ModuleSummaryIndex::propagateAttributes()` was taking
about 25 minutes to complete on a ThinLTO application. Profiling
revealed that the majority of this time was spent operating on the
`MarkedNonReadWriteOnly` set.

With the improved hashing, the execution time for `propagateAttributes`
is dramatically reduced to less than 10 seconds.
2025-04-09 06:44:35 -07:00
Nico Weber
4f64da1495 [gn build] Port 750da48b4aa5
The .h removals was done by the sync script. I manually cleaned up
the remaining removals based on the output of

    git show 750da48b4aa52f libcxx/include/CMakeLists.txt | rg '^- ' | rg -v '\.'
2025-04-09 09:23:11 -04:00
Yaxun (Sam) Liu
d54c28b9c1
[HIP] use offload wrapper for non-device-only non-rdc (#132869)
Currently HIP still uses offload bundler for non-rdc mode for the new
offload driver.

This patch switches to use offload wrapper for non-device-only non-rdc
mode when new offload driver is enabled.

This makes the rdc and non-rdc compilation more consistent and speeds up
compilation since the offload wrapper supports parallel compilation for
different GPU arch's.

It is implemented by adding a linker wrapper action for each assemble
action of input file. Linker wrapper action differentiates this special
type of work vs normal linker wrapper work by the fle type. This type of
work results in object instead of image. The linker wrapper adds "-r"
for it and only includes the object file as input, not the host
libraries.

For device-only non-RDC mode, the new driver keeps the original
behavior.
2025-04-09 09:13:21 -04:00
Erich Keane
6e7c40b83d
[OpenACC][CIR] Initial patch to do OpenACC->IR lowering (#134936)
This patch adds some lowering code for Compute Constructs, plus the
infrastructure to someday do clauses. Doing this requires adding the
dialect to the CIRGenerator.

This patch does not however implement/correctly initialize lowering from
OpenACC-Dialect to anything lower however.
2025-04-09 06:05:31 -07:00
Nikolas Klauser
750da48b4a
[libc++][C++03] Remove headers which don't provide anything (#134044)
This patch removes all of the frozen headers which don't provide
anything. Basically any header that's C++11-or-later is removed from the
frozen headers.

This is part of
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
2025-04-09 15:00:46 +02:00
Asher Mancinelli
e42f860985
[flang][nfc] Support volatility in Fir ops (#134858)
Part two of merging #132486. Support volatility in fir ops.

* Introduce a new operation fir.volatile_cast, whose only purpose is to
add or take away the volatility of an SSA value's type. The types must
be otherwise identical, and any other type conversions must be handled
by fir.convert. fir.convert will give an error if the volatility of the
inputs does not match, such that all changes to volatility must be
handled explicitly through fir.volatile_cast.
* Add memory effects to ops that read from or write to memory. The
precedent for this comes from the LLVM dialect (feb7beaf70) where
llvm.load/store ops with the volatile attribute report read/write
effects to a generic memory resource. This change is similar in spirit
but different in two ways: the volatility of an operation is determined
by the type of its memref, not an attribute on the op, and the memory
effects of a load- or store-like operation on a volatile reference type
are reported against a particular memory resource,
`VolatileMemoryResource`. This is so MLIR optimizations are able to
reorder operations that are not volatile around operations that are,
which we believe more precisely models LLVM's volatile memory semantics.
@vzakhari suggested this in #132486 citing LangRef. See
https://llvm.org/docs/LangRef.html#volatile-memory-accesses

Changes needed to generate IR with volatile types are not included in
this change, so it should be non-functional, containing only the changes
to Fir ops and op utilities that will be needed once we enable lowering
to generate volatile types.
2025-04-09 05:55:24 -07:00
David Spickett
aff139777e
Revert "[AArch64][SVE] Pair SVE fill/spill into LDP/STP with -msve-vector-bits=128." (#134997)
Reverts llvm/llvm-project#134068

Caused a stage 2 build failure:
https://lab.llvm.org/buildbot/#/builders/41/builds/6016

```
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o 
/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage1.install/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage2/lib/Support -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/lib/Support -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage2/include -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/include -mcpu=neoverse-512tvb -mllvm -scalable-vectorization=preferred -mllvm -treat-scalable-fixed-error-as-warning=false -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror=global-constructors -O3 -DNDEBUG -std=c++17 -UNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/lib/Support/Caching.cpp
Opcode has unknown scale!
UNREACHABLE executed at ../llvm/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:4530!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage1.install/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage2/lib/Support -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/lib/Support -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage2/include -I/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/include -mcpu=neoverse-512tvb -mllvm -scalable-vectorization=preferred -mllvm -treat-scalable-fixed-error-as-warning=false -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror=global-constructors -O3 -DNDEBUG -std=c++17 -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Caching.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/lib/Support/Caching.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/llvm/llvm/lib/Support/Caching.cpp'.
4.	Running pass 'AArch64 load / store optimization pass' on function '@"_ZNSt17_Function_handlerIFN4llvm8ExpectedISt8functionIFNS1_ISt10unique_ptrINS0_16CachedFileStreamESt14default_deleteIS4_EEEEjRKNS0_5TwineEEEEEjNS0_9StringRefESB_EZNS0_10localCacheESB_SB_SB_S2_IFvjSB_S3_INS0_12MemoryBufferES5_ISH_EEEEE3$_0E9_M_invokeERKSt9_Any_dataOjOSF_SB_"'
 #0 0x0000b6eae9b67bf0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage1.install/bin/clang+++0x81c7bf0)
 #1 0x0000b6eae9b65aec llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage1.install/bin/clang+++0x81c5aec)
 #2 0x0000b6eae9acd5f4 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000f16c1aff28f8 (linux-vdso.so.1+0x8f8)
 #4 0x0000f16c1aacf1f0 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x0000f16c1aa8a67c gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #6 0x0000f16c1aa77130 abort ./stdlib/abort.c:81:7
 #7 0x0000b6eae9ad6628 (/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage1.install/bin/clang+++0x8136628)
 #8 0x0000b6eae72e95a8 (/home/tcwg-buildbot/worker/clang-aarch64-sve-vla-2stage/stage1.install/bin/clang+++0x59495a8)
 #9 0x0000b6eae74ca9a8 (anonymous namespace)::AArch64LoadStoreOpt::findMatchingInsn(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, (anonymous namespace)::LdStPairFlags&, unsigned int, bool) AArch64LoadStoreOptimizer.cpp:0:0
#10 0x0000b6eae74c85a8 (anonymous namespace)::AArch64LoadStoreOpt::tryToPairLdStInst(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) AArch64LoadStoreOptimizer.cpp:0:0
#11 0x0000b6eae74c624c (anonymous namespace)::AArch64LoadStoreOpt::optimizeBlock(llvm::MachineBasicBlock&, bool) AArch64LoadStoreOptimizer.cpp:0:0
#12 0x0000b6eae74c429c (anonymous namespace)::AArch64LoadStoreOpt::runOnMachineFunction(llvm::MachineFunction&) AArch64LoadStoreOptimizer.cpp:0:0
```
2025-04-09 13:30:34 +01:00
David Spickett
a29be9f28e
Revert "[LLDB] Refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies" (#134995)
Reverts llvm/llvm-project#132274

Broke a test on LLDB Widows on Arm:
https://lab.llvm.org/buildbot/#/builders/141/builds/7726
```
FAIL: test_dwarf (lldbsuite.test.lldbtest.TestExternCSymbols.test_dwarf)
<...>
    self.assertTrue(self.res.Succeeded(), msg + output)

AssertionError: False is not true : Command 'expression -- foo()' did not return successfully

Error output:

error: Couldn't look up symbols:

  int foo(void)

Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler.
```
2025-04-09 13:16:23 +01:00
Matt Arsenault
258aa65197
ValueTracking: Do not look at users of constants for ephemeral values (#134618) 2025-04-09 19:15:16 +07:00
alex-t
bc09c74055
[AMDGPU] Fix for ControlFlowUtils reconnectPHIs. (#132954)
Description: reconnectPHIs must consider self-loops to avoid PHI income
pair that does not exists anymore.
2025-04-09 13:58:33 +02:00
Simon Pilgrim
747214e59b
[X86] getFauxShuffleMask - OR(BITCAST(SHUFFLE()),BITCAST(SHUFFLE())) patterns should return bitcasted source values (#134993)
Noticed while investigating #133947 regressions - if we peek through
bitcasts we can lose track of oneuse/combined nodes in shuffle combining

Currently the same codegen as combineX86ShufflesRecursively still peeks
through the bitcasts itself, but we will soon handle this consistently
as another part of #133947
2025-04-09 12:54:16 +01:00
Simon Pilgrim
2896bbe148 [X86] getFauxShuffleMask - use std::iota for insert_subvector shuffle mask population. NFC. 2025-04-09 12:51:49 +01:00
Stephen Tozer
a6edaeb824
[DebugInfo][TailCallElim] Use ret DILocation for return value selects (#134825)
In TailRecursionElimination we may insert a select before the return to
choose the return value if necessary; this select is effectively part of
the return statement, and so should use its DILocation.

Found using https://github.com/llvm/llvm-project/pull/107279.
2025-04-09 12:48:59 +01:00
Timm Baeder
78c86b38b0
[clang][bytecode][NFC] Avoid implicit integer conversion (#134983)
See discussion in https://github.com/llvm/llvm-project/pull/134672
2025-04-09 13:44:24 +02:00
Sergio Afonso
0de48de36e
[MLIR][OpenMP] Improve loop wrapper op verifiers (#134833)
This patch revisits op verifiers for `LoopWrapperInterface` operations
to improve consistency across operations and to properly cover some
previously misreported cases.

Checks that should be done for these kinds of operations are documented
in the interface description.
2025-04-09 12:36:07 +01:00
Ricardo Jesus
c80080ff7e
[AArch64][SVE] Pair SVE fill/spill into LDP/STP with -msve-vector-bits=128. (#134068)
When compiling with -msve-vector-bits=128 or vscale_range(1, 1) and when
the offsets allow it, we can pair SVE LDR/STR instructions into Neon
LDP/STP.

For example, given:
```cpp
#include <arm_sve.h>

void foo(double const *ldp, double *stp) {
  svbool_t pg = svptrue_b64();
  svfloat64_t ld1 = svld1_f64(pg, ldp);
  svfloat64_t ld2 = svld1_f64(pg, ldp+svcntd());
  svst1_f64(pg, stp, ld1);
  svst1_f64(pg, stp+svcntd(), ld2);
}
```

When compiled with `-msve-vector-bits=128`, we currently generate:
```gas
foo:
        ldr     z0, [x0]
        ldr     z1, [x0, #1, mul vl]
        str     z0, [x1]
        str     z1, [x1, #1, mul vl]
        ret
```

With this patch, we instead generate:
```gas
foo:
        ldp     q0, q1, [x0]
        stp     q0, q1, [x1]
        ret
```

This is an alternative, more targetted approach to #127500.
2025-04-09 12:19:17 +01:00
Akshat Oke
2f6b06b264
[CodeGen][NPM] Port PostRAHazardRecognizer to NPM (#130066) 2025-04-09 16:36:22 +05:30
Fraser Cormack
949bf518fc [libclc][NFC] Fix up inconsistent copyright headers
Some files were accidentally given two copyright headers. Another was
missing one. This commit also converts that file's dos line endings to
unix ones and reformats a comment.
2025-04-09 12:00:08 +01:00
Simon Pilgrim
74f69c49fe
[X86] SimplifyDemandedVectorEltsForTargetNode - reduce the size of VPERMV v16f32/v16i32 nodes if the upper elements are not demanded (#134890)
Missed in #133923 - even without AVX512VL, we can replace VPERMV v16f32/v16i32 nodes with the AVX2 v8f32/v8i32 equivalents.
2025-04-09 11:14:38 +01:00
NimishMishra
53fa92dcad
[mlir][llvm][OpenMP] Hoist __atomic_load alloca (#132888)
Current implementation of `__atomic_compare_exchange` uses an alloca for
`__atomic_load`, leading to issues like
https://github.com/llvm/llvm-project/issues/120724. This PR hoists this
alloca to `AllocaIP`.


Fixes: https://github.com/llvm/llvm-project/issues/120724
2025-04-09 03:01:44 -07:00
David Sherwood
712c21336f
[AArch64] Enable unrolling for small multi-exit loops (#131998)
It can be highly beneficial to unroll small, two-block search loops
that look for a value in an array. An example of this would be
something that uses std::find to find a value in libc++. Older
versions of std::find in the libstdc++ headers are manually unrolled
in the source code, but this might change in newer releases where
the compiler is expected to either vectorise or unroll itself.
2025-04-09 10:34:27 +01:00
Stefan Schmidt
08e080ee98
[X86][SSE] Don't emit SSE2 load instructions in SSE1-only mode (#134547)
This fixes a regression I traced back to
8b43c1be23
/ https://github.com/llvm/llvm-project/pull/79000

The regression caused an SSE2 instruction, `movsd`, to be emitted as a
replacement for an SSE instruction, `movaps` despite the target
potentially not supporting this instruction, such as when building with
clang using `-march=pentium3`.

Fixes #134607
2025-04-09 10:19:26 +01:00
Pavel Labath
ea7dd70b53
[lldb] Remove unused UnwindPlan functions (#134630)
`GetLSDAAddress` and `GetPersonalityRoutinePtrAddress` are unused and
they create a bit of a problem for discontinuous functions, because the
unwind plan for these consists of multiple eh_frame descriptors and (at
least in theory) each of them could have a different value for these
entities.

We could say we only support functions for which these are always the
same, or create some sort of a Address2LSDA lookup map, but I think it's
better to leave this question to someone who actually needs this.
2025-04-09 11:04:45 +02:00
Luke Hutton
20d1888cbe
[mlir][tosa] Update the description of rescale and variable ops (#134815)
Updates the description to align with the specification. Also includes
some small cleanup to `sigmoid`, to avoid confusion.

Signed-off-by: Luke Hutton <luke.hutton@arm.com>
2025-04-09 10:01:16 +01:00
yingopq
8877b913ae
[LLDB][MIPS] Fix signal SIGBUS number mismatch error on mips target (#132688)
Now, because we do not support mips debugging, if we compile LLVM on
mips target, would report error `static assertion failed:Value mismatch
for signal number SIGBUS`, so add this condition to avoid error.
2025-04-09 10:53:47 +02:00
Steffen Larsen
f04bfbc416
[SPIRV] Support for SPV_INTEL_ternary_bitwise_function (#134866)
Adds support for the SPV_INTEL_ternary_bitwise_function extension,
adding;
* the OpBitwiseFunctionINTEL SPIR-V instruction, a ternary bitwise
function where the operation performed is determined by a look-up table
index,
 * and the corresponding TernaryBitwiseFunctionINTEL capability.

See
https://github.khronos.org/SPIRV-Registry/extensions/INTEL/SPV_INTEL_ternary_bitwise_function.html.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
2025-04-09 10:02:43 +02:00
LLVM GN Syncbot
f46d6412eb [gn build] Port 96f95c9d89d8 2025-04-09 06:42:26 +00:00
Fangrui Song
c46be969f0 [MC] Optimize isInSection
Remove one call of getFragment. The `SetUsed` bit isn't need here.
2025-04-08 23:42:02 -07:00
Madhur Amilkanthwar
a54ad59113
Revert "[llvm-exegesis][AArch64] Disable pauth and ldgm as unsupporte… (#134971)
…d instructions (#132346)"

This reverts commit 559540dc2738af0ab3f0b48eb4993095b8a8c627 as it has
cause build failures in llvm-clang-x86_64-gcc-ubuntu
2025-04-09 12:00:34 +05:30
Chaitanya
523e249a6a
[AMDGPU] Lower LDS in functions without sanitize_address in amdgpu-sw-lower-lds. (#131147)
Background:
"amdgpu-sw-lower-lds" pass lowers LDS accesses based on
"sanitize_address" attribute being tagged to kernel or non-kernels.
"amdgpu-sw-lower-lds" pass ideally should either lower all LDS accesses
or should not lower any based on if asan is enabled.

Issue:
But there has been cases when instrumented and non instrumented bitcodes
are linked and this is leading to few LDS being lowered correctly while
others are not. This typically leads to below error in the subsequent
pass.
"Module cannot mix absolute and non-absolute LDS GVs"

Fix:
This patch fixes this issue, by checking if any kernels in module are
tagged with "sanitize_address" attribute and then lowers all the LDS
accesses in all other kernels and non-kernels even though they do not
have "sanitize_address" attribute.
2025-04-09 11:55:55 +05:30
Pavel Labath
e348173bef
Reapply "[lldb] Remove UnwindPlan::Row shared_ptrs" (#134821)
This reverts commit
48864a52ef,
reapplying d7cea2b187.
It also fixes the dangling
pointers caused by the previous version by creating copies of the Rows
in x86AssemblyInspectionEngine.
2025-04-09 08:22:15 +02:00
Piotr Fusik
e6e0f5f17a [RISCV][test] Add tests for subtraction if above threshold 2025-04-09 08:08:41 +02:00
Sudharsan Veeravalli
1d2f5ead05
[RISCV] Add symbol parsing support for Xqcili load large immediate instructions (#134581)
This patch adds support for parsing symbols in the Xqcili load large
immediate instructions. The 32 bit `qc.li` instructions uses the
`R_RISCV_QC_ABS20_U` relocation while the 48 bit `qc.e.li` instruction
uses the `R_RISCV_QC_E_32` relocation and the `InstFormatQC_EAI`
instruction format.

Vendor relocation support will be added in a later patch.
2025-04-08 22:56:26 -07:00
Sudharsan Veeravalli
9b8f5340dd
Improve readability of <Target>GenCompressionInstEmitter. NFC (#134834)
Use indent() instead of manually indenting the code in the
CompressInstEmitter.cpp. Also modify the current indentation in a few
places.
2025-04-09 11:15:14 +05:30
Craig Topper
154d360bf9 [RISCV] Avoid unnecessary MCOperand copies. NFC 2025-04-08 22:44:15 -07:00