14924 Commits

Author SHA1 Message Date
LLVM GN Syncbot
37952ef75f [gn build] Port 92f916faba13 2025-02-12 22:22:01 +00:00
Rahul Joshi
bee9664970
[TableGen] Emit OpName as an enum class instead of a namespace (#125313)
- Change InstrInfoEmitter to emit OpName as an enum class
  instead of an anonymous enum in the OpName namespace.
- This will help clearly distinguish between values that are 
  OpNames vs just operand indices and should help avoid
  bugs due to confusion between the two.
- Rename OpName::OPERAND_LAST to NUM_OPERAND_NAMES.
- Emit declaration of getOperandIdx() along with the OpName
  enum so it doesn't have to be repeated in various headers.
- Also updated AMDGPU, RISCV, and WebAssembly backends
  to conform to the new definition of OpName (mostly
  mechanical changes).
2025-02-12 08:19:30 -08:00
Nico Weber
e5268191e6 [gn] port fc4d87100a0 2025-02-12 09:50:32 -05:00
LLVM GN Syncbot
caa9fae2e7 [gn build] Port cc7e83601d75 2025-02-12 04:14:13 +00:00
Aaron Siddhartha Mondal
55ae118db7
[GitHub] Skip undefcheck if no relevant files changed (#126749)
If the list of filtered files was empty the check would process every
file in the diff.
2025-02-11 18:43:27 +01:00
Rahul Joshi
dbe1dafdbd
[NFC][TableGen] Code cleanup in InstrInfoEmitter.cpp (#126578)
- Use range for loops and `enumerate` in a few places.
- Use `StringRef` for `TargetName` in `InstrInfoEmitter::run`.
- Use `\n` character for new line instead of string.
- Use StringRef in `InstrNames` (instead of std::string) and 
  avoid string copies.
2025-02-11 07:02:37 -08:00
LLVM GN Syncbot
d89c23b487 [gn build] Port bf2d4eb7030b 2025-02-11 14:23:29 +00:00
David Spickett
19fc8e3846 [GitHub] Correct word in commit access request greeting 2025-02-11 10:28:31 +00:00
Rahul Joshi
0f674cce82
[NFC][LLVM] Remove unused TargetIntrinsicInfo class (#126003)
Remove `TargetIntrinsicInfo` class as its practically unused (its pure
virtual with no subclasses) and its references in the code.
2025-02-10 14:56:30 -08:00
Tom Stellard
cd26c112b2
[llvm][GitHub] Move PR project status to Done once backport PR is made (#126374)
It's common to use the /cherry-pick command on a PR to create a backport
request. However, this creates a lot of clutter in the LLVM Release
Status project, because we end up with two items in the project, one for
the original PR and one for the new PR.

This change will set the status of the original PR to Done once the new
PR (for the release branch) is created. This will save release managers
a lot of work of having to manually updated the status for PRs that
contain backport requests.
2025-02-10 13:06:51 -08:00
LLVM GN Syncbot
d11b9b7275 [gn build] Port f332455dd9a2 2025-02-10 20:26:39 +00:00
Rahul Joshi
55015e150b
[NFC][TableGen] Delete getLogicalOperandType from InstrInfoEmitter (#125951)
Delete `getLogicalOperandType` function from InstrInfoEmitter as no
backend seems to use it.
2025-02-10 09:08:49 -08:00
Rahul Joshi
8380b5c749
[TableGen][InstrInfo] Cull mapping that have not been enabled/not needed (#126137)
- Detect whether logical operand mapping/named operand mappings have 
  been enabled in a previous pass over instructions and execute the
  relevant emission code only if those mappings are enabled.
- For these mappings, skip the fixed set of predefined instructions as
  they won't have these mappings enabled.
- Emit operand type mappings only for X86 target, as they are only used
  by X86 and look for X86 specific `X86MemOperand`.
- Cleanup `emitOperandTypeMappings` code: remove code to handle empty
  instruction list and use range for loops.
2025-02-10 08:16:12 -08:00
David Spickett
83af335ea4
[llvm][lit] Update regexes in Xunit test (#126527)
I got a report that downstream this test failed and the cause was that
it took longer than the 1 second we expected to run one of the test
cases.

This test doesn't need to be that specific, so I am updating all the
time regexes to be the same one that allows 0-9 any number of digits,
requires a decimal point, then 0-9 any number of digits for the final
part.
2025-02-10 16:07:57 +00:00
Donát Nagy
729416e586
[analyzer][NFC] Remove "V2" from ArrayBoundCheckerV2.cpp (#126094)
Previously commit 6e17ed9b04e5523cc910bf171c3122dcc64b86db deleted the
obsolete checker `alpha.security.ArrayBound` which was implemented in
`ArrayBoundChecker.cpp` and renamed the checker
`alpha.security.ArrayBoundV2` to `security.ArrayBound`.

This commit concludes that consolidation by renaming the source file
`ArrayBoundCheckerV2.cpp` to `ArrayBoundChecker.cpp` (which was "freed
up" by the previous commit).
2025-02-10 13:25:07 +01:00
Craig Topper
04e5ea5237 [TableGen] Remove recursive walk of linked list from ContractNodes. NFC
After f9250401ef120a4605ad67bb43d3b25500900498, this function is
tail recursive so it was straightforward to convert this to iteratively
walk the linkd list.
2025-02-09 14:23:34 -08:00
Kazu Hirata
af6c6992cf
[TableGen] Avoid repeated hash lookups (NFC) (#126433) 2025-02-09 13:35:58 -08:00
Kazu Hirata
87ae9547ea
[TableGen] Avoid repeated hash lookups (NFC) (#126405) 2025-02-09 08:56:17 -08:00
Craig Topper
4aa71f0d4c [TableGen] Fix an unused variable warning. NFC 2025-02-08 16:03:44 -08:00
Craig Topper
f9250401ef [TableGen] Move formation of MoveSiblingMatcher earlier in ContractNodes. NFC
ContractNodes recursively walks forward through a linked list. During
this recursion, Matchers are combined into other Matchers.

Previously the formation of MoveSiblingMatcher was after the
recursive call so it occurred as we were unwinding. If a
MoveSiblingMatcher was formed, we would recursively walk forward
to the end of the linked list again which isn't efficient.

To make this more efficient, move the formation of MoveSiblingMatcher
to the forward pass. Add additional rules to unfold MoveSiblingMatcher
if it would be more efficient to use CheckChildType, CheckChildInteger,
CheckChildSame, etc.

As an added benefit, this makes the function tail recursive which
the compiler can better optimize.
2025-02-08 15:58:12 -08:00
LLVM GN Syncbot
40ce8fd843 [gn build] Port 69b8cf4f0621 2025-02-08 16:35:01 +00:00
Kazu Hirata
dbe812220c
[TableGen] Avoid repeated hash lookups (NFC) (#126344) 2025-02-08 00:48:30 -08:00
LLVM GN Syncbot
756dab4c25 [gn build] Port 76985fd7cafd 2025-02-07 22:19:30 +00:00
Nico Weber
2e0c0931bc [gn] fix bug in bfba6215cec2 2025-02-07 16:14:40 -05:00
Rahul Joshi
d705e7e9eb
[NFC][TableGen] Code cleanup in CodeGenMapTable EmitMapTable (#126157)
- Emit C++17 nested namespaces.
- Shorten the binary search table name to just `Table` since its
declared in the scope of each search function.
- Use `using namespace XXX` in the search function to avoid emitting the
Target Inst Namespace prefix in the table entries.
- Add short-cut handling of `TableSize` == 0 case (verified in Hexagon
target).
- Use `SetVector` in `ColFieldValueMap` to get automatic deduplication
and eliminate manual deduplication code.
- Use range for loops.
2025-02-07 11:47:49 -08:00
Nick Sarnie
bfba6215ce
[clang-linker-wrapper][lit] Fix OpenMP SPIR-V ELF test again (#126142)
I was able to reproduce the issue with the sanitizer buildbot scripts
and confirmed this fixes it.

The issue was the quotes, `"0"` is true in Python so we incorrectly
added the `spirv-tools` feature even when the CMake variable was false.
I don't know why it didn't always fail.

Also add the var to clang's `BUILD.gn` which matches what we do for
other similar variables, however I don't think it has any effect on CI
here.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-02-07 18:02:48 +00:00
Kazu Hirata
0afbefa282
[TableGen] Avoid repeated hash lookups (NFC) (#126190) 2025-02-07 08:00:21 -08:00
LLVM GN Syncbot
083686daf9 [gn build] Port e2eaf8ded785 2025-02-07 06:04:37 +00:00
Craig Topper
01ac6fc909 [TableGen] Use range-based for loops. NFC 2025-02-06 19:14:10 -08:00
LLVM GN Syncbot
f5b41318b0 [gn build] Port aca829de13ec 2025-02-07 01:08:23 +00:00
Arthur Eubanks
7f7605d385 [gn build] Manually port f7b3559c 2025-02-07 00:56:30 +00:00
Rahul Joshi
337604ee7e
[NFC][TableGen] Adopt Emitter::OptClass in InstrInfoEmitter (#125971)
- Use `Emitter::OptClass` to invoke `InstrInfoEmitter::run` and
eliminate the `EmitInstrInfo` function.
2025-02-06 10:45:05 -08:00
Donát Nagy
6e17ed9b04
[analyzer] Consolidate array bound checkers (#125534)
Before this commit, there were two alpha checkers that used different
algorithms/logic for detecting out of bounds memory access: the old
`alpha.security.ArrayBound` and the experimental, more complex
`alpha.security.ArrayBoundV2`.

After lots of quality improvement commits ArrayBoundV2 is now stable
enough to be moved out of the alpha stage. As indexing (and dereference)
are common operations, it still produces a significant amount of false
positives, but not much more than e.g. `core.NullDereference` or
`core.UndefinedBinaryOperatorResult`, so it should be acceptable as a
non-`core` checker.

At this point `alpha.security.ArrayBound` became obsolete (there is a
better tool for the same task), so I'm removing it from the codebase.
With this I can eliminate the ugly "V2" version mark almost everywhere
and rename `alpha.security.ArrayBoundV2` to `security.ArrayBound`.

(The version mark is preserved in the filename "ArrayBoundCheckerV2", to
ensure a clear git history. I'll rename it to "ArrayBoundChecker.cpp" in
a separate commit.)

This commit adapts the unit tests of `alpha.security.ArrayBound` to
testing the new `security.ArrayBound` (= old ArrayBoundV2). Currently
the names of the test files are very haphazard, I'll probably create a
separate followup commit that consolidates this.
2025-02-06 17:45:42 +01:00
Pierre van Houtryve
03478d6f2d
[GlobalISel] Prefix MatchTable Lines with their Index (#125845)
I tried to keep it readable by making the width of the column with the
index always enough to contain the largest number.
That way things don't shift to the right every time a new digit appears,
it remains consistent.

Tests don't break because this only affects the beginning of the line
and FileCheck doesn't care about what comes before for the most part.

Example of the new output:
```
     /* 758359 */   // Label 9988: @758359
     /* 758359 */   GIM_Try, /*On fail goto*//*Label 9989*/ GIMT_Encode4(758435), // Rule ID 6715 //
     /* 758364 */     GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0,
     /* 758368 */     // MIs[0] offset
```

Fixes #119177
2025-02-06 14:00:20 +01:00
Craig Topper
5eed019080 [TableGen] Use std::copy instead of a manual copy loop. NFC 2025-02-06 00:47:18 -08:00
Peter Collingbourne
de7be32734
gn build: libcxx: Add libc include path and re-enable.
Reviewers: aeubanks, nico

Reviewed By: aeubanks

Pull Request: https://github.com/llvm/llvm-project/pull/124679
2025-02-05 14:46:11 -08:00
Rahul Joshi
d6cf04c401
[NFC][TableGen] Make AsmMatcherEmitterCat static (#125881) 2025-02-05 11:47:23 -08:00
Craig Topper
25dd93aab6
[TableGen] Add declarations to silence gcc warning. NFC (#125892)
Add declarations of SDTypeConstraint's operator== and operator< to the
llvm namespace. These are declared as friends inside the class which
makes them part of the enclosing namespace, but gcc wants it to be more
explicit.

Fixes #125537.
2025-02-05 11:22:48 -08:00
LLVM GN Syncbot
251ece199e [gn build] Port d9a7498aa24a 2025-02-05 19:07:42 +00:00
LLVM GN Syncbot
290a0d8752 [gn build] Port eae6d6d18bd4 2025-02-05 14:47:58 +00:00
Craig Topper
31bd82cdcc [TableGen] Don't try to move CheckOpcode before CheckType/CheckChildType in ContractNodes. NFC
It appears that CheckOpcode is already emitted before CheckType so
this hasn't been doing anything on any in tree targets.
2025-02-04 21:17:20 -08:00
LLVM GN Syncbot
ada8adfc2d [gn build] Port 6ab034b828d3 2025-02-04 17:13:43 +00:00
Kazu Hirata
a207f60727
[TableGen] Avoid repeated hash lookups (NFC) (#125635) 2025-02-04 09:10:10 -08:00
Rahul Joshi
749372ba24
[NFC][TableGen] Code cleanup in CodeGenTarget.cpp (#125569)
- Use StringRef::str() instead of std::string(StringRef).
- Use const pointers for `Candidates` in getSuperRegForSubReg().
- Make `AsmParserCat` and `AsmWriterCat` static.
- Use enumerate() in `ComputeInstrsByEnum` to assign inst enums.
- Use range-based for loops.
2025-02-03 20:04:31 -08:00
LLVM GN Syncbot
557c8bf4ac [gn build] Port 99a9133a68b7 2025-02-03 15:24:10 +00:00
Benjamin Maxwell
82c6b8f7bb
[AArch64][SME] Spill p-regs as z-regs when streaming hazards are possible (#123752)
This patch adds a new option `-aarch64-enable-zpr-predicate-spills`
(which is disabled by default), this option replaces predicate spills
with vector spills in streaming[-compatible] functions.

For example:

```
str	p8, [sp, #7, mul vl]            // 2-byte Folded Spill
// ...
ldr	p8, [sp, #7, mul vl]            // 2-byte Folded Reload
```

Becomes:

```
mov	z0.b, p8/z, #1
str	z0, [sp]                        // 16-byte Folded Spill
// ...
ldr	z0, [sp]                        // 16-byte Folded Reload
ptrue	p4.b
cmpne	p8.b, p4/z, z0.b, #0
```

This is done to avoid streaming memory hazards between FPR/vector and
predicate spills, which currently occupy the same stack area even when
the `-aarch64-stack-hazard-size` flag is set.

This is implemented with two new pseudos SPILL_PPR_TO_ZPR_SLOT_PSEUDO
and FILL_PPR_FROM_ZPR_SLOT_PSEUDO. The expansion of these pseudos
handles scavenging the required registers (z0 in the above example) and,
in the worst case spilling a register to an emergency stack slot in the
expansion. The condition flags are also preserved around the `cmpne` in
case they are live at the expansion point.
2025-02-03 12:04:46 +00:00
LLVM GN Syncbot
76e73ae6af [gn build] Port f3c4b58f4b0d 2025-02-03 10:53:39 +00:00
Craig Topper
31db7afacf
[TableGen] Split DAGISelMatcherOpt FactorNodes into 2 functions. NFC (#125330)
The loop at the top of FactorNodes creates additional variables to deal
with needing to use a pointer to a unique_ptr instead of a reference.
Encapsulate this to its own function for better scoping.

This also allows us to directly skip this loop when we already know we
have a ScopeMatcher.
2025-02-02 19:04:59 -08:00
LLVM GN Syncbot
2c030a11c1 [gn build] Port 0154dce8d39d 2025-02-03 01:33:37 +00:00
David Green
070e129304
[AArch64][GlobalISel] Add disjoint handling for add_and_or_is_add. (#123594)
This allows us to easily detect, without known-bits, that the or in a
fshl/fshr is disjoint allowing us to use usra under aarch64.
2025-02-02 21:01:49 +00:00