Commit Graph

543161 Commits

Author SHA1 Message Date
Hemang Gadhavi
da0828b1e9 [lldb] Enable support for DWARF64 format handling (#145645)
This PR introduces support for the DWARF64 format, enabling handling of
64-bit DWARF sections as defined by the DWARF specification. The update
includes adjustments to header parsing and modification of form values
to accommodate 64-bit offsets and values.
Also Added the testcase to verify the DWARF64 format.
2025-07-01 18:35:40 +05:30
Erich Keane
857815f3fa [OpenACC][CIR] Implement 'rest' of update clause lowering (#146414)
This implements the async, wait, if, and if_present (as well as
    device_type, but that is a detail of async/wait) lowering. All of
these are implemented the same way they are for the compute constructs,
      so this is a pretty mild amount of changes.
2025-07-01 06:05:08 -07:00
Shivam Gupta
e44fbea0a1 [FunctionAttrs] Handle ConstantRange overflow in memset initializes inference (#145739)
Avoid constructing invalid ConstantRange when Offset + Length in memset
overflows signed 64-bit integer space. This prevents assertion failures
when inferring the initializes attribute.

Fixes #140345
2025-07-01 18:34:52 +05:30
Denzel-Brian Budii
3702d64801 [mlir] Reapply 141423 mlir-query combinators plus fix (#146156)
An uninitialized variable that caused a crash
(https://lab.llvm.org/buildbot/#/builders/164/builds/11004) was
identified using the memory analyzer, leading to the reversion of
https://github.com/llvm/llvm-project/pull/141423. This pull request
reapplies the previously reverted changes and includes the fix, which
has been tested locally following the steps at
https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild.

Note: the fix is included as part of the second commit
2025-07-01 15:03:17 +02:00
Benjamin Kramer
771ee8e387 [bazel] Add mising dependency for 698ec8c7ba 2025-07-01 15:02:41 +02:00
Simon Pilgrim
72f87d2d69 [DAG] canCreateUndefOrPoison - remove isGuaranteedNotToBeUndefOrPoison check for insert/extract vector element indices (#146514)
No longer necessary now that #146490 has landed
2025-07-01 14:01:54 +01:00
Rob Buis
524f090306 [alpha.webkit.UncountedCallArgsChecker] Treat CFEqual as a safe function (#146369)
CFEqual is a trivial function, so treat it as safe.
2025-07-01 13:57:53 +01:00
Timm Baeder
6731f151ea [clang][bytecode] Remove unused InRange function (#146509) 2025-07-01 14:42:00 +02:00
Mythreya
d9d9ab8698 [clang][CodeComplete] skip explicit obj param in code completion string (#146258)
Fixes clangd/clangd#2339
2025-07-01 08:33:56 -04:00
Nikita Popov
b8b7494551 [InstCombine] Rewrite multi-use GEPs when simplifying comparison (#146100)
We already do this when both sides are a GEP, but not if only one is.
This ensures that the offset arithmetic is not duplicated.
2025-07-01 14:26:47 +02:00
David Sherwood
9b13dfdfbc [LV] Use vscale for tuning to improve branch weight estimates (#144733)
In addBranchWeightToMiddleTerminator we attempt to add branch weights to
the middle block terminator. We pessimistically assume vscale=1, whereas
we can improve the estimate by using the value of vscale used for
tuning.
2025-07-01 13:23:38 +01:00
Sudharsan Veeravalli
15ab4bb5c8 [Hexagon] Implement shouldConvertConstantLoadToIntImm (#146452)
This will convert loads of constant strings to immediate values. Put
this behind a flag that is enabled by default so that we can toggle it
if need be.
2025-07-01 17:52:09 +05:30
Sudharsan Veeravalli
67b79468fb [RISCV] Factor out getKillRegState in copyPhysReg (NFC) (#146454)
This is used multiple times in the function.
2025-07-01 17:51:46 +05:30
Simon Pilgrim
89fe429262 [DAG] canCreateUndefOrPoison - remove isGuaranteedNotToBeUndefOrPoison check for shift nodes (#146502)
No longer necessary now that #146490 has landed - we still have the test coverage from #94145 that covers this.
2025-07-01 12:44:59 +01:00
Simon Pilgrim
56841565db [DAG] canCreateUndefOrPoison - add handling for CTTZ/CTLZ_ZERO_UNDEF nodes (#146501)
CTTZ/CTLZ_ZERO_UNDEF nodes can only create poison if the source value is zero - so check with isKnownNeverZero

Pulled out of #146361 and reapplied now that #146490 has landed.
2025-07-01 12:44:45 +01:00
Luke Lau
4a2fa0847f [VPlan] Support VPWidenIntOrFpInductionRecipes with EVL tail folding (#144666)
Following on from #118638, this handles widened induction variables with
EVL tail folding by setting the VF operand to be EVL, calculated in the
vector body.

We need to do this for correctness since with EVL tail folding the
number of elements processed in the penultimate iteration may not be VF,
but the runtime EVL, and we need take this into account when updating
the backedge value.

- Because the VF may now not be a live-in we need to move the insertion
point to just after the VFs definition
- We also need to avoid truncating it when it's the same size as the
step type, previously this wasn't a problem for live-ins.
- Also because the VF may be smaller than the IV type, since the EVL is
always i32, we may need to zext it.

On -march=rva23u64 -O3 we get 87.1% more loops vectorized on TSVC, and
42.8% more loops vectorized on SPEC CPU 2017
2025-07-01 12:29:24 +01:00
kd0608
a6339d0e58 [clang]Fix Handle structs exceeding 1EB size limit (#146032)
When declaring multiple arrays of 1 ExaByte in a struct, the offset can
exceed 2EB, causing incorrect struct size reporting (only 1EB). This fix
ensures an error is thrown, preventing the generation of incorrect
assembly. #60272
2025-07-01 16:48:41 +05:30
Yanzuo Liu
90e20d4f42 [Clang][Bytecode] Implement P1061 structured binding pack (#146474)
Other part of this feature was implemented by #121417.
2025-07-01 19:15:12 +08:00
Simon Pilgrim
fd46e409a9 [X86] detectZextAbsDiff - use m_SpecificVectorElementVT matcher. NFC. (#146498) 2025-07-01 11:59:37 +01:00
Henrich Lauko
37d30d9e21 [mlir][tblgen] Fix test definition names to reflect expected valid results (NFC) (#146243) 2025-07-01 12:37:06 +02:00
Kerry McLaughlin
6d6b36439f [Clang][AArch64] Move definitions of FP8 Neon loads & stores (#146352)
Moves the definitions of FP8 loads & stores so that they are guarded
by `ArchGuard = "defined(__aarch64__) || defined(__arm64ec__)"`
2025-07-01 11:33:15 +01:00
Hsiangkai Wang
f581ef5b66 [mlir][gpu] Add gpu.rotate operation (#142796)
Add gpu.rotate operation and a pattern to convert gpu.rotate to SPIR-V
OpGroupNonUniformRotateKHR.
2025-07-01 11:32:25 +01:00
Simon Pilgrim
a97826a13b [DAG] canCreateUndefOrPoison - explicitly state the AssertSext/Zext/Align/NoFPClass can create poison. NFC. (#146493)
This keeps getting forgotten (e.g. #66603) - so make a point of adding
it here to make it clear instead of relying on the implicit default of
returning true.
2025-07-01 11:31:47 +01:00
Henrich Lauko
43d2486e27 [mlir][tblgen] Fix region and successor references in custom directives (#146242)
Previously, references to regions and successors were incorrectly disallowed outside the top-level assembly form. This change enables the use of bound regions and successors as variables in custom directives.
2025-07-01 12:30:57 +02:00
Simon Pilgrim
4e30f8101e [DAG] visitFREEZE - remove isGuaranteedNotToBeUndefOrPoison assertion (#146490)
Although nice to have to prove the freeze can be moved, this can fail
immediately after freeze(op(...)) -> op(freeze(),freeze(),...) creation
if any of the new freeze nodes now prevents value tracking from seeing
through to the source values (e.g. shift amounts/element indices are in
bounds etc.).

This will allow us to remove the isGuaranteedNotToBeUndefOrPoison checks
inside canCreateUndefOrPoison that were discussed on #146361
2025-07-01 11:17:41 +01:00
Haojian Wu
2ee884a9db [clang-doc] Remove the unused clangd header.
This header seems to be included unintentionally.
2025-07-01 12:07:35 +02:00
Nikita Popov
8fe25f3071 [PowerPC] Remove chenzheng1030 from active maintainers (#145519)
chenzheng1030 has left IBM and no longer works on the PowerPC
backend. Move them from active to former maintainers.
2025-07-01 12:04:49 +02:00
David Spickett
cd60247a0f [llvm][docs] Document how to ask for things other than commit access (#146340)
This is the implicit process but useful to spell it out I think. To give
folks more confidence in asking.

Inspired by
https://discourse.llvm.org/t/request-github-issue-triage-permission-for-labeling-clang-issues/87126/1
2025-07-01 10:59:59 +01:00
Haojian Wu
5c08aeac85 [clang] Don't use raw source location in DeclarationName, NFC (#146412)
Converting back and forth for the source location raw encoding is
unnecessary.
2025-07-01 11:51:04 +02:00
Luke Hutton
698ec8c7ba [mlir][tosa] Require signless types in validation and add corresponding conversion pass (#144367)
Firstly, this commit requires that all types are signless in the strict
mode of the validation pass. This is because signless types on
operations are required by the TOSA specification. The "strict" mode in
the validation pass is the final check for TOSA conformance to the
specification, which can often be used for conversion to other formats.

In addition, a conversion pass `--tosa-convert-integer-type-to-signless`
is provided to allow a user to convert all integer types to signless.
The intention is that this pass can be run before the validation pass.
Following use of this pass, input/output information should be carried
independently by the user.
2025-07-01 10:29:53 +01:00
Sander de Smalen
cd10ded697 [Clang] Remove AArch64TargetInfo::setArchFeatures (#146107)
When compiling with `-march=armv9-a+nosve` we found that Clang still
defines the `__ARM_FEATURE_SVE2` macro, which is explicitly set in
`setArchFeatures` when compiling for armv9-a.

After some experimenting, I found out that the list of features passed
into `AArch64TargetInfo::handleTargetFeatures` has already been expanded
and takes into account `+no[feature]` and has already expanded features
like `armv9-a`.

From that I conclude that `setArchFeatures` is no longer required.
2025-07-01 10:20:40 +01:00
Jim Lin
a6bb895efe [RISCV] Fix typo in header of llvm/test/CodeGen/RISCV/rvv/select-fp.ll. NFC.
I believe that the second and third llc tests in the header tend to use
zvfhmin extension rather than zvfh; otherwise, they would be duplicates.
2025-07-01 17:09:37 +08:00
Ricardo Jesus
84c849e85b [InstCombine] Combine interleaved recurrences. (#143878)
Combine sequences such as:
```llvm
  %pn1 = phi [init1, %BB1], [%op1, %BB2]
  %pn2 = phi [init2, %BB1], [%op2, %BB2]
  %op1 = binop %pn1, constant1
  %op2 = binop %pn2, constant2
  %rdx = binop %op1, %op2
```
Into:
```llvm
  %phi_combined = phi [init_combined, %BB1], [%op_combined, %BB2]
  %rdx_combined = binop %phi_combined, constant_combined
```

This allows us to simplify interleaved reductions, for example as
introduced by the loop vectorizer.

The anecdotal example for this is the loop below:
```c
float foo() {
  float q = 1.f;
  for (int i = 0; i < 1000; ++i)
    q *= .99f;
  return q;
}
```
Which currently gets lowered explicitly such as (on AArch64,
interleaved by four):
```gas
.LBB0_1:
  fmul    v0.4s, v0.4s, v1.4s
  fmul    v2.4s, v2.4s, v1.4s
  fmul    v3.4s, v3.4s, v1.4s
  fmul    v4.4s, v4.4s, v1.4s
  subs    w8, w8, #32
  b.ne    .LBB0_1
```
But with this patch lowers trivially:
```gas
foo:
  mov     w8, #5028
  movk    w8, #14389, lsl #16
  fmov    s0, w8
  ret
```
2025-07-01 09:54:38 +01:00
Nikita Popov
102c22cb2c [FatLTO] Disable analysis verification in pipeline test (NFC)
To fix test failure with expensive checks reports at:
https://github.com/llvm/llvm-project/pull/146048#issuecomment-3022421122
2025-07-01 10:47:23 +02:00
Nikita Popov
5fa4eb1dfd [Clang] Verify data layout consistency (#144720)
Verify that the alignments specified by clang TargetInfo match the
alignments specified by LLVM data layout, which will hopefully prevent
accidental mismatches in the future.

This currently contains opt-outs for a number of of existing mismatches.

I'm also skipping the verification if options like `-malign-double` are
used, or a language that mandates sizes/alignments that differ from C.

The verification happens in CodeGen, as we can't have an IR dependency
in Basic.
2025-07-01 10:43:40 +02:00
Jim Lin
cb80651091 [RISCV] Merge AllBFloatVectors into AllFloatVectors. NFC. 2025-07-01 16:21:41 +08:00
Jim Lin
b5f4fd03c2 [RISCV] Remove unused variable AllFloatVectorsExceptFP16. NFC. 2025-07-01 16:21:41 +08:00
Simon Pilgrim
67be4fe3d5 Fix MSVC implicit double -> float truncation warning. NFC. 2025-07-01 08:48:16 +01:00
Zakk Chen
3cc200f46b DynamicAPInt: Support APInt constructor. (#146301)
This PR introduces a constructor for `DynamicAPInt` that takes an
`APInt` object as input to simplifies the creation of a large numbers.
2025-07-01 15:44:12 +08:00
Jack Styles
65cb0eae58 [Flang][OpenMP] Add Semantics support for Nested OpenMPLoopConstructs (#145917)
In OpenMP Version 5.1, the tile and unroll directives were added. When
using these directives, it is possible to nest them within other OpenMP
Loop Constructs. This patch enables the semantics to allow for this
behaviour on these specific directives. Any nested loops will be stored
within the initial Loop Construct until reaching the DoConstruct itself.

Relevant tests have been added, and previous behaviour has been retained
with no changes.

See also, #110008
2025-07-01 08:39:15 +01:00
Simon Pilgrim
372e332a57 [X86] freeze-unary.ll - remove unnecessary freeze from CTLZ/CTTZ_ZERO_UNDEF tests 2025-07-01 08:32:28 +01:00
Nikita Popov
ab6316e219 [Coroutines] Work on intrinsic IDs instead of names (NFCI) (#145518)
For the checks whether certain intrinsics are used, work with intrinsic
IDs instead of intrinsic names.

This also exposes that some of the checks were incorrect, because the
intrinsics were overloaded. There is no efficient way to determine
whether these are used. This change explicitly documents which
intrinsics are not checked for this reason.
2025-07-01 09:22:23 +02:00
Fangrui Song
9beb467d92 MC: Store fragment content and fixups out-of-line
Moved `Contents` and `Fixups` SmallVector storage to MCSection, enabling
trivial destructors for most fragment subclasses and eliminating the need
for MCFragment::destroy in ~MCSection.

For appending content to the current section, use
getContentsForAppending. During assembler relaxation, prefer
setContents/setFixups, which may involve copying and reduce the benefits
of https://reviews.llvm.org/D145791.

Moving only Contents out-of-line caused a slight performance regression
(Alexis Engelke's 2024 prototype). By also moving Fragments out-of-line,
fragment destructors become trivial, resulting in
neglgible instructions:u increase for "stage2-O0-g" and [large max-rss decrease](https://llvm-compile-time-tracker.com/compare.php?from=84e82746c3ff63ec23a8b85e9efd4f7fccf92590&to=555a28c0b2f8250a9cf86fd267a04b0460283e15&stat=max-rss&linkStats=on)
for the "stage1-ReleaseLTO-g (link only)" benchmark.
(
An older version using fewer inline functions: https://llvm-compile-time-tracker.com/compare.php?from=bb982e733cfcda7e4cfb0583544f68af65211ed1&to=f12d55f97c47717d438951ecddecf8ebd28c296b&linkStats=on
)

Now using plain SmallVector in MCSection for storage, with potential for
future allocator optimizations, such as allocating `Contents` as the
trailing object of MCDataFragment. (GNU Assembler uses gnulib's obstack
for fragment management.)

Co-authored-by: Alexis Engelke <engelke@in.tum.de>

Pull Request: https://github.com/llvm/llvm-project/pull/146307
2025-07-01 00:21:12 -07:00
Nikita Popov
7e830f7671 [Clang] Partially fix m68k alignments (#144740)
As the data layout a few lines further up specifies, the int, long and
pointer alignment should be 16 instead of the default of 32.

The long long alignment is also incorrect, but that would require a
change to the data layout as well.

Comparison with GCC, which consistently uses 2 byte alignment:
https://gcc.godbolt.org/z/K3x6a7dEf At least based on some spot checks,
the changes to bit field layout also make use match GCC now.

This was found by https://github.com/llvm/llvm-project/pull/144720.
2025-07-01 09:06:41 +02:00
Nikita Popov
c5e4546a01 [DwarfDebug] Slightly optimize computeKeyInstructions() (NFC) (#146357)
Fetch the DILocation once, instead of many times. This is pretty
trivial, but goes through out-of-line code.
2025-07-01 09:06:17 +02:00
Pavel Labath
72b40f7c64 [lldb] Delete unused DWARFDataExtractor methods (#146356)
They are left over from our previous attempt at DWARF64. The new attempt
is not using them, and they also don't have equivalents in the llvm
DWARFDataExtractor class.
2025-07-01 08:47:45 +02:00
Mahesh-Attarde
84e82746c3 [X86][llvm-exegesis] fix LNLP performance counter binding issue (#146348)
We added LNLP sched model recently, PFM counter bounding names needs to
match cpu string.
llvm-exegesis wont produce results without correct naming.

Co-authored-by: mattarde <mattarde@intel.com>
2025-07-01 10:29:23 +05:30
Fangrui Song
393aebf5c2 CodeView: Move MCCVDefRangeFragment storage to MCContext/MCFragment. NFC (#146462)
so that ~MCCVInlineLineTableFragment will become trivial when we
make ~MCEncodedFragment trivial (#146307).
2025-06-30 21:49:54 -07:00
Phoebe Wang
67b740bd73 [X86] Add diagnostic for fp128 inline assemble for 32-bit (#146458)
Suggested by Craig from #146259
2025-07-01 12:39:43 +08:00
Jason Molenda
e94c6091c9 [lldb][Mach-O] Fix several bugs in x86_64 Mach-O corefile (#146460)
reading, and one bug in the new RegisterContextUnifiedCore class.

The PR I landed a few days ago to allow Mach-O corefiles to augment
their registers with additional per-thread registers in metadata exposed
a few bugs in the x86_64 corefile reader when running under different CI
environments. It also showed a bug in my RegisterContextUnifiedCore
class where I wasn't properly handling lookups of unknown registers
(e.g. the LLDB_GENERIC_RA when debugging an intel target).

The Mach-O x86_64 corefile support would say that it had fpu & exc
registers available in every corefile, regardless of whether they were
actually present. It would only read the bytes for the first register
flavor in the LC_THREAD, the GPRs, but it read them incorrectly, so
sometimes you got more register context than you'd expect. The LC_THREAD
register context specifies a flavor and the number of uint32_t words;
the ObjectFileMachO method would read that number of uint64_t's,
exceeding the GPR register space, but it was followed by FPU and then
EXC register space so it didn't crash. If you had a corefile with GPR
and EXC register bytes, it would be written into the GPR and then FPU
register areas, with zeroes filling out the rest of the context.
2025-06-30 21:27:53 -07:00