[LoongArch][MC] Add assembly syntax highlighting for LoongArch (#218946)
This PR adds color highlighting of registers and immediates in LoongArch
disassembly.
This is similar to #65853.
[RISCV] Andes: model fast unaligned accesses (#220756)
Mark the Andes 45 tuning profile as supporting efficient unaligned
scalar loads and stores. This lets fixed-size alignment-one copies lower
to scalar instructions instead of a memcpy call. On these in-order
cores, where performance is almost synonymous with instruction count,
this is a material win.
[AArch64] Form CCMP for CBB and CBH
AArch64ConditionalCompares forms CMP/CCMP chains to transform patterns
such as
Head Head
/ | CmpBB
/ | / |
| CmpBB => / |
| / | Tail |
| / | | |
Tail | | |
| | | |
... ... ... ...
where Head is terminated by a conditional branch and CmpBB contains
a cmp + conditional branch.
We usually try to split any fused conditional branches to be able to
[8 lines not shown]
[AArch64][CMPBR] Fix splitting of CBB/CBH instructions into ext + cmp
We falsely split CBB/CBH instructions by explicitly extending the
second register operand instead of the first one, leading to the
following, wrong codegen:
cbh $wn, $wm, cc, trgt => sxth $wt, $wm
cmp $wn, $wt, cc, sxth
Correct is
cbh $wn, $wm, cc, trgt => sxth $wt, $wn
cmp $wt, $wm, cc, sxth
since cmp with extended register extends it's second, not its first
operand.
[AArch64] Allow forming CCMPs for CB branches
AArch64ConditionalCompares currently doesn't consider FEAT_CMPBR CB
instructions when trying to form CCMPs. This leads to a lot more
branches which is usually hurtful for performance.
The patchs adds handling CB instructions, just like we do for other
fused conditional branches such as CBZ or CBNZ.
[mlir][openacc] Add isCompilerGenerated to GlobalVariableOpInterface (#221096)
This function is used to determine if a global is compiler generated or
coming from user variables. This is useful when determining the handling
of globals for unified memory mode.
[AArch64] Fix missing :lo12: on the catchret address pair (#219200)
`llc -mtriple=aarch64-pc-windows-msvc` emits assembly it cannot assemble
itself.
A function with a `catchret` materialises its continuation block like
this:
```asm
"?catch$2@?0?f at 4HA":
adrp x0, .LBB0_1
add x0, x0, .LBB0_1
ret
```
Pipe that back through `llvm-mc` and you get:
```
error: expected compatible register, symbol or integer in range [0, 4095]
add x0, x0, .LBB0_1
[43 lines not shown]
[clang][OpenMP] Add explicit default libomp value to test. (#221098)
The test OMPInvariantPredicateBoundOnIntraTileLoop, in AttrTest.cpp uses
'-fopenmp' without supplying an explcit value. In some places the
default value is 'libomp', which works just fine for this test. But in
envorinments where 'libomp' is not the default value (e.g. places that
use 'libgomp' by default) the test fails. This fixes that issue by
explicitly telling the test to use 'libomp'.
[mlir][gpu] Don't request C wrappers for private device functions (#214552)
GPU lowerings attach `llvm.emit_c_interface` to device functions
regardless of visibility. This causes private device functions to
receive external entry points and prevents such functions from being
culled by DCE.
On a real module lowered by a downstream compiler, we measured that
unconditional `llvm.emit_c_interface` inflated the generated PTX by 1.8x
by keeping unused private functions alive and by 7x for pipelines that
also give private functions internal linkage.
This change attaches `llvm.emit_c_interface` only to functions which are
not private for both the gpu->nvvm and gpu->rocdl lowerings. No behavior
change to existing unit tests, and new tests are added to witness the
new behavior for private functions.
Assisted-by: Claude Code
[DebugInfo] Ignore undefined constexpr constructors in constructor homing. (#218165)
The constructor homing optimization limits the amount of redundant debug
info generated for classes by only emitting forward declarations to
debug info in translation units that can't instantiate the class on
their own (i.e. they don't see the definitions of any constructors).
Currently, classes that have _any_ constexpr constructors are excluded
from the optimization. This is being changed to only exclude _defined_
constexpr constructors, as declared constexpr constructors are not
callable in a TU that doesn't see their definition.
Signed-off-by: Clayton Knittel <cknit1999 at gmail.com>
[ORC] Add host-jit-triple lit feature, gate some JIT tests (#220929)
The JIT does not support throwing exceptions on Darwin/arm64e yet. Add
an llvm-lit feature flag, "host-jit-triple", that reports the process
triple as detected by `lli` so that we can mark exception-throwing tests
as unsupported when they would be run as arm64e. (Feature flags based on
build settings, e.g. host-triple and target-triple, don't reliably
report arm64e).
Adds a -host-jit-triple option to lli to print the value for the
feature-flag.
rdar://185482009
[CIR] Fix a problem with global view index calculation (#221066)
When a global that was declared with an incomplete array type is
replaced by a global with the completed type, the byte offset of each
global view on the old global is recomputed from its indices, and new
indices are derived from that offset. The offset computation rounded its
running total up to the ABI alignment of the record being indexed, which
incorrectly assumes that every member starts at a multiple of its
enclosing record's alignment. That does not hold for a member followed
by padding, so the offset came out too large. The recomputed view then
designated the wrong address or, when the inflated offset no longer
landed on a subelement boundary, fell back to a global offset attribute
holding the wrong offset.
Assisted-by: Cursor / claude-opus-5
[flang] Warn rather than error on out-of-range constant subscripts (#220435)
A reference with an out-of-range constant subscript is now accepted with
a
warning instead of being rejected with an error, and
`-fno-out-of-bounds-subscripts`
restores the error.
A subscript value is required to be within its bounds only when the
reference is
executed (F'2023 9.5.3.1 paragraph 2), so a reference that never runs
does not
render a program nonconforming. Whether a reference is ever executed
cannot be
determined in general -- consider a procedure whose only call site is in
dead
code, or one that is never called at all -- so rejecting these outright
turns
away conforming programs. Semantics already recognized the narrow case
[108 lines not shown]
[CIR] Add support for coroutine allocation failure (#220466)
This PR adds support for the coroutine promise member function
`get_return_object_on_allocation_failure()`.
When a coroutine fails to allocate its frame, the default behavior is to
throw `std::bad_alloc`. If the promise type defines
`get_return_object_on_allocation_failure()`, the coroutine uses the
nothrow form of `operator new`. If the allocation returns `nullptr`,
`get_return_object_on_allocation_failure()` is called and its return
value is returned to the caller instead of throwing.
One difference from OG is that we reverse the allocation condition. OG
checks whether the allocation was successful and branches to the
initialization path when the allocation succeeds. CIR checks whether the
allocated pointer is `nullptr` and handles the allocation failure case
inside a `cir.if`.
[LLVMABI] Align RecordType::isEmpty() with Clang's isEmptyRecord() (#218546)
[LLVMABI] Align RecordType::isEmpty() with Clang's isEmptyRecord()
While working on empty record handling for AArch64, I stumbled across a
couple of differences between the LLVM ABI library's
`RecordType::isEmpty()` and Clang's `CodeGen::isEmptyRecord()`. Testing
verified this led to observable differences in classification when using
the ABI library.
This change updates the ABI library's empty record handling to match
Clang.
Assisted-by: Cursor / various models
Reapply "[SandboxIR] Callback registration now allows specifying order (#221008) (#221017)
This reverts commit 89082772bed1ed16c0311b12147a96c35bb063d8.
And includes the fix.
[orc-rt] Make ExecutorProcessInfo platform-generic (#220938)
ExecutorProcessInfo was part generic, part system-specific: some of its
methods were implemented directly in its own .cpp, others only existed
as out-of-line definitions in per-OS files under lib/bedrock/sys/.
Move the system-specific pieces into free functions under orc_rt::sys
(mirroring the existing support/sys/ convention), and have
ExecutorProcessInfo consume them like any other client. The class itself
is now fully generic, with no system-specific code of its own.
No functional change, except that page-size detection (previously
hardcoded to POSIX sysconf) now goes through the same per-OS split as
the rest of ExecutorProcessInfo; a Windows implementation is left for a
follow-up.