Commit Graph

534791 Commits

Author SHA1 Message Date
Slava Zakharin
86a03367bf [flang] Support fir.pack_array in FIR alias analysis. (#131946)
`fir.pack_array` is just a pass-through op for the process
of finding the source in FIR alias analysis (as defined in #127147).
2025-04-21 08:59:41 -07:00
Mircea Trofin
93b74f7178 [ctxprof] Scale up everything under a root by its TotalRootEntryCount (#136015)
`TotalRootEntryCount` captures how many times that root was entered - regardless if a profile was also collected or not (profile collection for a given root happens on only one thread at a time).

We don't do this in compiler_rt because the goal there is to flush out the data as fast as possible, so traversing and multiplying vectors is punted to the profile user.

We really just need to do this when flattening the profile so that the values across roots and flat profiles match. We could do it earlier, too - like when loading the profile - but it seems beneficial (at least for debugging) to keep the counter values the same as the loaded ones. We can revisit this later.
2025-04-21 08:43:21 -07:00
Sarah Spall
52a5332a71 [HLSL] Make it possible to assign an array from a cbuffer (#134174)
Update Sema Checking to always do an HLSL Array RValue cast in the case
we are dealing with hlsl constant array types
Instead of comparing canonical types, compare canonical unqualified
types
Add a test to show it is possible to assign an array from a cbuffer.
Closes #133767
2025-04-21 08:18:56 -07:00
Rahul Joshi
e1bb7f6dde [LLVM][TableGen] Parameterize NumToSkip in DecoderEmitter (#136456)
- Add command line option `num-to-skip-size` to parameterize the size of
`NumToSkip` bytes in the decoder table. Default value will be 2, and
targets that need larger size can use 3.
- Keep all existing targets, except AArch64, to use size 2, and change
AArch64 to use size 3 since it run into the "disassembler decoding table
too large" error with size 2.
- Additional fixes on top of earlier revert: mark `decodeNumToSkip` as
static (not necessary anymore as the generated code is now in anonymous
namespace, but doing it for consistency) and incorporate Bazel build
changes from https://github.com/llvm/llvm-project/pull/136212
- Following is a rough reduction in size for the decoder tables by
switching to size 2.

```
Target         Old Size   New Size   % Reduction
================================================
AArch64           153254     153254        0.00
AMDGPU            471566     412805       12.46
ARC                 5724       5061       11.58
ARM                84936      73831       13.07
AVR                 1497       1306       12.76
BPF                 2172       1927       11.28
CSKY               10064       8692       13.63
Hexagon            47967      41965       12.51
Lanai               1108        982       11.37
LoongArch          24446      21621       11.56
MSP430              4200       3716       11.52
Mips               36330      31415       13.53
PPC                31897      28098       11.91
RISCV              37979      32790       13.66
Sparc               8331       7252       12.95
SystemZ            36722      32248       12.18
VE                 48296      42873       11.23
XCore               2590       2316       10.58
Xtensa              3827       3316       13.35
```
2025-04-21 08:15:08 -07:00
Kazu Hirata
cfc2b0d094 [llvm] Use llvm::SmallVector::pop_back_val (NFC) (#136533) 2025-04-21 08:13:16 -07:00
Oleksandr T.
08b0c2517e [Clang] disallow use of attributes before extern template declarations (#136328)
Fixes #79893 


--- 

This PR addresses the issue of _attributes_ being incorrectly allowed on
`extern template` declarations

```cpp
[[deprecated]] extern template struct S<int>;
```
2025-04-21 18:12:07 +03:00
Michael Liao
1cb82ff9cd [clang][CIR] Fix various warnings. NFC
- Fix various warnings including '-Wparentheses', '-Wunused-variable',
  and '-Wreturn-type'.
2025-04-21 10:52:23 -04:00
Nico Weber
e18a77cfbe Revert "[SelectionDAG] Folding ZERO-EXTEND/SIGN_EXTEND poison to Poison value in getNode (#122741)"
This reverts commit f12078e726.

Breaks `check-llvm`, see comments on https://github.com/llvm/llvm-project/pull/122741
2025-04-21 10:51:03 -04:00
Farzon Lotfi
111af76bd7 [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (#136234)
fixes #135654

In #128613 we added safe guards to prevent the lowering of just any
intrinsic in the backend. We used `DiagnosticInfoUnsupported` to do
this.

What we found was when using `opt` the diagnostic print function was
called but when using clang the diagnostic message was used.

Printing message in the clang version means we miss valuable debugging
information like function name and function type when LLVMContext was
only needed to call `getBestLocationFromDebugLoc`.

There are a few potential fixes

1. Write a custom DiagnosticInfoUnsupported so we can change the Message
just for DirectX. Too heavy handed so rejected.

2. Add the function name to the Message in DirectX code. Very simple one
line change. Downside is when using opt you see the function name twice.
But makes the clang-dxc bugs more actionable.

3. change CodeGenAction.cpp to always use the print function and not the
message directly. Downside is a bunch of innacurate information shows up
in the message if you don't specify `-debug-info-kind=standalone`.

4. add some book keeping to know which function called the intrinsic
keep a map of these so we can pass the calling function to
`DiagnosticInfoUnsupported` instead of the intrinsic. This would only be
useful if we had debug info so we could distinguish different uses of
the intrinsic by line\col number. We would also need to change from
iterating on every function to doing something like a LazyCallGraph
which is a nonstarter.

5. pick a different means of doing a Diagnostic error, because other
uses of `DiagnosticInfoUnsupported` error when we are in the body of a
function not when we see one being used like in the intrinsic case.

This PR went with a combo of option 2 & 5. Its low code change that also
only impacts the DirectX backend.
2025-04-21 10:26:27 -04:00
zhijian lin
f12078e726 [SelectionDAG] Folding ZERO-EXTEND/SIGN_EXTEND poison to Poison value in getNode (#122741)
The PR will fix the issue
https://github.com/llvm/llvm-project/issues/122728

This patch addresses the signed/zero extension of poison by using a
poison value of the extended type instead of a constant zero of the
extended type.
2025-04-21 10:02:21 -04:00
Simon Pilgrim
788b50a438 [X86] Add test coverage for #136368 2025-04-21 13:24:20 +01:00
Christudasan Devadasan
940108b24d [AMDGPU][NewPM] Make the pass flow consistent with the legacy pipeline. (#136551) 2025-04-21 15:34:15 +05:30
Liao Chunyu
c347ad21ab [RISCV][NFC] Delete RISCVAsmParser::parsePseudoQCJumpSymbol (#136552)
fix, warning:
RISCVAsmParser::parsePseudoQCJumpSymbol(llvm::OperandVector&)’ defined
but not used [-Wunused-function]
2025-04-21 17:51:57 +08:00
AZero13
47ca7f1cce [X86] Remove unused BitVector TILERegs (NFC) (#136508)
It is not used.
2025-04-21 09:47:01 +01:00
Matthias Springer
6423c901fd [mlir][LLVM][NFC] Avoid rollback in FuncOp --> LLVM lowering (#136477)
This pattern used to create an `llvm.func` op, then check additional
requirements and return "failure". This commit moves the checks before
the creation of the replacement op, so that no rollback is necessary
when one of the checks fails.

Note: This is in preparation of the One-Shot Dialect Conversion
refactoring, which removes the rollback functionality.
2025-04-21 10:38:49 +02:00
Luke Lau
053451cb35 [RISCV] Handle scalarized reductions in getArithmeticReductionCost
This fixes a crash reported at
https://github.com/llvm/llvm-project/pull/114250#issuecomment-2813686061

If the vector type isn't legal at all, e.g. bfloat with +zvfbfmin,
then the legalized type will be scalarized. So use getScalarType()
instead of getVectorElement() when checking for f16/bf16.
2025-04-21 16:07:15 +08:00
tangaac
4853bf0956 [LoongArch] Lower build_vector to broadcast load if possible (#135896) 2025-04-21 16:04:28 +08:00
Ryotaro Kasuga
b6820c35c5 [MachinePipeliner] Remove UB from tests (NFC) (#123169)
This patch removes UB from some tests for MachinePipeliner. This patch
fixes following cases.

- Branching on an `undef` value.
- Using `undef`/`null` as a pointer operand of a load/store.

There are other tests of pipeliner that contain the same UB, but for
now, this patch fixes particularly unstable cases when I developed
pipeliner.
2025-04-21 16:12:25 +09:00
Henrich Lauko
050ca5e270 [CIR][NFC] Simplify BoolAttr builders (#136366)
This mirrors incubator changes from https://github.com/llvm/clangir/pull/1572
2025-04-21 09:07:57 +02:00
Tongsheng Wu
8435de0916 [clangd] Print include spelling in IncludeCleaner error message (#136237) 2025-04-21 02:09:51 -04:00
David Green
2ba455ff3d [AArch64] Add CostKind to getSpliceCost (#135537)
This likely does not alter much yet with how the costs are used. Like
other cost functions the CostKind should be passed into and through the
function.
2025-04-21 06:31:03 +01:00
David Green
e183459b8b [CostModel] Make sure getCmpSelInstrCost is passed a CondTy (#135535)
It is already required along certain code paths that the CondTy is
valid. Fix some of the uses to make sure it is passed.
2025-04-21 05:33:30 +01:00
Jim Lin
f024aab844 [RISCV] Remove the TODO that lbu and lhu should be selected to avoid the unnecessary masking. NFC.
RISCVTargetLowering::isZExtFree has been implemented in
15e894baee.
2025-04-21 11:02:04 +08:00
Kazu Hirata
2ba20c52e4 [lldb] Use llvm::unique (NFC) (#136527) 2025-04-20 19:59:37 -07:00
Kazu Hirata
6274442f8c [clangd] Call hash_combine_range with a range (NFC) (#136526) 2025-04-20 19:59:28 -07:00
Kazu Hirata
02b55d2b78 [AST] Call hash_combine_range with a range (NFC) (#136525) 2025-04-20 19:59:19 -07:00
Kazu Hirata
a8644b3d88 [BOLT] Call hash_combine_range with ranges (NFC) (#136524) 2025-04-20 19:41:26 -07:00
Jonas Devlieghere
f86953c733 [docs] Correct my email address 2025-04-20 19:35:56 -07:00
Phoebe Wang
ddee2d8559 [X86][APX] Combine (X86Sub 0, AND(X, Y)) to (X86And X, Y) for CLOAD/CSTORE (#136429)
https://godbolt.org/z/TsWochrbf
2025-04-21 10:07:45 +08:00
Chyaka
0e3e0bf42c [RISCV] Add processor definition for XiangShan-KunMingHu-V2R2 (#123193)
XiangShan-KunMingHu is the third generation of Open-source
high-performance RISC-V processor developed by Beijing Institute of Open
Source Chip (BOSC) , and its latest version is V2R2.

The KunMingHu manual is now available at
https://github.com/OpenXiangShan/XiangShan-User-Guide/releases.
It will be updated on the official XiangShan documentation site:
https://docs.xiangshan.cc/zh-cn/latest

You can find the corresponding ISA extension from the XiangShan Github
repository:
https://github.com/OpenXiangShan/XiangShan/blob/master/src/main/scala/xiangshan/Parameters.scala

If you want to track the latest performance data of KunMingHu, please
check XiangShan Biweekly: https://docs.xiangshan.cc/zh-cn/latest/blog

This PR adds the processor definition for KunMingHu V2R2, developed by
the XSCC team https://github.com/orgs/OpenXiangShan/teams/xscc.

The scheduling model for XiangShan-KunMingHu V2R2 will be submitted in a
subsequent PR.

---------

Co-authored-by: Shenglin Tang <tangshenglin@ict.ac.cn>
Co-authored-by: Xu, Zefan <ceba_robot@outlook.com>
Co-authored-by: Tang Haojin <tanghaojin@outlook.com>
2025-04-21 10:06:43 +08:00
Oliver Hunt
27653bdc49 Ensure bit-fields storing FPEvalMethodKind are wide enough to do so (#136515)
After landing #116760 we hit build failures due to existing fields
storing FPEvalMethodKind not being wide enough.
2025-04-20 18:42:09 -07:00
Kazu Hirata
be48727b95 [clang-tools-extra] Use llvm::unique (NFC) (#136514) 2025-04-20 18:30:05 -07:00
Kazu Hirata
c6e7bb19f7 [BOLT] Use llvm::unique (NFC) (#136513) 2025-04-20 18:29:51 -07:00
Sergei Barannikov
b07d2e62c6 [Mips] Use helper class for emitting CFI instructions (NFCI) (#136242) 2025-04-21 04:21:37 +03:00
Kazu Hirata
5e834b9ec7 [mlir] Call hash_combine_range with ranges (NFC) (#136512) 2025-04-20 16:36:35 -07:00
Kazu Hirata
b01e25deba [llvm] Call hash_combine_range with ranges (NFC) (#136511) 2025-04-20 16:36:03 -07:00
Tristan Ross
f87109f018 [compiler-rt] allow building with uefi (#131499)
I'm trying to put together an LLVM built toolchain (including LLVM libc)
targeting UEFI, currently I get an error saying "Unknown target". This
PR enables compiling compiler-rt for UEFI.
2025-04-20 14:23:53 -07:00
Oliver Hunt
3ac1aa4c88 [Clang] Consider preferred_type in bitfield warnings (#116760) (#116785)
Very simply extends the bitfield sema checks for assignment to fields
with a preferred type specified to consider the preferred type if the
decl storage type is not explicitly an enum type.

This does mean that if the preferred and explicit types have different
storage requirements we may not warn in all possible cases, but that's a
scenario for which the warnings are much more complex and confusing.
2025-04-20 14:16:51 -07:00
Baranov Victor
842e591577 [clang-tidy][NFC] fix clang-tidy warnings in clang-tools-extra/clang-tidy directory (#136097)
Mostly stylistic changes to `clang-tidy` source code.

Command run:
`python3 clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -p build/
-j $(nproc) clang-tools-extra/clang-tidy`
2025-04-20 20:41:13 +02:00
Kazu Hirata
f0cc50cdc9 [ADT] Add hash_combine_range that takes a range (NFC) (#136459)
The new function will allow us to replace:

  hash_combine_range(Ops.begin(), Ops.end())

with:

  hash_combine_range(Ops)
2025-04-20 11:20:32 -07:00
Timm Baeder
ea3eb8d625 [clang][bytecode] Fix bos/bdos with non-zero offset applied (#136482)
Compute the offset from the record layout.
Unfortunately, not all the test cases from the current interpreter work.
2025-04-20 20:12:47 +02:00
Ely Ronnen
839f52147c [lldb-dap] fix inconsistent debugAdapterHostname argument name (#135544)
the argument is written as `debugAdapterHostname` in package.json but
used as `debugAdapterHost`
2025-04-20 08:33:28 -07:00
Fangyi Zhou
461168a3d3 [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr (#136041)
As reported in #135665, C++20 parenthesis initializer list expressions
are not handled correctly and were causing crashes. This commit attempts
to fix the issue by handing parenthesis initializer lists along side
existing initializer lists.

Fixes #135665.
2025-04-20 17:32:42 +02:00
Pavel Skripkin
060f9556a2 [clang][analyzer] Fix error path of builtin overflow (#136345)
According to
https://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins,
result of builtin_*_overflow functions will be initialized even in case
of overflow. Align analyzer logic to docs and always initialize 3rd
argument of such builtins.

Closes #136292
2025-04-20 16:14:41 +02:00
Florian Hahn
fc71b2c8db [VPlan] Get opcode from recipe in VPWidenMemRecipe::computeCost (NFC).
Remove some uses of the underlying ingredient by getting the opcode
directly via the recipe ID.
2025-04-20 14:25:32 +01:00
Matthias Springer
bb21a6819b [mlir][memref] Move AllocLikeConversion.h helpers into MemRefToLLVM.cpp (#136424)
This commit moves code around: The helper functions/classes are moved
into `MemRefToLLVM.cpp`. This simplifies the code a bit: fewer
templatized functions, fewer function calls, fewer lines of code.

This commit also moves checks in `matchAndRewrite` to the beginning of
the functions, such that patterns bail out (`return failure()`) before
starting to modify any IR. (Apart from that, this change is NFC.) This
is in preparation of the One-Shot Dialect Conversion refactoring, which
will disallow pattern rollbacks.
2025-04-20 12:35:47 +02:00
Timm Baeder
90c845fb3b [clang][bytecode] Start implementing __builtin_{,dynamic}_object_size (#136478) 2025-04-20 12:20:21 +02:00
Florian Hahn
366ff3a898 [VPlan] Get address space from inferred pointer type (NFC)
Remove a use of the underlying ingredient by getting the address space
from the inferred pointer type.
2025-04-20 10:38:30 +01:00
Matthias Springer
8553efd2e9 [mlir][LLVM] Add OpBuilder & to lookupOrCreateFn functions (#136421)
These functions are called from lowering patterns. All IR modifications
in a pattern must be performed through the provided rewriter, but these
functions used to instantiate a new `OpBuilder`, bypassing the provided
rewriter.
2025-04-20 10:06:22 +02:00
Christian Sigg
71037ee9de [llvm][bazel] Port 667209e451. 2025-04-20 07:56:05 +02:00