aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-06-24[𝘀𝗽𝗿] changes introduced through rebaseusers/shawbyoung/spr/main.bolt-hash-based-function-matchingshaw young5334-102065/+378671
Created using spr 1.3.4 [skip ci]
2024-06-24[BOLT][NFC] Sync CommandLineArgumentReference with options (#96563)shaw young1-9/+75
2024-06-24Revert commits that add `TestFind(Ranges)InMemory.py` (#96560)Chelsea Cassanova11-660/+6
Reverting to unblock macOS buildbots which are currently failing on these tests. https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/6377/
2024-06-24[libc][math] Implement double precision sin correctly rounded to all ↵lntue19-59/+1790
rounding modes. (#95736) - Algorithm: - Step 1 - Range reduction: for a double precision input `x`, return `k` and `u` such that - k is an integer - u = x - k * pi / 128, and |u| < pi/256 - Step 2 - Calculate `sin(u)` and `cos(u)` in double-double using Taylor polynomials with errors < 2^-70 with FMA or < 2^-66 w/o FMA. - Step 3 - Calculate `sin(x) = sin(k*pi/128) * cos(u) + cos(k*pi/128) * sin(u)` using look-up table for `sin(k*pi/128)` and `cos(k*pi/128)`. - Step 4 - Use Ziv's rounding test to decide if the result is correctly rounded. - Step 4' - If the Ziv's rounding test failed, redo step 1-3 using 128-bit precision. - Currently, without FMA instructions, the large range reduction only works correctly for the default rounding mode (FE_TONEAREST). - Provide `LIBC_MATH` flag so that users can set `LIBC_MATH = LIBC_MATH_SKIP_ACCURATE_PASS` to build the `sin` function without step 4 and 4'.
2024-06-24LAA: strip unnecessary getUniqueCastUse (#92119)Ramkumar Ramachandra2-32/+17
733b8b2 ([LAA] Simplify identification of speculatable strides [nfc]) refactored getStrideFromPointer() to compute directly on SCEVs, and return an SCEV expression instead of a Value. However, it left behind a call to getUniqueCastUse(), which is completely unnecessary. Remove this, showing a positive test update, and simplify the surrounding program logic.
2024-06-24[NVPTX] Basic support for "grid_constant" (#96125)Akshay Deodhar6-86/+297
- Adds a helper function for checking whether an argument is a [grid_constant](https://docs.nvidia.com/cuda/nvvm-ir-spec/index.html#supported-properties). - Adds support for cvta.param using changes from https://github.com/llvm/llvm-project/pull/95289 - Supports escaped grid_constant pointers conservatively, by casting all uses to the generic address space with cvta.param.
2024-06-24[bazel] Add support for building lldb-dap (#96556)Keith Smiley1-0/+62
2024-06-24[bazel] Switch mach_gen to apple_genrule (#96551)Keith Smiley1-2/+5
mig is a tool vendored with Xcode. Using apple_genrule makes sure that the bazel selected version of Xcode is preferred, and that the action is invalidated when that version changes.
2024-06-24[libc][startup] create header for ElfW and use in startup (#96510)Nick Desaulniers (paternity leave)4-4/+25
This is necessary for 32b platforms such as ARM and i386. Link: #94128
2024-06-24[libc++] Build with -fsized-deallocation (#96217)Louis Dionne6-5/+14
This patch makes libc++ build with -fsized-deallocation. That flag is enabled by default in recent versions of Clang, so this patch will make libc++ forward-compatible with ToT Clang.
2024-06-24[AMDGPU] Fix negative immediate offset for unbuffered smem loads (#89165)vangthao9512-104/+357
For unbuffered smem loads, it is illegal for the immediate offset to be negative if the resulting IOFFSET + (SGPR[Offset] or M0 or zero) is negative. New PR of https://github.com/llvm/llvm-project/pull/79553.
2024-06-24[clang][OpenMP] Fix error handling of the adjust_args clause (#94696)Mike Rice3-3/+15
Static verifier noticed the current code has logically dead code parsing the clause where IsComma is assigned. Fix this and improve the error message received when a bad adjust-op is specified. This will now be handled like 'map' where a nice diagnostic is given with the correct values, then parsing continues on the next clause reducing unhelpful diagnostics.
2024-06-24[mlgo] Support composite AOT-ed models (#96276)Mircea Trofin3-27/+212
This applies to the AOT case where we embed models in the compiler. The change adds support for multiple models for the same agent, and allows the user select one via a command line flag. "agent" refers to e.g. the inline advisor or the register allocator eviction advisor. To avoid build setup complexity, the support is delegated to the saved model. Since saved models define computational graphs, we can generate a composite model (this happens prior to building and embedding it in LLVM and is not shown in this change) that exposes an extra feature with a predefined name: `_model_selector`. The model, then, delegates internally to contained models based on that feature value. Model selection is expected to happen at model instantiation, there is no current scenario for switching them afterwards. If the model doesn't expose such a feature but the user passes one, we report error. If the model exposes such a feature but the user doesn't pass one, we also report an error. Invalid model selector values are expected to be handled by the saved model. Internally, the model uses a pair of uint64 values - the high and low of the MD5 hash of the name. A tool composing models would, then, need to: - expose the extra feature, `_model_selector`, shape (2,), uint64 data type - test its value (`tf.cond` or `tf.case` in Tensorflow) against the MD5 hash, in the [high, low] order, of contained models based on a user-specified name (which the user will then use as flag value to the compiler) Agents just need to add a flag to capture the name of a model and pass it to `ReleaseModeModelRunner` at construction. This can be passed in all cases without checking - the case where the model is not composite and we pass an empty name, everything works as before. This change also factors out the string flags we pass to the `ReleaseModeModelRunner` for better maintainability (we risk confusing parameters that are strings otherwise)
2024-06-24[clang][OpenMP] Fix teams nesting of region check (#94806)Mike Rice2-3/+19
The static verifier flagged dead code in the check since the loop will only execute once and never reach the iterator increment. The loop needs to iterate twice to correctly diagnose when a statement is after the teams. Since there are two iterations again, reset the iterator to the first teams directive when the double teams case is seen so the diagnostic can report both locations.
2024-06-24[bazel] Export distributable lldb files (#96549)Keith Smiley2-0/+2
If you're building and vendoring lldb, you might need to also vendor these files.
2024-06-24[NFC][MLInliner] Rename LastSCC -> CurSCC (#96546)Arthur Eubanks1-6/+6
The passed SCC is the current SCC we're working on.
2024-06-24[OpenMP] Add num_threads clause list format and strict modifier support (#85466)Terry Wilmarth6-20/+520
Add support to the runtime for 6.0 spec features that allow num_threads clause to take a list, and also make use of the strict modifier. Provides new compiler interface functions for these features.
2024-06-24[mlir][linalg][Transform] Fix use-after-free in `SplitOp::apply` (#96390)Matthias Springer1-11/+13
Detected with ASAN. `Operation::getLoc()` was called after erasing the operation. Reverts 48cf6b6bbe7a22bfcd98f82dc7afd21c9decd22f, which attempted to fix the use-after-free. (But the use-after-free is still there when the `hasFailed` branch is taken.)
2024-06-24[Clang][SveEmitter] Split up TargetGuard into SVE and SME component. (#96482)Sander de Smalen6-221/+242
One reason to want to split this up is to simplify the code added in #93802, where it checks the SME streaming-mode requirements for a builtin by checking for the absence of SVE. If the target guards are separate, we can generate a table and make the Sema code to verify the runtime mode simpler. Another reason is to avoid an issue with a check in SveEmitter.cpp where it ensures that the 'VerifyRuntimeMode' is set correctly for functions that have both SVE and SME target guards: if (!Def->isFlagSet(VerifyRuntimeMode) && Def->getGuard().contains("sve") && Def->getGuard().contains("sme")) llvm_unreachable("Missing VerifyRuntimeMode flag"); However, if we ever add a new feature with "sme" in the name, even though it is unrelated to FEAT_SME, then this code no longer works. Note that the arm_sve.td and arm_sme.td files could do with a bit of restructuring after this but it seems better to follow that up in an NFC patch.
2024-06-24[AArch64] Check for streaming mode in HasSME* features. (#96302)Sander de Smalen111-172/+186
This also fixes up some asserts in copyPhysReg, loadRegFromStackSlot and storeRegToStackSlot.
2024-06-24[C23] Claim we do not conform to N2819Aaron Ballman2-1/+58
This paper clarified the lifetime of compound literal objects in odd scopes, such as use at function prototype scope. We do not currently implement this paper, as the new test demonstrates.
2024-06-24Update Clang extension criteria (#96532)Aaron Ballman1-0/+6
This updates Clang's extension criteria to explicitly mention impacts on other projects within the monorepo. These changes were discussed in the following RFC: https://discourse.llvm.org/t/rfc-require-discussion-of-impact-to-monorepo-stakeholders-when-adding-new-clang-extensions/79613
2024-06-24[mlir] Use llvm::unique (NFC) (#96415)Kazu Hirata7-13/+7
2024-06-24[COFF,test] Improve fission.llFangrui Song1-2/+17
2024-06-24[lldb] Fix failing TestFind(Ranges)InMemory.py tests. (#96511)Miro Bucko1-1/+0
This is to unblock #95007. Will investigate why the assertion is failing on some arch.
2024-06-24[bazel] Port #95312 (#96533)Keith Smiley1-0/+2
2024-06-24[.github] Add myself as a reviewer for DWARFLinker & friends (#96531)Jonas Devlieghere1-0/+5
2024-06-24[llvm-readobj][ELF] Implement JSON output for --dynamic-table (#95976)Fred Grim2-0/+418
When printing JSON output with --dynamic-table I noticed that the output is invalid JSON. This patch overrides the printDynamicTable() function in the JSONELFDumper to return a list of dictionaries for the DynamicSection value. Before the output was: ``` { "FileSummary": { "File": "bin/llvm-readelf", "Format": "elf64-x86-64", "Arch": "x86_64", "AddressSize": "64bit", "LoadName": "<Not found>" }DynamicSection [ (35 entries) Tag Type Name/Value 0x000000000000001D RUNPATH Library runpath: [$ORIGIN/../lib:] 0x0000000000000001 NEEDED Shared library: [libm.so.6] 0x0000000000000001 NEEDED Shared library: [libz.so.1] 0x0000000000000001 NEEDED Shared library: [libzstd.so.1] ``` Now the output looks like: ``` "DynamicSection": [ { "Tag": 29, "Type": "RUNPATH", "Value": 6322, "Path": [ "$ORIGIN/../lib" ] }, { "Tag": 1, "Type": "NEEDED", "Value": 6109, "Library": "libm.so.6" }, ```
2024-06-24Add flag to opt out of wasm-opt (#95208)Quentin Michaud3-35/+49
This PR fixes #55781 by adding the `--no-wasm-opt` and `--wasm-opt` flags in clang to disable/enable the `wasm-opt` optimizations. The default is to enable `wasm-opt` as before in order to not break existing workflows. I think that adding a warning when no flag or the `--wasm-opt` flag is given but `wasm-opt` wasn't found in the path may be relevant here. It allows people using `wasm-opt` to be aware of if it have been used on their produced binary or not. The only downside I see to this is that people already using the toolchain with the `-O` and `-Werror` flags but without `wasm-opt` in the path will see their toolchain break (with an easy fix: either adding `--no-wasm-opt` or add `wasm-opt` to the path). I haven't implemented this here because I haven't figured out how to add such a warning, and I don't know if this warning should be added here or in another PR. CC @sunfishcode that proposed in the associated issue to review this patch.
2024-06-24[mlir][linalg] Implement patterns for reducing rank of named linalg ↵srcarroll6-0/+605
contraction ops (#95710) This patch introduces pattern rewrites for reducing the rank of named linalg contraction ops with unit spatial dim(s) to other named contraction ops. For example `linalg.batch_matmul` with batch size 1 -> `linalg.matmul` and `linalg.matmul` with unit LHS spatial dim -> `linalg.vecmat`, etc. These patterns don't support reducing the rank along reduction dimension as those don't convert to other named contraction ops.
2024-06-24[RISCV][GISEL] IRTranslator for Scalable Vector Store (#86699)Jiahan Xie2-1/+951
Support IR translation for scalable vector store
2024-06-24[LLDB][Minidump] Add 64b support to LLDB's minidump file builder. (#95312)Jacob Lalonde4-220/+653
Currently, LLDB does not support taking a minidump over the 4.2gb limit imposed by uint32. In fact, currently it writes the RVA's and the headers to the end of the file, which can become corrupted due to the header offset only supporting a 32b offset. This change reorganizes how the file structure is laid out. LLDB will precalculate the number of directories required and preallocate space at the top of the file to fill in later. Additionally, thread stacks require a 32b offset, and we provision empty descriptors and keep track of them to clean up once we write the 32b memory list. For [MemoryList64](https://learn.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_memory64_list), the RVA to the start of the section itself will remain in a 32b addressable space. We achieve this by predetermining the space the memory regions will take, and only writing up to 4.2 gb of data with some buffer to allow all the MemoryDescriptor64s to also still be 32b addressable. I did not add any explicit tests to this PR because allocating 4.2gb+ to test is very expensive. However, we have 32b automation tests and I validated with in several ways, including with 5gb+ array/object and would be willing to add this as a test case.
2024-06-24[flang][runtime] Interoperable POINTER deallocation validation (#96100)Peter Klausler4-29/+64
Extend the runtime validation of deallocated pointers so that it also works when pointers are allocated &/or deallocated outside Fortran. Previously, bogus runtime errors would be reported for pointers allocated via CFI_allocate() and deallocated in Fortran, and CFI_deallocate() did not check that it was deallocating a whole contiguous pointer that was allocated as such.
2024-06-24[flang][runtime] Better handling of "fort.N" opening errors (#96347)Peter Klausler3-7/+15
When a data transfer statement references a unit number that hasn't been explicitly OPENed, the runtime I/O support library opens a local "fort.N" file where N is the unit number. If that name exists in the current working directory but is not a readable or writable file (as appropriate), the runtime needs to catch the error at the point of the READ or WRITE statement rather than leaving an open unit in the unit map without a valid file descriptor.
2024-06-24[clang][Interp] Fix classifying __builtin_addressof() argumentTimm Bäder2-2/+6
It's an lvalue, so we need to use the classify() taking an expression.
2024-06-24[flang][preprocessing] Mix preprocessing directives with free form li… ↵Peter Klausler11-33/+83
(#96244) …ne continuation Allow preprocessing directives to appear between a source line and its continuation, including conditional compilation directives (#if, #ifdef, &c.). Fixes https://github.com/llvm/llvm-project/issues/95476.
2024-06-24Fix buildbots for https://github.com/llvm/llvm-project/pull/87740Greg Clayton1-1/+1
2024-06-24[ELF] Postpone more linker script errorsFangrui Song5-16/+26
Since `assignAddresses` is executed more than once, error reporting during `assignAddresses` would be duplicated. Generalize #66854 to cover more errors. Note: address-related errors exposed in one invocation might not be errors in another invocation. Pull Request: https://github.com/llvm/llvm-project/pull/96361
2024-06-24[flang][debug] Handle allocatable strings. (#95906)Abid Qadeer4-11/+50
The allocatable strings also use DIStringType but provide dwarf expressions to find the location and length of the string. With this change in place, the debugging of the allocatable strings looks like this: character(len=:), allocatable :: first character(len=:), allocatable :: second character(len=:), allocatable :: third first = 'Mount' second = 'Everest' third = first // " " // second print *, third (gdb) p third $1 = "" (gdb) n 18 print *, third (gdb) p third $2 = 'Mount Everest' (gdb) ptype third type = character (13)
2024-06-24[LLD] [COFF] Don't crash on an empty -entry: argument (#96058)Martin Storsjö2-0/+24
We can't pass an empty string to addUndefined(). This fixes the crash that was encountered in https://github.com/llvm/llvm-project/issues/93309 (turning the crash into a properly handled error; making it do the right thing is handled in https://github.com/llvm/llvm-project/pull/96055).
2024-06-24[RISCV] Add back some test cases I inadvertently deleted. NFCCraig Topper1-0/+224
These tests were accidentally removed in a7a1195f01037e5019f671c96ef4bca9af9bb9a7. I only meant to remove bfloat tests, but I accidentally removed f32 and f64 as well.
2024-06-24Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"Stephen Tozer97-252/+326
Reverts the above commit, as it updates a common header function and did not update all callsites: https://lab.llvm.org/buildbot/#/builders/29/builds/382 This reverts commit 6481dc57612671ebe77fe9c34214fba94e1b3b27.
2024-06-24Add support for using foreign type units in .debug_names. (#87740)Greg Clayton13-43/+350
This patch adds support for the new foreign type unit support in .debug_names. Features include: - don't manually index foreign TUs if we have info for them - only use the type unit entries that match the .dwo files when we have a .dwp file - fix type unit lookups for .dwo files - fix crashers that happen due to PeekDIEName() using wrong offsets where an entry had DW_IDX_comp_unit and DW_IDX_type_unit entries and when we had no type unit support, it would cause us to think it was a normal DIE in .debug_info from the main executable. --------- Co-authored-by: paperchalice <liujunchang97@outlook.com>
2024-06-24[flang] Add/fix some semantic checks for assumed-rank (#96194)Peter Klausler7-17/+49
Catch some cases where assumed rank dummy arguments are not allowed.
2024-06-24[libc][arm] add malloc/free/aligned_alloc to entrypoints (#96516)Nick Desaulniers (paternity leave)1-0/+5
Necessary for arm32 cross full build.
2024-06-24Add a unit test for SBBreakpoint::SetCallback (#96001)Chelsea Cassanova5-17/+107
This commit adds a unit test for SBBreakpoint::SetCallback as it wasn't being tested before.
2024-06-24[IR][NFC] Update IRBuilder to use InsertPosition (#96497)Stephen Tozer97-326/+252
Uses the new InsertPosition class (added in #94226) to simplify some of the IRBuilder interface, and removes the need to pass a BasicBlock alongside a BasicBlock::iterator, using the fact that we can now get the parent basic block from the iterator even if it points to the sentinel. This patch removes the BasicBlock argument from each constructor or call to setInsertPoint. This has no functional effect, but later on as we look to remove the `Instruction *InsertBefore` argument from instruction-creation (discussed [here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)), this will simplify the process by allowing us to deprecate the InsertPosition constructor directly and catch all the cases where we use instructions rather than iterators.
2024-06-24[flang] Better error reporting for MOD/MODULO/NEAREST (#96114)Peter Klausler4-29/+99
When the second argument to these intrinsic functions is a scalar constant zero, emit a warning (if enabled) even if the first argument is not a constant.
2024-06-24[flang] Silence errors on C_LOC/C_FUNLOC in specification expressions (#96108)Peter Klausler7-78/+115
Transformational functions from the intrinsic module ISO_C_BINDING are allowed in specification expressions, so tweak some general checks that would otherwise trigger error messages about inadmissible targets, dummy procedures in specification expressions, and pure procedures with impure dummy procedures.
2024-06-24[NFC][CGSCC] Remove RCWorklist from CGSCCUpdateResult (#95448)Arthur Eubanks2-15/+8
After #94815, this is only used within ModuleToPostOrderCGSCCPassAdaptor::run(), so keep it local to that function.