[MIR] Drop the numeric flag from the operand count test
An inline asm operand flag written as an immediate holds its register
class's TableGen ID, so adding a register class can change the
immediate, though the class stays the same. The "ops:N" syntax lets
tests write every flag symbolically instead. The new test's numeric flag
had no class, but it was still an immediate, and other tests already
check that a numeric flag prints with its count: peephole-copy.mir,
callbr-asm-kill.mir, and scavenge-clobbered-reg.mir.
Assisted-by: Claude Opus 5.5
[hwasan] Disable aliasing mode runtime and tests on Android (#235414)
HWASan x86_64 aliasing mode
(`-fsanitize-hwaddress-experimental-aliasing`)
is only implemented on Linux (`hwasan_dynamic_shadow.cpp` does not set
up
`MapDynamicShadowAndAliases` under `SANITIZER_ANDROID`). Skip building
the
`hwasan_aliases` runtime on Android in
`compiler-rt/lib/hwasan/CMakeLists.txt`
and exclude Android from `supported_os` in
`compiler-rt/test/hwasan/lit.cfg.py`
when aliasing mode is enabled.
Assisted-by: Gemini
[test][compiler-rt] Set HOME and TMPDIR via re-exec in sanitizer_set_report_path_test (#235534)
Setting `HOME=%device_rundir/%t.homedir` in the lit `RUN:` line leaves
the
device path in the host `os.environ` when `android_run.py` invokes
`adb`,
causing `adb` 37+ (`KnownWifiHostsFile`) to abort trying to create
`$HOME/.android` on the host.
Set `HOME` and `TMPDIR` from `argv[0]` inside `main()` and re-exec the
test
binary so `/proc/self/environ` has the updated paths on the target
without
modifying the host environment.
Assisted-by: Gemini
[ARM] Prevent debug instructions from blocking SUB/CMP folding (#234919)
A `DBG_VALUE` between an ARM subtraction and its matching compare hides
the
compare from `ARMBaseInstrInfo::shouldSink`. MachineSink can then sink
the
subtraction into a successor, preventing `optimizeCompareInstr` from
folding
the pair into `SUBS`; with debug information this leaves an extra `CMP`.
Look past debug instructions when checking the adjacent compare, while
keeping
pseudo probes as barriers. The regression test checks both the debug
input and
the same input after debug information is stripped.
This issue was found by a non-AI automated testing tool. AI assisted
with the analysis and development of the fix.
[libclc] Support fp32 subnormal inputs and outputs in SPIR-V sw fma (#233791)
`__clc_sw_fma` previously assumed all non-zero inputs were normal floats
(extracting biased exponent `0` as `-127` with the implicit leading bit
`0x800000` set) and unconditionally flushed results with exponent `<=
-127` to zero. On devices that support fp32 subnormals and use software
fma, this caused `fma`, `expm1`, and `erf` to fail the CTS.
Normalize non-zero subnormal inputs using `__clc_clz` and, when fp32
subnormals are supported (`!__clc_denormals_are_zero_fp32()`),
right-shift the significand before rounding for exponents in `[-150,
-127]` so subnormal outputs and subnormal-to-normal rounding overflows
are rounded to nearest-even.
[ELF] Place merged .eh_frame CIEs before all FDEs (#235533)
EhFrameSection::finalizeContents places each merged CIE before all of
its FDEs, collecting them into CieRecord::fdes in a serial loop.
Place the merged CIEs first, followed by live FDEs in input order for
parallelism. On chrome-release-x86_64 (1.16M FDEs) at --threads=8,
"Finalize .eh_frame": 36.3 -> 16.4 ms.
EhSectionPiece drops `sec`.
[libclc] Fix exponent overflow and subnormal rounding in __clc_ldexp (#233823)
When fp32 subnormals are
supported (`!__clc_denormals_are_zero_fp32()`), `__clc_ldexp` previously
added `n` to the exponent with plain signed integer addition,
overflowing 32-bit `int` when `n` is near `INT_MAX` or `INT_MIN` (e.g.
`n = INT_MAX` wrapped around to `< -24` and flushed to zero instead of
returning infinity). Additionally, subnormal fp32 results were formed
with a truncating right shift instead of round-to-nearest-even, and
shift counts were not clamped to valid ranges.
Normalize subnormal fp32 inputs before adding `n`, use
`__clc_add_sat(exponent, n)` in both fp32 and fp64 `__clc_ldexp` to
prevent signed integer overflow, clamp shift counts, and apply
round-to-nearest-even when right-shifting into a subnormal fp32 result.
[flang][cuda] Skip device-only specifics at host call sites in generic resolution (#234710)
When CUDA is enabled and the call site is not in a device context, skip
specifics whose only CUDA subprogram attribute is DEVICE. HOST,DEVICE
and
unattributed specifics are unaffected. Call sites inside CUF kernel and
OpenACC regions, which share Scope::Kind::OpenACCConstruct and may be
device code in a host subprogram, are left unfiltered.
[ELF] Reject invalid .eh_frame FDE encoding early in addCie (#235532)
The result does not depend on addresses. It's better than diagnosing it
in EhFrameHeader::updateAllocSize. Diagnose even if --eh-frame-hdr is
not specified.
[ELF] Report invalid .eh_frame CIE references when splitting (#235531)
An FDE with an invalid CIE pointer is diagnosed with Fatal in
EhFrameSection::addRecords, leading to main-run-twice issue. Diagnose in
EhInputSection::split like other malformed records, so that the CIE
index of an FDE is always valid.
[ELF] Fix out-of-bounds .eh_frame relocation to not overwrite the next output section (#235530)
lld/test/ELF/comdat-discarded-reloc.s intermittently fails under TSan:
OffsetGetter::get reports an error for an out-of-bounds .eh_frame
relocation and maps to output offset 0. If the link continues due to
--noinhibit-exec and .eh_frame has no pieces, the write extends past the
4-byte terminator into the next output section.
Return -1 to skip the relocation, like one in a dead piece.
Avoid the 'converted' temporaries
Apparently not necessary because the argument itself is an r-value
reference. Still dangerious because the caller does not control when the
collee moves it, but unrelated to this PR
[LoopInterchange] Add tests for loop control values in the outer preheader (NFC) (#235520)
Add test cases where it matters whether the loop control values (the
initial and final values of the IVs) are available in the outer loop
preheader. These are corner cases where the work in #235496 changes
what loop-interchange can handle.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang] Fix typo in __cplusplus macro (#235489)
Found a possible typo where `__cplusplus` was written as `__cpluscplus`,
since I made the same typo while doing a search.
Corrected to `__cplusplus`, feel free to close if this wasn't a mistake
:)
[analyzer][NFC] BugReporterVisitors.h should include MemRegion.h (#235283)
BugReporterVisitors.h includes RangedConstraintManager.h but uses
nothing it declares: RangeSet, Range, ConstraintMap and
SimpleConstraintManager appear nowhere in the file. What the header
actually needs is MemRegion.h, which supplies SubRegion,
MemRegionManager and MemRegion completeness for an inline constructor;
today those arrive only by accident, transitively through
RangedConstraintManager.h -> ProgramState.h. Swapping the include for
the one that carries the used declarations makes the dependency honest
and adds a forward declaration of CallEvent in namespace clang::ento
for the one name that only needs to be incomplete.
One header needs a compensating include: Z3CrosscheckVisitor.h uses
ConstraintMap and was getting RangedConstraintManager.h through
BugReporterVisitors.h, so it now includes it directly. No translation
unit in clangStaticAnalyzerCore, clangStaticAnalyzerCheckers or
clangStaticAnalyzerFrontend required any other change.
[2 lines not shown]