[ASan] Skip high-shadow and gap setup when HighMem region is empty (#202037)
On targets where the shadow offset sits above all addressable user
memory (e.g. Alpha with ASAN_SHADOW_OFFSET=0x70000000000 and a 42-bit
user VAS), kHighMemBeg is set above kHighMemEnd so the HighMem region is
empty. Since MEM_TO_SHADOW is monotonically increasing, kHighMemBeg >
kHighMemEnd implies kHighShadowBeg > kHighShadowEnd. Calling
ReserveShadowMemoryRange(kHighShadowBeg, kHighShadowEnd) passes size =
kHighShadowEnd - kHighShadowBeg + 1, which underflows to a large
negative value, and mmap() fails with ENOMEM.
ProtectGap is also skipped: there is no meaningful shadow gap between
LowShadow and an empty HighShadow.
Guard both operations on kHighMemBeg <= kHighMemEnd.
[BOLT] Remove unused DenseMapInfo::getEmptyKey (#201986)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[Polly] Remove unused DenseMapInfo::getEmptyKey (#201992)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[lld] Remove unused DenseMapInfo::getEmptyKey (#201989)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[Target] Remove unused DenseMapInfo::getEmptyKey (#201993)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[ADT] Don't use getEmptyKey() when hashing std::optional (#202002)
DenseMapInfo<std::optional<T>>::getHashValue() calls T's getEmptyKey()
for the nullopt case. This blocks removing the now-unused getEmptyKey()
from DenseMapInfo specializations: a leaf type that drops getEmptyKey()
fails to compile wherever std::optional<T> is used as a DenseMap key
(e.g. DenseMapInfo<mlir::spirv::StorageClass>).
Compute the hash directly instead. Prerequisite for the getEmptyKey()
removal series; #201281 made getEmptyKey() unused by DenseMap.
[flang] Remove unused DenseMapInfo::getEmptyKey (#201988)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
[clang-doc] Clean up implementation with better casting
Having access to RTTI style casting lets us use slightly nicer
structures to clean up the overly complicated dispatch logic in merging
and other places.
[clang-doc] Use llvm RTTI over handrolled casting
Clang-Doc has a limited amount of polymorphism over Info types.
Historically, these have just been cast directly in a few places, but we
can use the existing llvm RTTI implementation to more rigorously
dispatch and query the types involved with only limited extra code.
This should make future changes a bit harder to get wrong.
[clang-doc] Move Generator classes into the anonymous namespace
Clang-Tidy suggest moving these classes into the anonymous namespace,
to enforce internal linkage.
[lldb] Add SBDebugger::SetTerminalDimensions to set width and height atomically (#201965)
Terminal width and height were communicated to the debugger separately,
via SetTerminalWidth() and SetTerminalHeight(). Each notified the
IOHandler and the statusline, so on a resize they recomputed their
layout twice: once with one dimension updated and the other still stale.
Add Debugger::SetTerminalDimensions(width, height) (exposed through
SBDebugger) that updates both properties before notifying, and
reimplement the single-axis setters and the driver's resize handler in
terms of it.
Also fix SBDebugger::GetTerminalHeight(), which returned the width.
[NFC][LLVM] Introduce `IIT_MATCH` to represents `LLVMMatchType` (#202034)
Currently, the fully dependent identity type `LLVMMatchType` is
represented in the IIT encoding table as `IIT_ANY` with `AK_MatchType`
argument kind. Instead, add a new IIT code `IIT_MATCH` to represent such
dependent types, so that `IIT_ANY` is used to represent just the core
overload types.
[clang-repl] Fix Value's move ctor releasing storage on construction (#200888)
Value::Value(Value &&) called Release() on the just-moved-into storage,
decrementing the refcount to zero on the only remaining reference.
Subsequent reads -- including ~Value() running clear(), which calls
Release() a second time on the now-freed allocation -- hit
use-after-free.
The move should transfer the existing reference: the source clears
IsManuallyAlloc so its destructor will not Release, and *this assumes
ownership of the same refcount. Neither side needs to Retain or Release
to keep the count correct.
Add a regression test exercising move-construction, move-assignment, and
follow-on copy-construction on a K_PtrOrObj Value. AddressSanitizer
catches the bug without the fix.
[InstCombine] Drop `ninf` FMF when input element can be `Inf` in shuffle-select transform (#201315)
Solves https://github.com/llvm/llvm-project/issues/74326
When binary operation has `ninf` FMF, but the input does not have
`nofpclass(inf)`, we should not propagate the `ninf` FMF. Because the
transformation may produce poison value when the input has an `Inf`
element, whereas the original code will simply pass through the `Inf`
element.
Alive proof: https://alive2.llvm.org/ce/z/nkv-vE
[InstCombine] Migrate undef -> poison only for certain cast-related optimizations (#201631)
Further deprecate UndefValue by restricting several related
optimizations in InstCombineCasts to PoisonValue only. Update regression
tests to reflect these changes.
[VectorCombine] foldShuffleOfShuffles - replace IR with poison on the !NewX path (#201826)
The function returns bool. The early return `return
PoisonValue::get(ShuffleDstTy);` relies on implicit pointer-to-bool
conversion of a non-null PoisonValue*, so the caller records a change
and invalidates non-CFG analyses while the original shuffle is never
replaced.
Call replaceValue(I, *PoisonValue::get(ShuffleDstTy)) and return true so
the fold actually fires. Downstream InstCombine usually cleans up the
residual shuffle via simplifyShuffleVectorInst, which masks the bug at
-O2 but leaves vector-combine producing the wrong result on its own.
Adds a regression test covering the case where both inner shuffles have
all-poison masks, so the merge loop never assigns NewX.
This was found as part of jlebar's X86 LLVM bug hunt / FuzzX effort:
https://github.com/SemiAnalysisAI/FuzzX/tree/master/x86 :
[024-foldshuffleofshuffles-poison-bool-cast](https://github.com/SemiAnalysisAI/FuzzX/tree/master/x86/bugs/024-foldshuffleofshuffles-poison-bool-cast)
[Flang][Driver] Fix -foffload-device misspelling (#201857)
#200863 added a new `-foffload-device` argument for informing the
frontend that it compiling for the device-side (and as a consequence
must not overwrite any module files compiled for the host), but the
driver was mistakenly adding `-offload-device`.
Also fix the condition and add a regression test for the driver.
[SLP]Keep reuse mask in sync when reordering split node operand
When reorderBottomToTop uses an operand order for a split vectorize
node and the operand has both reordered and reused scalars, only the
reorder indices were cleared while the reuse mask was left stale. This
diverged the split node scalars from the operand effective order.
Fold the reorder into the reuse mask (getCommonMask), reorder it by the
used mask, then clear the reorder indices, so the operand effective
order stays consistent with the reordered split node.
Fixes #202003
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/202041