aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-07-04[mlir][python] Add debug helpersusers/nico/python-2Nicolas Vasilache10-6/+247
This PR lets users provide --debug-only flags with python decorators. This greatly simplifies the debugging experience in python. Co-authored-by: Tres <tpopp@users.noreply.github.com>
2025-07-04[mlir][python] Add utils for more pythonic context creation and registration ↵users/nico/python-1Nicolas Vasilache7-0/+291
management Co-authored-by: Fabian Mora <fmora.dev@gmail.com Co-authored-by: Oleksandr "Alex" Zinenko <git@ozinenko.com> Co-authored-by: Tres <tpopp@users.noreply.github.com>
2025-07-03[mlir][toy] Use `make_early_inc_range` when erasing ops during iteration ↵Matthias Springer2-2/+2
(#146892) Use `make_early_inc_range` when erasing operations from a block to make sure that the iterator is not invalidated. The previous implementation happened to work on a "normal" dialect conversion because some IR modifications are delayed. It no longer works with a One-Shot Dialect Conversion. The new One-Shot Dialect Conversion API is more similar to the normal rewriter API.
2025-07-03[lldb][test] Run generic set formatter test-case on specified STL (#146882)Michael Buch1-1/+1
Previously the parameter wasn't respected. So we would only run the test with whatever stdlib the `Makefile.rules` deduced. Confirmed that ``` lldb-dotest -p TestDataFormatterGenericSet.py --category libstdcxx ``` passes on my machine.
2025-07-03[lldb] Remove PRIuFT macro and use LLDB_LOG instead (#146867)David Spickett2-20/+10
We don't want this as part of the public API, and using LLDB_LOG avoids some warnings when compiling on Windows.
2025-07-03[lldb][test] Turn std::chrono libcxx test generic (#146873)Michael Buch3-9/+9
Split out from #146740
2025-07-03[lldb][test] Turn std::atomic libcxx test generic (#146843)Michael Buch3-24/+21
Split out from https://github.com/llvm/llvm-project/pull/146740
2025-07-03[lldb][test] XFAIL TestIRInterpreter.py on Windows againDavid Spickett1-2/+4
I must have been mistaken because this test does still fail on Windows on Arm. At least the test code is Windows compatible now.
2025-07-03[LLDB] Optimize identifier lookup in DIL (#146094)Ilia Kuklin6-136/+79
Remove unused code and unnecessary function calls, optimize global variable search. Add more test cases.
2025-07-03[OpenACC][Sema] Implement warning for 'cache' invalid var referichkeane13-28/+302
The 'cache' construct is lowered as marking the acc.loop in ACC MLIR. This results in any variable references that are not inside of the acc.loop being invalid. This patch adds a warning to that effect, and ensures that the variable references won't be added to the AST during parsing so we don't try to lower them. This results in loss of instantiation-diagnostics for these, however that seems like an acceptable consequence to ignoring it.
2025-07-03Revert "[mlgo][regalloc] Fix after PR #131837" (#146897)Mircea Trofin3-45/+45
Reverts llvm/llvm-project#146297 because #131837 is reverted in #146850
2025-07-03[analyzer] Correct Z3 test cases, fix exposed crashes (#146597)vabridgers4-9/+9
PR145731 corrected the analyzer test runner to consider use of z3 when used by testcases, which exposed problems in test cases PR37855.c and crashes in z3-crosscheck.c This change fixes those crashes and re-enables the test cases that were "XFAIL"'d out. Co-authored-by: einvbri <vince.a.bridgers@ericsson.com>
2025-07-03 [DLCov] Origin-Tracking: Collect stack traces in DebugLoc (#146678)Stephen Tozer4-9/+75
This patch is part of a series that adds origin-tracking to the debugify source location coverage checks, allowing us to report symbolized stack traces of the point where missing source locations appear. This patch adds the logic for collecting stack traces in DebugLoc instances. We do not symbolize the stack traces in this patch - that only happens when we decide to actually print them, which will be the responsibility of debugify. The collection happens in the constructor of a DebugLoc that has neither a valid location nor an annotation; we also collect an extra stack trace every time we call setDebugLoc, as sometimes the more interesting point is not where the DebugLoc was constructed, but where it was applied to an instruction. This takes the form of a getCopied() method on DebugLoc, which is the identity function in normal builds, but adds an extra stack trace in origin-tracking builds.
2025-07-03[X86] commuteSelect - update to use SDPatternMatch. NFC. (#146868)Simon Pilgrim1-16/+11
2025-07-03[mlir][SCF][NFC] Remove duplicate `getConstantTripCount` implementation ↵Matthias Springer1-13/+2
(#146347)
2025-07-03[clang][test] Correct UNSUPPORTED syntax in print-ranges.cppDavid Spickett1-1/+1
Without the ":" it doesn't work.
2025-07-03[llvm][dsymutil][test] Fix REQUIRES syntaxDavid Spickett1-1/+1
It must be "REQUIRES:", "REQUIRES :" does not actually check the requirement.
2025-07-03[llvm][test] Fix REQUIRES in extractelement-insertpoint.llDavid Spickett1-1/+1
The target is called "x86" not "x86_64".
2025-07-03[llvm][llc][test] Fix REQUIRES in regalloc pipeline testDavid Spickett1-1/+1
Two problems here: * Missing ":" after REQUIRES, so it was never checked for and ran anyway. * The target name is "x86" not "x86_64".
2025-07-03[LSR] Strip dead code (NFC) (#146109)Ramkumar Ramachandra1-9/+0
Nested AddRec is already rejected by the handling in pushSCEV().
2025-07-03[Bitcode] Add abbreviations for additional instructions (#146825)Nikita Popov2-8/+76
Add abbreviations for icmp/fcmp, store and br, which are the most common instructions that don't have abbreviations yet. This requires increasing the abbreviation size to 5 bits. This gives about 3-5% bitcode size reductions for the clang build.
2025-07-03[X86] fp128-select.ll - remove CFI noiseSimon Pilgrim1-22/+2
2025-07-03[lldb-dap] Prevent using an implicit `step-in`. (#143644)Ebuka Ezike7-7/+88
When there is a function that is inlined at the current program counter. If you get the current `line_entry` using the program counter's address it will point to the location of the inline function that may be in another file. (this is in implicit step-in and should not happen what step over is called). Use the current frame to get the `line_entry`
2025-07-03[flang] fix skip-external-rtti-definition for ppc (#146826)jeanPerier1-2/+2
PPC does not use comdat. There is no need to check for that in the test, just remove it. Fix for https://lab.llvm.org/buildbot/#/builders/201/builds/5278
2025-07-03[flang] improve DITypeAttr caching with recursive derived types (#146543)jeanPerier4-111/+354
The current DITypeAttr caching for derived type debug metadata generation strategy is not optimal. This turns out to be an issue for compile times in apps with very very complex derived types like CP2K See the added debug-cyclic-derived-type-caching-simple.f90 test for more details about the duplication issue. As a real world example justifying the new non trivial caching strategy, in CP2K, emitting debug type info for the swarm_worker_type` in swarm_worker.F caused 1,747,347 llvm debug metadata nodes to be emitted instead of 8023 after this patch (200x less) leading to noticeable compile time improvements (I measured 0.12s spent in `AddDebugInfo` pass instead of 7.5s prior to this patch). The main idea is that caching is now associating to the cached DITypeAttr tree for a derived type a list of parent nodes being referred to recursively via indices in this DITypeAttr. When leaving the context of a parent node, all types that were cached and linked to this parent node are cleared from the cache. This allows more reusage in sub-trees while still fulfilling the MLIR requirements that DITypeAttr types referring to a parent DITypeAttr via integer id should only be used inside the DITypeAttr of the parent. Most of the complexity comes from computing the "list of parent nodes" by merging the ones from the components. This is made is such a way that the extra cost for apps without recursive derived type is minimal because the extra data structure should not require extra dynamic allocations when they are no or little recursion. Example: Take the following type graph (Fortran source for it in the added debug-cyclic-derived-type-caching-complex.f90). A is the tope level types, and has direct components of types B, C, and E. There are cycles in the type tree introduced by type B and D. Types `C` and `E` are of interest here because they are in the middle of those cycles and appear in several places in the type tree. There occurrences is labeled in brackets in the order of visit by the DebugTypeGenerator. ``` A -> B -> C [1] -> D -> E [1] -> F -> G -> B | | | | | | | | -> D | | | | | | -> H -> E [2] -> F -> G -> B | | | | | |-> D | | | | -> I -> E [3] -> F -> G -> B | | | | | |-> D | | -> C [2] | | -> C [3] -> D | -> E [4] -> F -> G -> B | | -> D ``` With this patch, E[2] and E[3] can share the same DITypeAttr as well as C[1] and C[2] while they previously all got there own nodes. To be safe with regards to cycles in MLIR, a DITypeAttr created for a node N2 under a node N1 being recursively referred to and above the recursive reference to N1 shall not be used above N1 in the DITypeAttr tree. It can however be used in several places under N1. Hence here: -E[2] cannot reuse E[1] DITypeAttr because D appears above and under E[1]. -E[3] can reuse E[2] DITypeAttr because they are both under B and above D. -E[4] cannot reuse E[3] DITypeAttr because it is above B. This is achieved by this patch because when visiting A and reaching B, the recursive reference to B is registered in the visit context. This context is added D when going back-up in F. So when reaching back E[1] with the information to build its DITypeAttr, its recursive references are known and saved along the DITypeAttr in the cache. When reaching back D, the cache for E is cleared because it is known it depended on D. A new DITypeAttr is created after E[2], and this time it only depends on B because the D under E[2] is not a recursive reference (D is not above E[2]). Hence, when reaching E[3] it can be reused, and the cache entry for E[2] is cleared when reaching B, which leads to a new DITypeAttr to be created for E[4].
2025-07-03[OpenMP] Make headers parse standalone. NFCBenjamin Kramer2-0/+6
2025-07-03[ORC] Add cloneToContext: Clone Module to a given ThreadSafeContext (#146852)Lang Hames3-34/+101
This is a generalization of the existing cloneToNewContext operation: rather than cloning the given module into a new ThreadSafeContext it clones it into any given ThreadSafeContext. The given ThreadSafeContext is locked to ensure that the cloning operation is safe.
2025-07-03[clang][python][test] Move python binding tests to lit framework (#146844)Jannick Kremer40-69/+86
As discussed in PR #142353, the current testsuite of the `clang` Python bindings has several issues: - It `libclang.so` cannot be loaded into `python` to run the testsuite, the whole `ninja check-all` aborts. - The result of running the testsuite isn't report like the `lit`-based tests, rendering them almost invisible. - The testsuite is disabled in a non-obvious way (`RUN_PYTHON_TESTS`) in `tests/CMakeLists.txt`, which again doesn't show up in the test results. All these issues can be avoided by integrating the Python bindings tests with `lit`, which is what this patch does: - The actual test lives in `clang/test/bindings/python/bindings.sh` and is run by `lit`. - The current `clang/bindings/python/tests` directory (minus the now-subperfluous `CMakeLists.txt`) is moved into the same directory. - The check if `libclang` is loadable (originally from PR #142353) is now handled via a new `lit` feature, `libclang-loadable`. - The various ways to disable the tests have been turned into `XFAIL`s as appropriate. This isn't complete and not completely tested yet. Tested on `sparc-sun-solaris2.11`, `sparcv9-sun-solaris2.11`, `i386-pc-solaris2.11`, `amd64-pc-solaris2.11`, `i686-pc-linux-gnu`, and `x86_64-pc-linux-gnu`. Co-authored-by: Rainer Orth <ro@gcc.gnu.org>
2025-07-03[PHIElimination] Revert #131837 #146320 #146337 (#146850)Guy David142-44392/+43902
Reverting because mis-compiles: - https://github.com/llvm/llvm-project/pull/131837 - https://github.com/llvm/llvm-project/pull/146320 - https://github.com/llvm/llvm-project/pull/146337
2025-07-03[mlir][bufferization] Do not access operation after it was replaced (#146860)Matthias Springer1-1/+1
Accessing an erased operation will no longer work during a One-Shot Dialect Conversion.
2025-07-03[RISCV] Remove unneeded blank line between the features for XAndesVBFHCvt ↵Jim Lin1-1/+0
and XAndesVPackFPH. NFC.
2025-07-03[LangRef] Revisit attributes semantics after opaque ptr migration (NFC)Antonio Frighetto1-9/+5
Outdated pointee-type phrasings in ABI attributes have been removed.
2025-07-03[C++20] [Modules] Use current named module to do module local lookupChuanqi Xu2-4/+59
See the attached test for the motiviation. Previously we dependent on the module ownership of the decl context to perform module local lookup. But if the lookup is unqualified, we may perform the lookup with canonical decl, which belongs to the incorrect named module
2025-07-03[NFC] [C++] [Modules] Mark P1979 as implemented and add test (#146841)Ashwin Kishin Banwari2-1/+39
Proposal https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1979r0.html appears to already be implemented as of Clang17. See: https://godbolt.org/z/h59Mvzq6P
2025-07-03[VPlan] Don't convert VPWidenSelectRecipes to vp.select in EVL transform ↵Luke Lau8-123/+36
(#146695) createEVLRecipe tries to optimise recipes that use the header mask by replacing them with their VP equivalents and setting the EVL, allowing the mask to be removed. However we currently also convert widened selects to vp.select even though they don't necessarily use the header mask. Unlike vp.merge a vp.select only makes the "unused" lanes past EVL poison, so it's not needed for correctness. In the same vein as #127180, this patch removes the transform for VPWidenSelectRecipes and keeps them as plain select instructions to allow for more optimisations. RISCVVLOptimizer will still be able to optimise away any VL toggles and we end up with better code generation across llvm-test-suite and SPEC CPU 2017.
2025-07-03[lldb][Windows] Fix compilation warningsDavid Spickett1-3/+4
As seen on Linaro's Windows on Arm bot. C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\source\Host\windows\MainLoopWindows.cpp(80,25): warning: missing field 'InternalHigh' initializer [-Wmissing-field-initializers] 80 | OVERLAPPED ov = {0}; | ^ C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\source\Host\windows\MainLoopWindows.cpp(135,8): warning: 'WillPoll' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] 135 | void WillPoll() { | ^ C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\include\lldb/Host/windows/MainLoopWindows.h(40,18): note: overridden virtual function is here 40 | virtual void WillPoll() {} | ^ C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\source\Host\windows\MainLoopWindows.cpp(142,8): warning: 'DidPoll' overrides a member function but is not marked 'override' [-Winconsistent-missing-override] 142 | void DidPoll() { | ^ C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\include\lldb/Host/windows/MainLoopWindows.h(41,18): note: overridden virtual function is here 41 | virtual void DidPoll() {} | ^ C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\source\Host\windows\MainLoopWindows.cpp(80,25): warning: missing field 'InternalHigh' initializer [-Wmissing-field-initializers] 80 | OVERLAPPED ov = {0}; | ^
2025-07-03[lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr (#146686)David Spickett1-6/+2
Not that we ever do that, because this is unused code, but if someone was debugging lldb I guess they'd call this. Was missed in https://github.com/llvm/llvm-project/pull/145645 Relates to https://github.com/llvm/llvm-project/issues/135208
2025-07-03[MLIR/Utils] Add missing dep on Arith dialect (#146834)Thomas Preud'homme1-0/+1
Fix the following compile error when building libMLIRDialectUtils.a only: In file included from mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h:17, from mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp:9: mlir/include/mlir/Dialect/Arith/IR/Arith.h:28:10: fatal error: mlir/Dialect/Arith/IR/ArithOpsDialect.h.inc: No such file or directory ArithDialect dependency is now needed since 0515449f6dcb452ea0b089fb3057d469c3cffa3f to create arith.muli op.
2025-07-03[lldb][test] Disable TestIRInterpreter.py on x86_64 WindowsDavid Spickett1-0/+2
Fails there https://lab.llvm.org/buildbot/#/builders/211/builds/197.
2025-07-03[lldb][mcp] Skip MCPUnixSocketCommandTestCase if remote (#146807)Alexandre Perez1-0/+1
It looks like #146603 broke the [lldb-remote-linux-win](https://lab.llvm.org/buildbot/#/builders/197) build bot because `MCPUnixSocketCommandTestCase` is trying to start a protocol-server via unix domain sockets on windows. This change makes it so the test is skipped if it is remote.
2025-07-03[ORC] Fix file header comment formatting. NFC.Lang Hames1-2/+1
2025-07-03[WebAssembly] Fold TargetGlobalAddress with added offset (#145829)jjasmine4-4/+26
Previously we only folded TargetGlobalAddresses into the memarg if they were on their own, so this patch supports folding TargetGlobalAddresses that are added to some other offset. Previously we weren't able to do this because we didn't have nuw on the add, but we can now that getelementptr has nuw and is plumbed through to the add in 0564d0665b302d1c7861e03d2995612f46613a0f. Fixes #61930
2025-07-03[lldb][test] Enable TestExpressionInSyscall.py on WindowsDavid Spickett1-7/+6
Relates to https://github.com/llvm/llvm-project/issues/22139 Just had to use the right win32 call instead of getpid. The original problem was something with expressions in general which was fixed at some point. Also make the test one method, there's no need to split it up.
2025-07-03[DAG] combineVSelectWithAllOnesOrZeros - reusing existing VT. NFC.Simon Pilgrim1-4/+3
2025-07-03[lldb][test] Correct TestIRInterpreterDavid Spickett1-1/+1
In 563bea91222f534d90c2baa645a5e2bc4132e9a8 I misssed calling getpid. Which still works but doesn't do what we intended.
2025-07-03[lldb][test] Enable TestIRInterpreter on WindowsDavid Spickett1-2/+8
Relates to https://github.com/llvm/llvm-project/issues/22139 This used to be broken because the expressions didn't work, but the test also used getpid which isn't avaialable on Windows. So when the expressions started working, evaluation still failed due to getpid. I made it call GetCurrentProcessId and it worked.
2025-07-03[flang][debug] Generate DISubprogramAttr for omp::TargetOp. (#146532)Abid Qadeer14-58/+311
This is combination of https://github.com/llvm/llvm-project/pull/138149 and https://github.com/llvm/llvm-project/pull/138039 which were opened separately for ease of reviewing. Only other change is adjustments in 2 tests which have gone in since. There are `DeclareOp` present for the variables mapped into target region. That allow us to generate debug information for them. But the `TargetOp` is still part of parent function and those variables get the parent function's `DISubprogram` as a scope. In `OMPIRBuilder`, a new function is created for the `TargetOp`. We also create a new `DISubprogram` for it. All the variables that were in the target region now have to be updated to have the correct scope. This after the fact updating of debug information becomes very difficult in certain cases. Take the example of variable arrays. The type of those arrays depend on the artificial `DILocalVariable`(s) which hold the size(s) of the array. This new function will now require that we generate the new variable and and new types. Similar issue exist for character type variables too. To avoid this after the fact updating, this PR generates a `DISubprogramAttr` for the `TargetOp` while generating the debug info in `flang`. Then we don't need to generate a `DISubprogram` in `OMPIRBuilder`. This change is made a bit more complicated by the the fact that in new scheme, the debug location already points to the new `DISubprogram` by the time it reaches `convertOmpTarget`. But we need some code generation in the parent function so we have to carefully manage the debug locations. This fixes issue `#134991`.
2025-07-03[lldb][Commands][NFC] image lookup: remove unused local variable (#146554)Michael Buch1-4/+1
The `current_module` pointer here was never set, but we check it when looping over the `target_modules` list. Presumably the intention was to avoid calling `LookupInModule` if we already found the type in the current module. This patch removes this `current_module`. If we decide the output below is not what the user should see, we can revisit the implementation. Current output: ``` (lldb) im loo -vt Foo --all Best match found in /Users/jonas/Git/llvm-worktrees/llvm-project/a.out: id = {0x00000037}, name = "Foo", byte-size = 1, decl = foo.cpp:1, compiler_type = "struct Foo { }" 1 match found in /Users/jonas/Git/llvm-worktrees/llvm-project/a.out: id = {0x00000037}, name = "Foo", byte-size = 1, decl = foo.cpp:1, compiler_type = "struct Foo { }" ``` which seems fine. Note, there can be multiple matches *within* the current module, so if we did the naive thing of skipping the `current_module` when printing with `--all`, then we would miss some matches.
2025-07-03[lldb][DWARF][NFC] Reduce scope of ref_addr_size variable (#146557)Michael Buch1-10/+6
Follow-up to https://github.com/llvm/llvm-project/pull/145645#discussion_r2174948997 There's no need for this variable to be declared at the function-level. We reset it in all the cases where it's used anyway. This patch just inlines the usage of the variable entirely.
2025-07-03[LLDB] Mark TestCallStdStringFunction as XPASS on Windows (#146835)nerix1-1/+0
#146562 made [TestCallStdStringFunction](https://github.com/llvm/llvm-project/blob/bd6cd92984e7a30cb91e4f069a0bacc5c582a234/lldb/test/API/commands/expression/call-function/TestCallStdStringFunction.py) unexpectedly pass on Windows. The test now passes, because `expression str` now prints the "raw" string object, which happens to include the string "Hello world". Previously, this resulted in an error: ``` (lldb) expression str (std::string) $0 = { _Mypair = { _Myval2 = { _Bx = (_Buf = "Hello world", _Ptr = "", _Alias = "Hello world") _Mysize = 11 _Myres = 15 } } } (lldb) type summary add std::string --summary-string "${var._M_dataplus._M_p}" ^^^ previous summary ^^^ (lldb) expression str (std::string) $1 = error: summary string parsing error ``` #143177 will eventually add the correct summary for MSVC STL strings. Relates to https://github.com/llvm/llvm-project/issues/22139