[SLP] Fix crash in ordered reduction with loop-carried chain root
tryToReduceOrdered built the buildTree ignore list only from the current
window's reduced values, omitting the chain root when its leaf is a
trailing scalar outside the window.
buildTree then vectorized the root through the phi cycle,
vectorizeTree unlinked it, and emitReduction inserted at the dangling
insertion point.
Build the ignore list from the full ReductionOps chain, matching the
associative-reduction path, so the root stays scalar to fix a crash.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/201963
[libclc][Test] Don't hard code `clang` path in update_libclc_tests.py (#201806)
In #201773, build folder is `redhat-linux-build` rather than `build`.
Detect clang from PATH. Also add --clang-binary option to specify clang path.
[libclc][Test] Add -fno-discard-value-names to RUN line (#201808)
Entry block label could be missing. Add -fno-discard-value-names to make
sure it exists.
Resolves #201773
[libclc] Fix LIBCLC_OUTPUT_LIBRARY_DIR when find_package(LLVM) fails (#201816)
If we configure llvm from llvm-project/build folder, find_package(LLVM)
succeeds, `LLVM_LIBRARY_OUTPUT_INTDIR` is `build/./lib` and
`LLVM_BINARY_DIR` is `build`.
However, in #201773, find_package(LLVM) fails due to
LLVM_LIBDIR_SUFFIX=64, LLVM_LIBRARY_OUTPUT_INTDIR is
`redhat-linux-build/runtimes/runtimes-nvptx64-nvidia-cuda-bins/lib64`
and LLVM_BINARY_DIR is `redhat-linux-build`.
Use LLVM_BINARY_DIR, which is stable for both cases, for libclc output dir.
Fixes #201773
[libc] Fix clock_gettime on arm32 (#201959)
After removing 32 bit time_t the buildbot has been failing due to a
segfault. This PR fixes it. Not the cleanest fix but I don't want the
buildbot failing over the weekend.
Assisted-by: Automated tooling, human reviewed.
[clang][sycl][nvlink] Share static library linking in Frontend/Offloading (#201253)
Move clang-nvlink-wrapper's archive member selection engine into a new
shared library in llvm/lib/Frontend/Offloading (ArchiveLinker.h/.cpp)
and use it from both clang-nvlink-wrapper and clang-sycl-linker, adding
static library (.a) and -l support to the SYCL linker.
The shared llvm::offloading::resolveArchiveMembers() API:
- Searches -L paths for -l library names (lib<name>.a or :<name>)
- Expands archives, honouring --whole-archive/--no-whole-archive
- Runs a symbol-driven fixed-point loop to extract only the archive
members that resolve undefined symbols
- Returns the resolved MemoryBuffers and symbol table; the symbol table
is consumed by clang-nvlink-wrapper's LTO resolution pass
clang-sycl-linker gains -l, --whole-archive/--no-whole-archive, and -u
options (added to SYCLLinkOpts.td). The previous --bc-library option
has been removed in favor of the standard -l mechanism.
[11 lines not shown]
[X86] Fix crash on BT bit index narrower than log2(BW) (#201793)
peekThroughBitPosExtTrunc asserted that peeling
TRUNCATE/ZERO_EXTEND/ANY_EXTEND never drops below log2(BW) bits, but a
BT bit index can be e.g. a zext of i1. Stop peeking there instead: below
log2(BW) bits a peeled value no longer determines the bit index on its
own, so comparing peeled values would also be unsound.
Fixes #201444.
[docs] Migrate 20 LLVM docs to markdown (#201465)
An LLM assisted in the rewrite. I didn't use pandoc or any other tools,
and I think there are fewer artifacts. I validated these docs by opening
all 20 HTML files in my browser.
Files:
- DebuggingLLVM.md
- FAQ.md
- CompilerWriterInfo.md
- GettingStartedVS.md
- NewPassManager.md
- MemorySSA.md
- LoopTerminology.md
- Lexicon.md
- MIRLangRef.md
- CoverageMappingFormat.md
- InstrProfileFormat.md
- BitCodeFormat.md
[9 lines not shown]
[docs] Rename 20 key LLVM docs to Markdown (#201464)
This may break the docs build temporarily, but there will be a follow-up
PR that fixes it immediately after. The rename is being committed first
to aid review and source code archaelogy.
Tracking issue: #201242
[X86][GlobalISel] Adding missing Query to G_BUILD_VECTOR legalization (#199435)
Once G_BUILD_VECTOR was fixed, legalize-undef-vec-scaling.mir falled
into endless legalization loop as incoming MIR doesn't match correct
lowering of the type.
[SSAF][Extractor] Make hard errors in Extractors quiet
Hard errors were used in extractors during development to quickly
identify unsupported language constructs. This commit converts them to
DEBUG_WITH_TYPE so that these errors are silenced in release builds.
rdar://178747892
[clang][lex] Store `HeaderFileInfo` in a `MapVector` (#201936)
This is a re-commit of PR #200968 (f357a47) that was reverted by PR
#201702 (adaa9e0). One call-site of
`HeaderSearch::forEachExistingLocalFileInfo()` in `ASTWriter` relies on
stable order, which the `DenseMap` didn't provide. This PR switches to
`MapVector`, which has the same performance characteristics as the
original solution at the cost of a theoretical memory usage increase.
Original PR description:
Calling `FileManager::GetUniqueIDMapping()` during modular builds gets
very expensive if the `FileManager` has seen lots of files. This
function is used in two places in the `ASTWriter` to look up
`HeaderFileInfo` in `HeaderSearch`.
This PR changes the storage of `HeaderFileInfo` from
`FileEntry::getUID()`-indexed `std::vector<T>` to
`llvm::DenseMap<FileEntryRef, T>`, improving scanning performance by
~2.5%.
Reland "Remove the optional bitcast between a musttail call and its ret" (#201280) (#201642)
This relands #201280, which was reverted in #201479 because it broke the
sanitizer buildbot
The revert was caused by a heap-use-after-free in
`BitcodeReader::materialize`
Fix: The CallBase branch could have erased I before we read it in the
new conditional
[Flang][OpenMP] Support iterator modifiers in map and motion clauses
Support iterated array elements and array sections in map and motion clauses for
target data, target enter data, target exit data, and target update constructs.
Preserve mapper resolution for iterated entries, including explicit mappers,
user-defined default mappers, declare mapper entries, and implicit default
mappers.
This PR stacked on top of #197047 and #197752.
This patch is part of the feature work for #188061.
Assisted with copilot.
[SSAF] Let function parameters inherit linkage from their parent functions
SSAF treats parameters as entities and may not always associate them
back to their parent functions. Therefore, it needs to identify
parameters of functions with external linkage across different
TUs. Treating them as having no linkage (as in C++) causes the same
parameter in different TUs to be assigned different EntityIDs. As a
result, the behavior of the parameter across multiple TUs cannot be
correlated.
rdar://178844032
[DirectX][ObjectYAML] Add SRCI part support (#199446)
Add support for DXContainer SRCI in the ObjectYAML pipeline so it can be
represented in structured YAML and round-tripped through
yaml2obj/obj2yaml.
SRCI is emitted into shader PDB files. It stores shader source code that
is displayed in PIX, and shader compilation flags.
[flang][OpenMP][NFC] Share declare mapper helpers for iterator modifier lowering
Move mapper lookup and implicit default mapper creation into reusable
OpenMP lowering helpers so regular map lowering and iterator-generated
map entries can use the same resolution path.
This prepares Flang iterator modifier lowering for map and motion clauses
without changing the generated IR for existing non-iterator maps.
[DirectX] Rewrite DIGlobalVariableExpression to DXDIGlobalVariable (#199791)
DIGlobalVariable used to have an `expr` operand. Starting from
bceaaa964360 `expr` is now an operand of DIGlobalVariableExpression,
which references both the variable and the expression.
Before:
!0 = !DIGlobalVariable(expr: !1)
!1 = !DIExpression(DW_OP_plus, 4)
Now:
!2 = !DIGlobalVariableExpression(var: !3, expr: !4)
!3 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false,
isDefinition: true, type: !6)
!4 = !DIExpression(DW_OP_plus, 4)
DXIL does not support DIGlobalVariableExpression, so we have to fold
`expr` back to DIGlobalVariable.
[2 lines not shown]