13352 Commits

Author SHA1 Message Date
Wang Pengcheng
e052c68869
[SelectionDAG] Add instantiated OPC_CheckType (#73283)
The most common type is i32 or i64 so we add `OPC_CheckTypeI32` and
`OPC_CheckTypeI64` to save one byte.

Overall this reduces the llc binary size with all in-tree targets by
about 29K.
2023-12-12 17:12:08 +08:00
Kazu Hirata
586ecdf205
[llvm] Use StringRef::{starts,ends}_with (NFC) (#74956)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-11 21:01:36 -08:00
Nico Weber
30b94302f7 [gn] port 6747fc07d1aa9 (made necessary by 54397f9ac128) 2023-12-11 21:30:04 -05:00
Nico Weber
7ec3994852 [gn build] Port 54397f9ac128 2023-12-11 15:20:34 -05:00
LLVM GN Syncbot
d1c9b37d36 [gn build] Port 2460bf2facd1 2023-12-11 12:43:54 +00:00
Tobias Hieta
a3a8acd9a6
[NFC] Missing argument for the PR issue number in the code format helper 2023-12-11 09:50:04 +01:00
Tobias Hieta
bd3e8eb6e3
code-format: Improve the code-format-helper to be able to run as a git hook (#73957)
As part of #73798 there was some discussion about using the format
helper to run from a git-hook. That was not possible for a number of
reasons, but with these changes it can now be installed as a hook and
then run on the local cache in git instead of a diff between revisions.

This also checks for two environment variables DARKER_FORMAT_PATH and
CLANG_FORMAT_PATH where you can specify the path to the program you want
to use.
2023-12-11 09:35:26 +01:00
Anatoly Trosinenko
78623b079b
[GISel][TableGen] Fix accidental operand name clashes in patterns (#74492)
When importing instruction selection patterns into GlobalISel, the
operands matched in the "source" DAG are copied into corresponding
operands of the "destination" DAG according to their names (such as Rd).
If multiple operands in the source DAG share the same name, a
GIM_CheckIsSameOperand predicate makes instruction selector check the
corresponding operands for equality (at compiler run-time) as part of
matching the source pattern.

The Def operands of the root node of the destination DAG are handled
specially. The operands of the instruction corresponding to the root
node are taken and GIM_CheckRegBankForClass predicates are
tablegen-erated accordingly. If by coincidence the Def operand in
question has the same name as one of the named operands in the pattern,
a GIM_CheckIsSameOperand predicate is automatically added that is likely
to prevent matching the source of otherwise applicable selection pattern
at compiler run-time.

This patch mangles the Def operand names taken from the instruction
corresponding to the root of the destination DAG (for example, "Rd"
becomes "DstI[Rd]") preventing unexpected name clashes with pattern's
named operands.

The patch consists of three sets of changes:
* changes to the GlobalISelEmitter.cpp file are the actual fix
* a test case is added to GlobalISelEmitter.td file as a regression test
* everything else is the biggest and least interesting part - updates to
  the existing test cases: renames of the form Rd -> DstI[Rd] inside the
  inline comments in tablegen-erated code
2023-12-10 13:25:11 +03:00
Kazu Hirata
dc1f208346 [TableGen] Remove unnecessary includes (NFC)
Identified with clangd.
2023-12-07 21:03:55 -08:00
LLVM GN Syncbot
7030aab1d7 [gn build] Port 3ed940ac3dac 2023-12-07 20:26:50 +00:00
Aiden Grossman
2b1c76c7c4
[Github] Use three dot diff for darker in code format action (#74704)
Using a two dot diff allows changes made in main after the merge base to
show up in the formatting diff. Using a three dot diff fixes this and
ensures that only changes made in the source branch (branch from the PR
author) will get passed along to the formatter.

Without this, issues like #73873 occur.
2023-12-07 12:05:04 -08:00
Shengchen Kan
f17e766972 [X86][NFC] Clang-format X86DisassemblerTables.cpp for #74713 2023-12-07 20:59:21 +08:00
Pierre van Houtryve
54b6bc42aa
[TableGen][GlobalISel] Emit Comment with MatchTable Size (#74701) 2023-12-07 09:41:37 +01:00
LLVM GN Syncbot
48ca868dd3 [gn build] Port 0eb7d53cfc48 2023-12-06 20:57:38 +00:00
LLVM GN Syncbot
c37573e8c7 [gn build] Port 1e1e11a4d7c5 2023-12-06 19:52:54 +00:00
LLVM GN Syncbot
9bad6cb7fc [gn build] Port 3f73fd774cf8 2023-12-06 17:56:25 +00:00
LLVM GN Syncbot
e765a8894a [gn build] Port d77067d08a3f 2023-12-06 13:25:34 +00:00
LLVM GN Syncbot
d28194131b [gn build] Port 030b8cb1561d 2023-12-05 18:01:16 +00:00
James Y Knight
31aebdd891
Include LLVM_VERSION_SUFFIX in the Clang version string. (#74469)
This causes current mainline to now report "18.0.0git" instead of
"18.0.0".

Fixes #53825
2023-12-05 12:20:12 -05:00
David Spickett
77249546aa
[GitHub] Add greeting comment to opened PRs from new contributors (#72384)
This includes some commonly needed information like how to add
reviewers.

This is implemented as a job before the labeler, so that on a new PR the
comment is added before there are any subscribers and only the author
gets a nofitication.

The labeler job depends on the greeter having run or having been
skipped. So if the PR wasn't just opened, or it's from a regular
contributor, the labeling still happens.

But we can be sure that when a greeting comment is left, it's the very
first thing we do.
2023-12-05 11:28:43 +00:00
Nico Weber
53d498d095 [gn] port f368e6424fbf 2023-12-04 15:35:41 -05:00
LLVM GN Syncbot
83abe5703f [gn build] Port bc8cff1d7fb2 2023-12-04 14:39:50 +00:00
LLVM GN Syncbot
ad8084ff06 [gn build] Port b04b89753daf 2023-12-02 21:26:54 +00:00
LLVM GN Syncbot
7ccc4ef55f [gn build] Port c45a66ecd4cb 2023-12-02 01:42:02 +00:00
Philip Reames
e817966718
[RISCV] Collapse fast unaligned access into a single feature [nfc-ish] (#73971)
When we'd originally added unaligned-scalar-mem and
unaligned-vector-mem, they were separated into two parts under the
theory that some processor might implement one, but not the other. At
the moment, we don't have evidence of such a processor. The C/C++ level
interface, and the clang driver command lines have settled on a single
unaligned flag which indicates both scalar and vector support unaligned.
Given that, let's remove the test matrix complexity for a set of
configurations which don't appear useful.

Given these are internal feature names, I don't think we need to provide
any forward compatibility. Anyone disagree?

Note: The immediate trigger for this patch was finding another case
where the unaligned-vector-mem wasn't being properly serialized to IR
from clang which resulted in problems reproducing assembly from clang's
-emit-llvm feature. Instead of fixing this, I decided getting rid of the
complexity was the better approach.
2023-12-01 11:00:59 -08:00
Stephan T. Lavavej
2ee8763fec
[test] Fix expected line number in TestRunner.py (#73996)
My #73541 added lines to
`llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt` so what
was previously on line 7 is now on line 12.

Before:

28412d1800/llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt (L7-L8)

After:

6fb7c2d713/llvm/utils/lit/tests/Inputs/testrunner-custom-parsers/test.txt (L12-L13)

This didn't show up in the PR checks, but caused a buildbot failure
after merging, https://lab.llvm.org/buildbot/#/builders/139/builds/54597
:

```
# | ======================================================================
# | FAIL: test_commands (__main__.TestIntegratedTestKeywordParser)
# | ----------------------------------------------------------------------
# | Traceback (most recent call last):
# |   File "/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/utils/lit/tests/unit/TestRunner.py", line 135, in test_commands
# |     self.assertEqual(value[1].command.strip(), "%dbg(MY_RUN: at line 7)  foo  bar")
# | AssertionError: '%dbg(MY_RUN: at line 12)  foo  bar' != '%dbg(MY_RUN: at line 7)  foo  bar'
# | - %dbg(MY_RUN: at line 12)  foo  bar
# | ?                      ^^
# | + %dbg(MY_RUN: at line 7)  foo  bar
# | ?                      ^
```

Apologies for the build break 🙀
2023-11-30 15:06:24 -08:00
LLVM GN Syncbot
dd1e72c38f [gn build] Port c73a3f16f81a 2023-11-30 23:04:47 +00:00
Stephan T. Lavavej
4e2216e184
[libc++][test] ADDITIONAL_COMPILE_FLAGS should be a space-separated list (#73541)
Found while running libc++'s test suite with MSVC's STL.

`ADDITIONAL_COMPILE_FLAGS` is a `ParserKind.LIST`:

3c23ed156f/libcxx/utils/libcxx/test/format.py (L104-L108)

With a comma-separated example:

3c23ed156f/libcxx/utils/libcxx/test/format.py (L223-L228)

And comma-separated test coverage:

dd3184c30f/libcxx/test/libcxx/selftest/additional_compile_flags/substitutes-in-run.sh.cpp (L12-L15)

Because the machinery splits on commas:

dd09221a29/llvm/utils/lit/lit/TestRunner.py (L1882-L1883)

dd09221a29/llvm/utils/lit/lit/TestRunner.py (L1951-L1956)

However, most (although not all) usage of `ADDITIONAL_COMPILE_FLAGS` is
treating it as space-separated. That apparently works in the normal
Clang environment, but in my exotic configuration it causes `"-DMEOW
-DWOOF"` to be passed as a single argument to MSVC, which then emits
"warning C5102: ignoring invalid command-line macro definition
`'_LIBCPP_DISABLE_DEPRECATION_WARNINGS
-D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT'`", causing test failures due to
warnings-as-errors.

This PR changes `ADDITIONAL_COMPILE_FLAGS` to actually be parsed as a
space-separated list, and changes the few uses/examples that had commas.
2023-11-30 13:54:52 -08:00
LLVM GN Syncbot
7fbdee057d [gn build] Port 248446980317 2023-11-30 20:40:10 +00:00
LLVM GN Syncbot
899fd0cd66 [gn build] Port cb13e9286b6d 2023-11-30 18:02:39 +00:00
Shengchen Kan
a4e1aa256b
[X86][tablgen] Auto-gen broadcast tables (#73654)
1. Add TB_BCAST_SH for FP16
2. Auto-gen 4 broadcast tables BroadcastTable[1-4]

issue: https://github.com/llvm/llvm-project/issues/66360
2023-11-30 22:24:31 +08:00
Shengchen Kan
e78a45dd10 [X86][NFC] Refine code in X86FoldTablesEmitter.cpp
Split NFC in #73654 into a seperate commit.
2023-11-30 18:46:20 +08:00
Tom Stellard
dc16964f0e
[workflows] Remove sync-release-repo.yml (#73682)
This should not be needed now that the project uses PRs, plus the
OpenSSF Scorecard report flagged this as insecure.
2023-11-29 07:53:51 -08:00
LLVM GN Syncbot
9b192596de [gn build] Port 1a5af34e6fcb 2023-11-29 14:37:31 +00:00
Danny Mösch
6a4489a733
[GitHub] Use proper Markdown syntax and avoid child list items (#73700) 2023-11-29 08:47:57 +01:00
wangpc
d0c8d41e10 [TableGen][NFC] Format getOpcodeString and remove unreachable breaks 2023-11-29 14:58:54 +08:00
LLVM GN Syncbot
ec76d3975c [gn build] Port ed27a4edb038 2023-11-28 21:04:44 +00:00
Shengchen Kan
3c0f87147d [X86][fold-table] Add an assertion in addEntryWithFlags, NFCI 2023-11-28 21:47:57 +08:00
Shengchen Kan
bafa51c8a5 [X86] Rename X86MemoryFoldTableEntry to X86FoldTableEntry, NFCI
b/c it's used for element that folds a load, store or broadcast.
2023-11-28 19:49:14 +08:00
Shengchen Kan
c66c15a76d [X86] Rename some variables for memory fold and format code, NFCI
1. Rename the names of tables to simplify the print
2. Align the abbreviation in the same file Instr -> Inst
3. Clang-format
4. Capitalize the first char of the variable name
2023-11-28 19:07:44 +08:00
LLVM GN Syncbot
a05c23fdcf [gn build] Port dd0973be58b8 2023-11-28 10:48:31 +00:00
Pierre van Houtryve
dd0973be58
[TableGen] Split GlobalISelCombinerEmitter into multiple files (#73325)
Split MatchDataInfo, CXXPredicates and the Pattern hierarchy into their
own files.

This should help with maintenance a bit, and make the API easier to
navigate.
I hope this encourages a bit more experimentation with MIR patterns,
e.g. I'd like to try getting them in ISel at some point.

Currently, this is pretty much only moving code around. There is no
significant refactoring in there.
I want to split the Combiner backend even more at some point though,
e.g. by separating the TableGen parsing logic into yet another file so
other backends could very easily parse patterns themselves.

Note: I moved the responsibility of managing string lifetimes into the
backend instead of the Pattern class.
e.g. Before you'd do `P.addOperand(Name)` but now it's
`P.addOperand(insertStrRef(Name))`.
I verified this was done correctly by running the tests with UBSan/ASan.
2023-11-28 11:48:24 +01:00
Florian Hahn
08a6968127
[UTC] Support arm64-apple-macosx in update_llc_test_checks.py. (#73568)
arm64-apple-macosx is the default triple (usually with the macOS version
number) on arm64 macOS. Support it in update_llc_test_checks.py.
2023-11-28 10:06:20 +00:00
LLVM GN Syncbot
06157a6d86 [gn build] Port b0af8a1ede89 2023-11-28 09:47:52 +00:00
Nico Weber
4cf4c52018 Reland "[gn] port 92b821f2dcdd"
This reverts commit 344b5346a0e899d59ff52f60421788eef4e2c864.
92b821f2dcdd relanded in 04072485204c7.
2023-11-28 16:45:20 +09:00
Shengchen Kan
f3d2a31d7d [X86][CodeGen] Cleanup code for EVEX2VEX pass, NFCI
1. Remove unused variables, e.g X86Subtarget object in performCustomAdjustments
2. Define checkVEXInstPredicate directly instead of generating it b/c
   the function is small and it's unlikely we have more instructions to
   check the predicate in the future
3. Check the tables are sorted only once for each function
4. Remove some blanks and clang-format code
2023-11-28 13:11:15 +08:00
Nico Weber
5d59e97e88 [gn] port 93a2be26e7cb 2023-11-28 10:44:37 +09:00
LLVM GN Syncbot
295bd6fc4b [gn build] Port fc6b72523f3d 2023-11-27 23:53:35 +00:00
LLVM GN Syncbot
5623c44f08 [gn build] Port 4e0c48b907f1 2023-11-27 23:53:34 +00:00
Nico Weber
be1e8a659d [gn] port 12bb2910c3e3 more 2023-11-28 08:43:16 +09:00