16093 Commits

Author SHA1 Message Date
Nico Weber
4334b43c65 [gn] port bb4ed55acdbc 2025-11-05 10:44:32 -05:00
Valery Pykhtin
ba1dbdd44a
Revert "[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py." (#166549)
Reverts llvm/llvm-project#164965
2025-11-05 14:30:27 +01:00
Nico Weber
04c01f0660 [gn] port 0c7300923638403 2025-11-05 07:40:42 -05:00
Valery Pykhtin
c782ed3440
[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py. (#164965)
This change enables update_llc_test_checks.py to automatically generate
MIR checks for RUN lines that use `-stop-before` or `-stop-after` flags
allowing tests to verify intermediate compilation stages (e.g., after
instruction selection but before peephole optimizations) alongside the
final assembly output. If `-debug-only` flag is present in the run line it's
considered as the main point of interest for testing and stop flags above
are ignored (that is no MIR checks are generated).

This resulted from the scenario, when I needed to test two instruction
matching patterns where the later pattern in the peepholer reverts the
earlier pattern in the instruction selector and distinguish it from the
case when the earlier pattern didn't worked at all.

Initially created by Claude Sonnet 4.5 it was improved later to handle
conflicts in MIR <-> ASM prefixes and formatting.
2025-11-05 13:31:10 +01:00
Aiden Grossman
b296e8fdf8 [ProfCheck] Disable X86 AMX Test Case
4776451693f4a6bd18e50106edb4b3cfa766484f broke this because it started
running an existing pass using the NewPM, which caused ProfCheck to
catch existing issues. Disable it for now because we have not started
looking at anything in the Codegen pipeline. This pass is also only
enabled at O0 or if a function has optnone, so not super critical.
2025-11-05 00:50:14 +00:00
Hans Wennborg
6f91f588d9
build_llvm_release.bat: Put the 32-bit sanitizers back (#166437)
Follow-up to bcb3d2f5122276ed9969fe2b2ef4428652800377.

Even though 32-bit win/asan is not well supported, we shouldn't drop it
without some discussion at least. Also, we probably shouldn't drop the
other sanitizers that are gated by COMPILER_RT_BUILD_SANITIZERS.

The tests no longer pass after switching to the runtimes build however
(I believe that build mode runs more of the tests?), so disable them.
2025-11-04 21:19:32 +01:00
Hans Wennborg
bcb3d2f512
build_llvm_release.bat fixes (#166385)
Some followups after #131687 switched to the "runtimes build".

- The `check-sanitizer` build target doesn't exist in the runtimes build; use `check-runtimes` instead.
- ASan is not supported on 32-bit windows. Pass `-DCOMPILER_RT_BUILD_SANITIZERS=OFF`
- `check-runtimes` includes the orcjit tests, which never passed on windows; build with `-DCOMPILER_RT_BUILD_ORC=OFF`
- Various asan and libfuzzer tests fail; suppress them with `LIT_FILTER_OUT`
2025-11-04 16:41:30 +01:00
Rahul Joshi
a2495ff991
[NFC][TableGen] Emit empty lines after/before namespace scope (#166217)
Emit empty line after a namespace scope is opened and before its closed.
Adjust DirectiveEmitter code empty line emission in response to this to
avoid lot of unit test changes.
2025-11-04 07:11:26 -08:00
Jay Foad
f037f41350
[IR] Add new function attribute nocreateundeforpoison (#164809)
Also add a corresponding intrinsic property that can be used to mark
intrinsics that do not introduce poison, for example simple arithmetic
intrinsics that propagate poison just like a simple arithmetic
instruction.

As a smoke test this patch adds the new property to
llvm.amdgcn.fmul.legacy.
2025-11-04 12:00:44 +00:00
Jay Foad
99a1fcad5d
[UTC] Update AMDGPU asm regexp for private functions (#166169)
Since #163011 changed AMDGPU to use ELF mangling, the regexp failed to
match private functions because of the inconsistent presence/absence of
the .L prefix on the first line of the function e.g.:
```
.Lfoo:  ; @foo
```
2025-11-04 11:59:43 +00:00
Tomohiro Kashiwada
dec6e7380c
[LIT][Cygwin] Mark ulimit -f unsupported for Cygwin (#165849)
Cygwin doesn't support `ulimit -f` because Windows doesn't provide such
functionality.
2025-11-04 11:38:20 +02:00
Tomohiro Kashiwada
84cc2b0ebc
[LIT] replace lit.util.mkdir with pathlib.Path.mkdir (#163948)
`lit.util.mkdir` and `lit.util.mkdir_p` were written during the Python
2.x era.
Since modern `pathlib` functions have similar functionality, we can
simply use those instead.

If you encounter a path length issue after this change, the registry
value `LongPathsEnabled` must be set as described in
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
. Note that the Python runtime is already marked as a `longPathAware`
executable.

**Background:**

On Cygwin, a file named `file_name.exe` can be accessed without the
suffix, simply as `file_name`, as shown below:

```
$ echo > file_name.exe

$ file file_name.exe
file_name.exe: very short file (no magic)

$ file file_name
file_name: very short file (no magic)
```

In this situation, while running `mkdir file_name` works as intended,
checking for the existence of the target before calling `mkdir`
incorrectly reports that it already exists and thus skips the directory
creation.

```
$ test -e file_name && echo exists
exists

$ mkdir file_name && echo ok
ok

$ file file_name
file_name: directory
```

Therefore, the existence pre-check should be skipped on Cygwin. Instead
of add a workaround, refactored them.
2025-11-04 11:37:58 +02:00
Matt Arsenault
749a0e1e41
update_llc_test_checks: Recognize thumbv7k triples (#166270) 2025-11-03 18:19:58 -08:00
Mircea Trofin
cf11ff9084
Exclude another StructurizeCFG test from profcheck (#166248)
Haven't yet addressed this pass
2025-11-03 14:35:01 -08:00
Mircea Trofin
ed53c413ef
[profcheck] Exclude more tools tests (#166239)
Excluding test areas that (1) don't really pertain to the profcheck effort, and (2) are easier to maintain this way.
2025-11-03 22:12:58 +00:00
LLVM GN Syncbot
1d8d8dc6b5 [gn build] Port 1621486d676f 2025-11-03 21:43:11 +00:00
LLVM GN Syncbot
10349ca139 [gn build] Port 6747ea050dfc 2025-11-03 17:50:55 +00:00
Alan Zhao
c4763e2b90
[profcheck][InstCombine] Preserve branch weights in logical identities (#165810)
For the simplification
```
(C && A) || (!C && B) --> sel C, A, B
```
(and related), if `C` (or (`!C`)) is the condition in the select
instruction representing the logical and, we can preserve that logical
and's branch weights when emitting the new instruction. Otherwise, the
profile data is unknown.

If `C` is the condition of both logical ands, then we just take the
branch weights of the first logical and (though in practice they should
be equal.)

Furthermore, `select-safe-transforms.ii` now passes under the profcheck
configuration, so we remove it from the failing tests.

Tracking issue: #147390
2025-11-03 09:32:42 -08:00
LLVM GN Syncbot
2ea1edbeea [gn build] Port de2797c888e0 2025-11-03 13:22:03 +00:00
Kazu Hirata
fe01594a65
[TableGen] Use std::move properly (NFC) (#166104)
This patch removes const to allow std::move a couple of lines below to
perform a move operation as intended.

Identified with performance-move-const.
2025-11-02 22:42:32 -08:00
Kazu Hirata
4eed68357e
[llvm] Use "= default" (NFC) (#166088)
Identified with modernize-use-equals-default.
2025-11-02 17:16:47 -08:00
LLVM GN Syncbot
cf518363f2 [gn build] Port 6b147b46fefc 2025-11-02 22:09:03 +00:00
Kazu Hirata
707bab651f
[llvm] Remove redundant typename (NFC) (#166087)
Identified with readability-redundant-typename.
2025-11-02 13:15:16 -08:00
LLVM GN Syncbot
9cf51a7a3b [gn build] Port 605a7d653409 2025-11-02 18:45:59 +00:00
LLVM GN Syncbot
ccf128ee6f [gn build] Port 2527b071ba2e 2025-11-02 18:45:58 +00:00
Nico Weber
5abbb568fd [gn] port 128af4503aa3 2025-11-02 13:22:36 -05:00
Kazu Hirata
83195d9541
[TableGen] Use "= default" (NFC) (#165968)
Identified with modernize-use-equals-default.
2025-11-01 09:25:04 -07:00
Kunqiu Chen
82cf54fbf6
[UTC] CHECK-EMPTY instead of skipping blank lines (#165718)
Previously, any blank lines in IR were ignored by UTC, leading to more
fragile `CHECK`s being generated.

This change lets UTC, 1) emit `CHECK-EMPTY` to check blank lines, and 2)
generate more `CHECK-NEXT`s, landing the discussion
https://github.com/llvm/llvm-project/pull/165419#issuecomment-3457572422.

Moreover, this change also aligns the behavior of IR check-gen to ASM
check-gen, which has been emitting `CHECK-EMPTY` since
a8a89c77ea.
2025-11-01 17:01:30 +08:00
Mircea Trofin
045f3ceb84
Add test cases to profcheck-xfail.txt in unfixed (yet) areas (#165933)
A remaining failing one, under SimplifyCFG (which is pass that we did fix) is covered in #165931
2025-10-31 15:45:36 -07:00
Mircea Trofin
fe8ab75b40
[SimplifyCFG] Propagate profile in simplifySwitchOfPowersOfTwo (#165804)
`simplifySwitchOfPowersOfTwo`​ converts (when applicable, see `00f5a1e30b`​) a switch to a conditional branch. Its false case goes to the `default`​ target of the former switch, and the true case goes to a BB performing a `cttz`​. We can calculate the branch weights from the branch weights of the old switch.

Issue #147390
2025-10-31 13:05:18 -07:00
Kazu Hirata
da5a3c959f
[MC] Remove SMRange(std::nullopt_t) (#165832)
This patch removes SMRange(std::nullopt_t) to reduce the number of
uses of std::nullopt outside the context of std::optional.  Since
there are only a handful of uses, this patch removes the constructor
without going through deprecation.

The use of std::nullopt here has its root in llvm::None, which was
used as a convenient way to indicate "nothing" before we migrated
llvm::Optional to std::optional.
2025-10-31 09:42:15 -07:00
Kunqiu Chen
511c9c0648
[UTC] Support to test annotated IR (#165419)
Some analysis/transformation, e.g., predicate info/ mem ssa, insert
instruction annotations as comments, referring to
https://github.com/llvm/llvm-project/pull/165249#discussion_r2466200672.

This PR makes UTC support checking these instruction annotations with an
extra UTC option `-check-inst-comments`.

E.g., 
Before:
```LLVM
; CHECK:         [[Z_0:%.*]] = bitcast i1 [[Z]] to i1
```
After:
```LLVM
; CHECK-NEXT:  ; branch predicate info { TrueEdge: 0 Comparison: [[Z]] = and i1 [[XZ]], [[YZ]] Edge: [label [[TMP0:%.*]],label %nope], RenamedOp: [[Z]] }
; CHECK-NEXT:    [[Z_0:%.*]] = bitcast i1 [[Z]] to i1
```

This PR also regenerates all UTC-generated tests for PredicateInfo; No
MemSSA test is updated, as there are no UTC-generated tests designated
for `print<memoryssa>`.
2025-10-31 21:04:35 +08:00
LLVM GN Syncbot
0509845994 [gn build] Port 5322fb626820 2025-10-31 12:03:56 +00:00
Mikołaj Piróg
5322fb6268
[X86] Remove AMX-TRANSPOSE (#165556)
Per Intel Architecture Instruction Set Extensions Programming Reference
rev. 59 (https://cdrdv2.intel.com/v1/dl/getContent/671368), Revision
History entry for revision -59, AMX-TRANSPOSE was removed
2025-10-31 12:50:21 +01:00
David Spickett
94f3eeee94
[llvm][clang] Remove handling of Python2 ConfigParser module name (#163727)
LLVM now requires Python >= 3.8, and ConfigParser was renamed to
configparser in 3.0:
https://docs.python.org/3/whatsnew/3.0.html#library-changes

A few places imported it under the Python2 name even for Python3, I have
swapped those to the Python3 name.

This was reported by https://pypi.org/project/vermin/ as the file having
incompatible versions. Since once import is 2.x and one is 3.x.
2025-10-31 09:45:55 +00:00
Aiden Grossman
1f702d4ee8 [lit] Mark ulimit test as unsupported on Solaris
160058fc19a9bcb70feb442a755229838b4dbc7a broke the Solaris bots because
they do not support RLIMIT_FSIZE despite it being in POSIX 2004. Disable
it there for now as the loss of test coverage should not be significant.
2025-10-31 00:02:59 +00:00
Baranov Victor
6c1678abce
[CI] Remove unused variable in code-format job (#165454)
`comments` were never used plus generated pylint error
2025-10-31 00:42:31 +03:00
Aiden Grossman
28e98b8501
[lit] Expand late substitutions before running builtins
This enables the use of readfile substitutions for populating
environment variables. This is necessary in some compiler-rt tests.

Reviewers: pawosm-arm

Reviewed By: pawosm-arm

Pull Request: https://github.com/llvm/llvm-project/pull/165140
2025-10-30 11:28:11 -07:00
Aiden Grossman
160058fc19 [lit] Move ulimit_unlimited.txt test to non Darwin tests
This fails on MacOS because setting it to unlimited there just sets the
limit to the max value which causes differences that show up in the
check lines.
2025-10-30 17:47:38 +00:00
Aiden Grossman
9b02901b26
[lit] Add support for setting limits to unlimited
This is used by a couple compiler-rt tests.

Reviewers: petrhosek, ilovepi

Reviewed By: ilovepi

Pull Request: https://github.com/llvm/llvm-project/pull/165123
2025-10-30 09:27:47 -07:00
Aiden Grossman
57ff891372 [lit] Remove setting stack size in ulimit_okay.txt
This was supposed to be in 6ccd1e8626f331f2ec2b172c3e7e8fffee66ac95 but
got left out because I forgot to save the file inside of VSCode. This
was causing test failures on MacOS due to the previously mentioned
failures setting ulimit that caused the patch to be reverted in the
first place.

https://lab.llvm.org/buildbot/#/builders/190/builds/29990
2025-10-30 14:49:22 +00:00
Aiden Grossman
6ccd1e8626 Reapply "[lit] Support more ulimit options"
This reverts commit 57722ddce172f569f04a50b76ccb2fc524adf8f5.

This caused some MacOS test failures due to resource there having issues
with RLIMIT_STACK. The underlying syscall fails with EINVAL despite
the values being correct. For now, move this to the non Darwin test.
2025-10-30 14:28:33 +00:00
Valery Pykhtin
44f5ae3eec
[utils][UpdateTestChecks] Extract MIR functionality into separate mir.py module (#165535)
This commit extracts some MIR-related code from `common.py` and
`update_mir_test_checks.py` into a dedicated `mir.py` module to improve
code organization. This is a preparation step for
https://github.com/llvm/llvm-project/pull/164965 and also moves some
pieces already moved by https://github.com/llvm/llvm-project/pull/140296

All code intentionally moved verbatim with minimal necessary
adaptations:
* `log()` calls converted to `print(..., file=sys.stderr)` at `mir.py`
lines 62, 64 due to a `log` locality.
2025-10-30 09:41:33 +01:00
LLVM GN Syncbot
c1423f36da [gn build] Port e9389436e5ea 2025-10-29 20:31:09 +00:00
Baranov Victor
a449c349ec
[CI] fix typo in code-format job (#165461) 2025-10-28 22:01:27 +03:00
Mircea Trofin
a4950c4fa1
Add switch_case.test to profcheck-xfail.txt (#165407) 2025-10-28 07:46:48 -07:00
Kunqiu Chen
566c7311d4
[UTC] Indent switch cases (#165212)
LLVM prints switch cases indented by 2 additional spaces, as follows:
```LLVM
  switch i32 %x, label %default [
    i32 0, label %phi
    i32 1, label %phi
  ]
```

Since this only changes the output IR of update_test_checks.py and does
not change the logic of the File Check Pattern, there seems to be no
need to update the existing test cases.
2025-10-28 22:00:54 +08:00
Björn Pettersson
44cb8c1e00
[lit] Fix to make "RUN: env PATH=..." work as intended (#165308)
There was a bug in llvm-lit related to setting PATH using env in the
internal shell.

The new PATH wasn't used when looking up the command to be executed. So
when doing things like this in a test case
  RUN: mkdir %t
  RUN: env PATH=%t program ...
the internal shell would search for "program" using the orignal PATH and
not the PATH set by env when preceeding the command.

It seems like this was a simple mistake in commit 57782eff31e9d454,
since the logic to pick a PATH from the cmd_shenv instead of shenv
actually was added in that patch, but the resulting path wasn't used.
2025-10-28 14:33:04 +01:00
LLVM GN Syncbot
76e2963f3c [gn build] Port 81de86123fcf 2025-10-28 04:57:30 +00:00
LLVM GN Syncbot
3cecb7b23f [gn build] Port 5fda2a5d9c1a 2025-10-28 04:57:29 +00:00