[SPARC] Implement TargetInstrInfo::insertIndirectBranch() (#226678)
Implement `insertIndirectBranch` so that branch relaxation pass can
insert unconditional long-range branching.
Follow an approach similar to the one used in AVR and use the CALL
instruction to get a reach of 32-bit signed offset instead of emitting
actual indirect branches.
[RISCV][P-ext] Add isel pattern match for mulu.h01/mulu.h11 (#235226)
`mulu.h01` multiplies the zero-extended lower half word of rs1 by the
zero-extended upper half word of rs2, and `mulu.h11` multiplies the
zero-extended upper half words of both.
Previously, (srl X, 16) was selected as a separate srli feeding
`mulu.h00` or `mul`. Match it directly so the shift is folded.
zexti16 also matches (srl X, 16) since its upper bits are known zero, so
the new patterns need AddedComplexity to be tried before the `mulu.h00`
pattern, and `mulu.h11` before `mulu.h01`.
[OpenMP] Add definition of task_iteration directive
This just adds the basic definitions of the directive (specifically the
definitions of the OMPD_task_iteration enum).
This isn't used or handled anywhere at the moment.
[AVR] Address review comments on AVRTiny spills
Document that STDPtrQRr and LDDRdPtrQ are only treated as pseudo
instructions on AVRTiny, and check atmega328 instead of -O0 in
std-ldd-tiny.ll so the test contrasts the two kinds of cores.
[SLP]Drop samesign of narrowed bit test compares (#235287)
The bit tests compare and L, R, which sign-extends from the narrow type
only
if both L and R do, so its sign may change after narrowing.
Fixes
https://github.com/llvm/llvm-project/pull/233124#issuecomment-6382644843
Assisted-by: Cursor
[OpenMP] Add definition of begin/end metadirective
This just adds the basic definitions of the directives (specifically the
definitions of the OMPD_begin_metadirective and OMP_end_metadirective
enums).
This isn't used or handled anywhere at the moment.
[SLP]Fix alternate casts of demoted operand (#235280)
sext/sitofp of an unsigned demoted operand must be zext/uitofp, and
zext/uitofp cannot absorb the sign extension of a signed demoted
operand,
so the operand must be extended back first.
Fixes
https://github.com/llvm/llvm-project/issues/234923#issuecomment-6373744225
Assisted-by: Cursor
[CodeGen] Drop dead SlotIndexes before allocation (#224031)
SlotIndexes keeps the index list entry of an erased instruction and only
clears its instruction pointer. Live range sizes are measured in slot
indexes and greedy ranks ranges by size, so the leftovers inflate some
ranges more than others and reorder allocation, spilling heavily on
register-starved functions.
Add SlotIndexes::compactIndexes() to erase them. Erased entries are
unlinked, so holding an index to one is now a bug; linkedEntry() asserts
on it. The one analysis that did was LiveIntervals, so add
removeUnreferencedIntervals() to retire the intervals responsible.
Off by default behind -greedy-compact-slot-indexes, since it changes
allocation across much of the test suite.
The test file greedy-compact-slot-indexes-priority.mir by Q. Colombet.
[analyzer][NFC] Forward-declare Preprocessor in BugReporter.h
BugReporter.h includes clang/Lex/Preprocessor.h, and that single edge
pulls the whole Lex subtree -- roughly 34 headers, among them
Basic/Module.h, HeaderSearch.h and ModuleMap.h -- into 161 of the 197
translation units that make up clangStaticAnalyzerCore,
clangStaticAnalyzerCheckers and clangStaticAnalyzerFrontend. The
mechanism is transitive inclusion, not any use of the preprocessor:
nearly every analyzer source reaches BugReporter.h, so nearly every one
of them parses Preprocessor.h and everything it brings with it.
The include is not needed. Preprocessor appears in this header only as a
reference return type in three declarations, and no member of it is ever
named, so a forward declaration in namespace clang suffices and the
generated code is identical. Eight .cpp files were relying on
SourceManager completeness arriving through Preprocessor.h and now
include clang/Basic/SourceManager.h directly; that is the only
compensating change, and no translation unit needed Preprocessor.h
added back.
[14 lines not shown]
[analyzer][NFC] Forward-declare Preprocessor in AnalysisManager.h
AnalysisManager.h includes clang/Lex/Preprocessor.h, and through that
one edge the whole Lex subtree -- roughly 34 headers, among them
Basic/Module.h, HeaderSearch.h and ModuleMap.h -- is parsed by 147 of
the 197 translation units in clangStaticAnalyzerCore,
clangStaticAnalyzerCheckers and clangStaticAnalyzerFrontend. The
mechanism is transitive inclusion: AnalysisManager.h sits under almost
every analyzer source, so almost every one of them pays for the
preprocessor without naming it.
Preprocessor is used here only as a reference member, a constructor
parameter and a reference-returning accessor; no member of it is ever
named, so a forward declaration in namespace clang suffices and the
generated code is identical. The include is replaced by
clang/Basic/SourceManager.h rather than simply dropped, because
isInCodeFile() calls SM.isInMainFile(), SM.getIncludeLoc(),
SM.getFileID() and SM.getFilename(), and SourceManager is otherwise
unreachable from this header once Preprocessor.h is gone. That swap is
[21 lines not shown]
[analyzer][NFC] BugReporterVisitors.h should include MemRegion.h
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.
[3 lines not shown]
[AArch64][GlobalISel] Add deinterleaved store combine. (#228514)
This adds a combine for converting store(shuffle) into a ST2/ST3/ST4.
The idea is that this can be extended to support interleave /
deinterleave intrinsics in the future once those are supported.
[CIR] Fix temporary cleanup boundaries for asm and coroutines (#234664)
- Destroy asm operand temporaries at the end of the asm statement.
- Defer resume-expression temporary cleanups to the end of the enclosing
full-expression
- Clean up array-element default-argument temporaries before
constructing the next element, preserving lifetime extension.
- Keep conditional cleanup scopes open until the end of their owning
full-expression.
Note that this overlaps with #234303. I will rebase either depending on
which one gets merged first.
Assisted-By: Claude Opus 5.5
[flang][OpenMP] Improve diagnosing invalid operators in DECLARE_REDUCTION
Move the check out of the common MakeNameFromOperator function and
into OmpStructureChecker. Remove the no longer needed SemanticsContext
parameter in MakeNameFromOperator.
This will allow reusing at least some parts of the the name-mangling
code in DECLARE_INDUCTION.