[CIR] Handle lowering for most of Relative-Vtables (#247288)
This builds on previous patches, which move us towards the
relative-vtable implementation. This patch handles all of the lowering
except for:
1- buildVTablePointer, which is left as NYI. This is a touch more work
for C++ uses of RTTI types, so this will be done in a followup.
2- Some markers in CIRGen that need to be removed, but cannot be tested
properly due to the above.
This matches LLVM output every where I could find, so I believe this to
be correct for the cases we cover.
A follow-up patch will fix both of those, plus port the
relative-vtable-tests from classic.
Note that Claude helped heavily in generating this patch and tests.
[CIR] Implement loop-hint lowering (#247320)
Previous patches resulted in the loop hints making it to CIR, and this
patch handles the lowering. These are lowered similarly to Classic
Codegen with an attempt to make the checks/dependencies between them
'work' correctly.
This does NOT however handle 'parallel', which are both challenging for
other reasons. For parallel, this needs to get propagated to all of the
llvm-ir intructions inside of the loop: We probably want to introduce a
scope to handle this during flattening, and emit it conditionally based
on that.
[AMDGPU] Add an intrinsic and builtin to access the dispatch index
This PR adds an intrinsic (and corresponding builtin and MLIR
operation) for accessing the dispatch index on gfx12+, since it can be
needed in some low-level contexts.
AI disclosure: None, I did this by hand
[AMDGPU] Refactor wave ID intrinsic handling and expose a Clang builtin
This PR refactors how the architecture-provided wave ID on gfx12 is
exposed, including by generalizing its lowering in preparation for
adding a dispatch.index intrinsic.
This PR also annotates the wave-id intrinsic with `TargetFeatures`,
meaning that it no longer is a selection failure to use it on a target
without the architected SGPRs feature, but a failure earlier in the
pipeline.
In addition, this PR exposes this id as __builtin_amdgcn_wave_id() in
Clang, matching MLIR, and adds documentation that clarifies the
properties of the ID.
AI disclosure: None, I did this by hand
[SPIR-V] Merge duplicate constants into the dominating copy (#247244)
Entry block constants were replaced by copies from other blocks
NewPM does not verify after each pass, so the expensive_checks XFAIL for
this XPASSed
RuntimeLibcalls: Add SME attributes to the AArch64 SME support routines
SMEAttrs currently assumes these attributes based on the function
name. Add them to the function definition so this code can be cleaned
up in the future.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[lldb] Avoid repeated interrupts for multi-site breakpoint updates (#246807)
Creating, enabling, or disabling a breakpoint with multiple sites while
a remote inferior is running interrupts and resumes the inferior once
per site.
Hold the remote transport lock across the operation so LLDB can send the
individual breakpoint packets during a single interruption.
Before the patch:
```
(lldb) platform select remote-linux
(lldb) platform connect connect://127.0.0.1:1234
(lldb) file sample
(lldb) run
(lldb) br add name test
Breakpoint 1: 100 locations.
(lldb) stat dump
"totalBreakpointResolveTime": 9.633445,
[8 lines not shown]
[AMDGPU] NFC: Precommit test for blocking cycle coverage (#246074)
For an upcoming refactor of `getBlockingCycles` -- we were missing
coverage on some groups of BlockingCycles instructions
---------
Co-authored-by: Matt Arsenault <Matthew.Arsenault at amd.com>
[flang] Accept structure constructors omitting a component whose type has default initialization (#247370)
flang rejected a structure constructor that omits a non-pointer,
non-allocatable component of derived type.
This rejection is when the component has no initializer of
its own but its type has default initialization.
Here is an example:
type inner
integer :: x = 1
end type
type outer
type(inner) :: comp
end type
type(outer) :: v
v = outer() ! error: Structure constructor lacks a value for component
'comp'
According to the Fortran Standard, a component as shown in the above
[15 lines not shown]
[X86][ACEV1] Drop the fixed shape from the managed-RA intrinsics
Palette 2 fixes every ACE tile at 16 rows of 64 bytes, so the two
leading shape arguments were always 16 and 64, and X86TileConfig
already refused to write them into the descriptor. They reached the
binary as two unread movw.
Remove them from the 19 internal builtins and intrinsics, and give
the passes that asked for a ShapeT an ACE path, since ShapeT holds
MachineOperands and cannot hold a constant. MayLiveAcrossBlocks is
sized by a guess the ACE reload already outgrew, so grow it on
demand. The header API is unchanged.
[SystemZ][z/OS] Emit error when passing vector types without vector extension (#246407)
Currently, there is no ABI defined on z/OS for passing vector types when
the vector extension is disabled/not available. Emit an error message
for this case while we are working on extending the ABI.
This is a temporary measure until the ABI is defined.
---------
Co-authored-by: Kazu Hirata <kazu at google.com>
[mlir][SPIR-V] Add SPV_KHR_float_controls2 and FPFastMathDefault (#244569)
Let spirv.ExecutionModeId take type and constant operands, which
FPFastMathDefault needs, and rename the INTEL FPFastMathMode bits to KHR
names
[NFC][TargetMachine][MachineFunction] `getSubtarget` does not typecheck (#246465)
`getSubtarget<T>()` has not validated its return type since LLVM stopped
being built with RTTI.
[AMDGPU] Reject a non-VGPR src1 on DPP REV opcodes in the assembler (#243195)
DPP REV type opcodes apply DPP to src1, so src1 must be a VGPR. PR
#216835 stopped the DPP combiner folding into them, but the assembler
still accepted a non-VGPR src1.
Ref: PLAT-216290
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
[InstrProf][NVPTX] `.` -> `_` in var names for NVPTX's sake
This patch is another prerequisite for my attempt to resurrect
PR#143568 to extend GPU profiling support to NVIDIA GPU.
There are two closely related issues, which I encountered after
applying PR #143568 locally and running `clang -fprofile-generate
-fopenmp --offload-arch=native`. Both reproduced at -O0 while -O3
sometimes optimized away the problematic code.
Externally linked vars
-----------------------
For XSBench where I added `__attribute__((noinline)) static` to
`calculate_macro_xs`, clang produced:
```
ptxas Simulation-openmp-nvptx64-nvidia-cuda-sm_70.s, line 125; fatal : Parsing error near '.c_calculate_macro_xs': syntax error
ptxas fatal : Ptx assembly aborted due to errors
[49 lines not shown]
[CIR] Fix speculative vtable emission check for inline virtual functions (#245845)
hasAnyUnusedVirtualInlineFunction looked up each inline virtual function
as a cir::GlobalOp, which never matches a function, so every class
appeared to have an unemitted inline virtual and
canSpeculativelyEmitVTable always returned false. As a result CIR never
emitted available_externally vtables at -O1 and above, preventing LLVM
from devirtualizing calls whose target is known after inlining a
constructor. Look the entry up as a cir::FuncOp, matching classic
codegen.
[Sparc] Reject V9-only register names and fcmp forms on V8 (#247419)
When targeting V8, the assembler accepted the V9 names of %asr2-%asr6
(%ccr, %asi, %tick, %pc and %fprs), the JPS1 names of the other ASRs,
and the forms of the floating-point compares that name an %fcc
register. fcmps %fcc1, ... was encoded with the cc bits in a field that
is reserved on V8, and the disassembler decoded that encoding back as
the V9 form.
Reject all of these on V8 as GNU as does, and don't decode %fcc1-%fcc3
on V8.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[X86] isGuaranteedNotToBeUndefOrPoisonForTargetNode - add X86ISD::HADD/HSUB handling (#247764)
Use getHorizDemandedElts to determine the correct DemandedElts masks
Pulled out of #245048
[flang][OpenMP] Keep vectorizable innermost loop out of collapse (#236152)
On the host, collapsing all loops of a multi-index `do concurrent`
recomputes every index on each iteration and blocks vectorization of the
innermost loop. Leave the innermost loop out of the collapse when it is
likely to vectorize, unless the outer loops have constant bounds with
fewer than 64 iterations in total. Device mapping is unchanged.
[Sparc] Fix inline asm operands bound to %f32-%f62 (#247420)
An inline asm double operand bound to one of %f32-%f62 (D16-D31), as
in "{f32}" or "{d16}", hit an assertion in getCopyToParts. The generic
lookup returned the register in CanonicalFPRegs, which exists only for
the assembler and comes first in the register class list, and whose
first value type is f32. Use the allocatable class of the register
instead.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Bazel][Libc] Add info about char16_t.h to bazel build files. (#247770)
char16_t.h was added to character converter by PR 230434, but the Bazel
build files were not updated then.