[Hexagon] Fix UB from signed left shift overflow in evaluateEXTRACTi (#181243)
The evaluateEXTRACTi function in HexagonConstPropagation uses a left
shift to position a bitfield at the top of a 64-bit word before
extracting it with a right shift. When the source value has high bits
set, the left shift of the int64_t value overflows, which is undefined
behavior.
Fix by performing the left shift in uint64_t, then casting to int64_t
only for the subsequent arithmetic right shift (signed extract case).
[clangd] Guard against null TemplateName in DumpVisitor (#181554)
Add a guard against null values for TemplateName in
DumpVisitor::TraverseTemplateName.
clangd’s DumpVisitor may attempt to traverse a null TemplateName when
handling dependent nested template names. On LLVM main this can lead to
a crash in TemplateName::getKind().
Add a defensive check in DumpVisitor::TraverseTemplateName() to skip
null TemplateName instances before invoking traverseNode(). Following
the same design as other functions in the class.
No functional change is intended beyond preventing the crash.
Fixes: #180902
---------
Signed-off-by: Emily Dror <emilydror01 at gmail.com>
[clang][TypePrinter] Introduce AnonymousTagMode enum (#182317)
As part of https://github.com/llvm/llvm-project/pull/159592, we want to
emit unique lambda names into debug-info without relying on
`AnonymousTagLocations` (i.e., we don't want the source files included
in the names).
The plan is to implement this as a third `AnonymousTagMode`. This patch
turns the existing `AnonymousTagLocations` into an enum as preparation.
(full prototype is at https://github.com/llvm/llvm-project/pull/168533)
[LFI] Add MCLFIRewriter infrastructure (#172906)
This is the second patch in the LFI series, adding the following
features:
* `MCLFIRewriter` class, which will be used to perform LFI rewrites on a
per-architecture basis. Each architecture where LFI is supported will
implement a subclass (for example,
`Target/AArch64/MCTargetDesc/AArch64MCLFIRewriter.cpp`) that will
implement the `rewriteInst` function to perform the actual rewriting
(the AArch64 version will be added in the next PR). The generic rewriter
class provides some instruction info utilities (`mayLoad`, `mayStore`)
and is used to call `rewriteInst` during instruction emission. It also
provides `onLabel` which allows the rewriter to know possible branch
targets, making certain optimizations like guard elimination possible.
* LFI streamer initialization that marks object files with a NOTE
section to indicate that the object file is using LFI.
* A basic LFI assembly parser that introduces the `.lfi_rewrite_disable`
and `.lfi_rewrite_enable` directives that can be used to control whether
rewriting is enabled or not in hand-written assembly.
[RISCV] Correct the LMUL operand for __riscv_sf_vc_i_se_u8mf4 and __riscv_sf_vc_i_se_u8mf2 intrinsics. (#182345)
mf2 is should 7 (-1 in 3 bits). mf4 should be 6 (-2 in 3 bits).
[TableGen][ISel] Add OPC_CheckTypeByHwMode0 to optimize the most frequent getValueTypeForHwMode index. (#182366)
Sort the unique ValueTypeByHwMode combinations by usage and add a
compressed opcode for the most common.
Reduces the RISCVGenDAGISel.inc table by about ~12K. The most common
being XLenVT.
I plan to add EmitIntegerByHwMode0 and EmitRegisterByHwMode0 in
subsequent patches.
Assisted-by: claude
[LV] Add tests with predicated early exits.
Add test coverage for predicated early exits, without instructions that
need predication after the early exits.
[Clang] Introduce OverflowBehaviorType for fine-grained overflow control (#148914)
Introduce `OverflowBehaviorType` (OBT), a new type attribute in Clang
that provides developers with fine-grained control over the overflow
behavior of integer types. This feature allows for a more nuanced
approach to integer safety, achieving better granularity than global
compiler flags like `-fwrapv` and `-ftrapv`. Type specifiers are also
available as keywords `__ob_wrap` and `__ob_trap`.
These can be applied to integer types (both signed and unsigned) as well
as typedef declarations, where the behavior is one of the following:
* `wrap`: Guarantees that arithmetic operations on the type will wrap on
overflow, similar to `-fwrapv`. This suppresses UBSan's integer overflow
checks for the attributed type and prevents eager compiler
optimizations.
* `trap`: Enforces overflow checking for the type, even when global
flags like `-fwrapv` would otherwise suppress it.
[7 lines not shown]
[lldb] Check the shared cache binary provider for Simulator sessions (#182216)
The code to check with the shared cache binary provider was previously
in the native host platform (PlatformDarwinDevice), but it also needs to
be called from PlatformAppleSimulator for simulator debug sessions. Move
the code to the base class PlatformDarwin and call it from both
subclasses. No changes to the code itself, just moving it to the base
class.
rdar://170693756
[SCEV] Introduce SCEVUse wrapper type (NFC)
Add SCEVUse as a PointerIntPair wrapper around const SCEV * to prepare
for storing additional per-use information.
This commit contains the mechanical changes of adding an intial SCEVUse
wrapper and updating all relevant interfaces to take SCEVUse. Note that
currently the integer part is never set, and all SCEVUses are
considered canonical.
[SCEV] Introduce SCEVUse wrapper type (NFC)
Add SCEVUse as a PointerIntPair wrapper around const SCEV * to prepare
for storing additional per-use information.
This commit contains the mechanical changes of adding an intial SCEVUse
wrapper and updating all relevant interfaces to take SCEVUse. Note that
currently the integer part is never set, and all SCEVUses are
considered canonical.