Commit Graph

501456 Commits

Author SHA1 Message Date
Hans Wennborg
b746babb22 Restore 'REQUIRES: shell' for another test after 878deae
Otherwise this would fail when using gnuwin32.
2024-06-11 16:51:33 +02:00
Jacques Pienaar
18cf1cd92b [mlir] Add PDL C & Python usage (#94714)
Following a rather direct approach to expose PDL usage from C and then
Python. This doesn't yes plumb through adding support for custom
matchers through this interface, so constrained to basics initially.

This also exposes greedy rewrite driver. Only way currently to define
patterns is via PDL (just to keep small). The creation of the PDL
pattern module could be improved to avoid folks potentially accessing
the module used to construct it post construction. No ergonomic work
done yet.

---------

Signed-off-by: Jacques Pienaar <jpienaar@google.com>
2024-06-11 07:45:12 -07:00
Farzon Lotfi
38ccee0034 [WASM] Fix for wasi libc build break add tan to RuntimeLibcallSignatureTable (#95082)
The wasm backend fetches the tan runtime lib call in
`llvm/include/llvm/IR/RuntimeLibcalls.def` via `StaticLibcallNameMap()`,
but ignores the runtime function because a function sinature mapping is
not specified in RuntimeLibcallSignatureTable(). The fix is to specify
the function signatures for float32-128.

This is a fix for a build break reported on PR
https://github.com/llvm/llvm-project/pull/94559#issuecomment-2159923215.
2024-06-11 10:43:51 -04:00
Max191
d586372194 [mlir] Add bufferization option for parallel region check (#94645)
Handling parallel region RaW conflicts should usually be the
responsibility of the source program, rather than bufferization
analysis. However, to preserve current functionality, checks on parallel
regions is put behind a bufferization in this PR, which is on by
default. Default functionality will not change, but this PR enables the
option to leave parallelism checks out of the bufferization analysis.
2024-06-11 10:31:06 -04:00
Dmitry Chernenkov
be6248a42a [Bazel] Layering fix for 65310f34d7 2024-06-11 14:26:18 +00:00
Simon Pilgrim
464eb648fa [X86] SimplifyDemandedBitsForTargetNode - add basic X86ISD::CMOV handling
Add basic pass through handling - we could extend this to truncate CMOVQ to CMOVL in a future patch
2024-06-11 15:17:53 +01:00
Simon Pilgrim
1df37980c2 [X86] early-ifcvt-remarks.ll - use i64 arithmetic to ensure ifcvt doesn't drop below threshold
Upcoming SimplifyDemandedBits support for CMOV will simplify the code and reduce the critical path below the threshold if we stick with i32 multiplies
2024-06-11 15:17:53 +01:00
Pavel Labath
c0e1ad779f [lldb] Skip declaration DIEs in the debug_names index (#94744)
This makes sure we try to process declaration DIEs that are erroneously
present in the index. Until bd5c6367bd, clang was emitting index
entries for declaration DIEs with DW_AT_signature attributes. This makes
sure to avoid returning those DIEs as the definitions of a type, but
also makes sure to pass through DIEs referring to static constexpr
member variables, which is a (probably nonconforming) extension used by
dsymutil.

It adds test cases for both of the scenarios. It is essentially a
recommit of #91808.
2024-06-11 16:17:25 +02:00
Stephen Tozer
d83f37f039 Revert#2 "[MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)"
Also reverts "[MLIR][Flang][DebugInfo] Convert debug format in MLIR translators"

The patch above introduces behaviour controlled by an LLVM flag into the
Flang driver, which is incorrect behaviour.

This reverts commits:
  3cc2710e0d.
  460408f78b.
2024-06-11 15:14:31 +01:00
Johannes Doerfert
2eb60e2de8 [Offload][NFCI] Initialize the KernelArgsTy to default values (#95117)
Co-authored-by: Joseph Huber <huberjn@outlook.com>
2024-06-11 17:05:04 +03:00
Benjamin Kramer
37e9bf9d15 [bazel] Add missing dependency for 3cc2710e0d 2024-06-11 15:48:41 +02:00
Sergei Lebedev
bc5ced54cc Updated the annotations of Python bindings (#92733) 2024-06-11 08:46:43 -05:00
Simon Pilgrim
a7d28f5a4d [X86] early-ifcvt-remarks.ll - add codegen checks 2024-06-11 14:35:32 +01:00
paperchalice
837dc542b1 [CodeGen][NewPM] Split MachineDominatorTree into a concrete analysis result (#94571)
Prepare for new pass manager version of `MachineDominatorTreeAnalysis`.
We may need a machine dominator tree version of `DomTreeUpdater` to
handle `SplitCriticalEdge` in some CodeGen passes.
2024-06-11 21:27:14 +08:00
Nikita Popov
2b15fb16ce [gold] Don't pass StringRef to message() (#95083)
This is a printf style variadic function. If using a "%s" format, we
should pass "const char *" rather than "StringRef".

The use of data() here is safe because we know that the StringRef was
originally derived from a null-terminated string.
2024-06-11 15:26:53 +02:00
Stephen Tozer
400d4fd7b6 [RemoveDIs] Update all docs to use debug records (#91768)
As we approach the state where support for debug intrinsics is dropping and
we print and use debug records by default, the documentation should be updated
to refer to debug records as the primary debug info representation, with
debug intrinsics being relegated to an optional alternative.

This patch performs a few updates:
- Replace references to intrinsics with references to records across all
the documentation.
- Replace intrinsics with records in code examples.
- Move debug records prior to debug intrinsics in the
SourceLevelDebugging document, and change text to refer to them as the
primary representation.
- Add release notes describing the change.
2024-06-11 14:16:32 +01:00
Timm Bäder
e805b77107 [clang][Interp] Support ObjCEncodeExprs 2024-06-11 15:07:28 +02:00
Paul T Robinson
32add2435f Fix test to have correct requirements (#95106) 2024-06-11 06:04:09 -07:00
Nikita Popov
da5f45f593 [ConstantFolding] Preserve nowrap flags in gep of gep fold
A caveat here is that we can only preserve nusw if the offset
additions did not overflow.

Proofs: https://alive2.llvm.org/ce/z/u56z_u
2024-06-11 15:03:10 +02:00
Congcong Cai
1bae10879d [clang-tidy] fix false positives for the functions with the same name as standard library functions in misc-include-cleaner (#94923)
Fixes: #93335
For decl with body, we should provide physical locations also. Because
it may be the function which have the same name as std library.
2024-06-11 21:01:52 +08:00
Andrzej Warzyński
d4c6478cf2 [mlir][vector] Update tests for collapse 1/n (nfc) (#94490)
The main goal of this PR (and subsequent PRs), is to add more tests with
scalable vectors to:
  * vector-transfer-collapse-inner-most-dims.mlir

There's quite a few cases to consider, hence this is split into multiple
PRs. In this PR, the very first test is complemented with all the
possible combinations:
  * scalable (rather than fixed) unit trailing dim,
  * dynamic (rather than static) trailing dim in the source memref.

Also,
  * `@leading_scalable_dimension_transfer_read` and
    `@trailing_scalable_one_dim_transfer_read`,

are replaced with:
  * `@contiguous_inner_most_scalable_inner_dim` and
    `@negative_scalable_unit_dim`,

respectively, and added to the list above (i.e. alongside other
variations for the very first test).

In addition:
  * "_view" is removed from function names (it's not clear to me what it
    was meant to signify)
  * extra comments are added to separate tests for vector.transfer_read
    and vector.transfer_write

NOTE: This PR is limited to tests for `vector.transfer_read`.
2024-06-11 13:56:45 +01:00
Stephen Tozer
3cc2710e0d [MLIR][Flang][DebugInfo] Convert debug format in MLIR translators
Following from the previous commit, this patch converts to the
appropriate debug info format before printing LLVM IR.

See: https://github.com/llvm/llvm-project/pull/95098
2024-06-11 13:48:41 +01:00
Stephen Tozer
460408f78b Reapply "[MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)"
Reapplies the original patch with some additional conversion layers added
to the MLIR translator, to ensure that we don't write the new debug info
format unless WriteNewDbgInfoFormat is set.

This reverts commit 8c5d9c79b9.
2024-06-11 13:46:09 +01:00
Matt Arsenault
a2bc50aa8b AMDGPU: Add more tests for vector typed atomicrmw fadd
Some cases should be legal for gfx940.
2024-06-11 14:44:28 +02:00
Pierre van Houtryve
a45080f091 [AMDGPU] Document amdgpu-as in AMDGPUUsage (#94335)
Add a section about fence & address spaces that covers amdgpu-as.
2024-06-11 14:31:26 +02:00
Stephen Tozer
8c5d9c79b9 Revert "[MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)"
Reverted due to failure on buildbot due to missing use of the
WriteNewDbgInfoFormat flag in MLIR.

This reverts commit ca920bb628.
2024-06-11 13:29:38 +01:00
Zibi Sarbinowski
ffc3a6b286 [libc++] Fix endianness for algorithm mismatch (#93082)
This PR is required to fix
`std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp` test for
big endian platrofrms such as z/OS.
2024-06-11 08:29:12 -04:00
Pierre van Houtryve
d4b8b7217f [CodeGen][MachineLICM] Use RegUnits in HoistRegionPostRA (#94608)
Those BitVectors get expensive on targets like AMDGPU with thousands of
registers, and RegAliasIterator is also expensive.

We can move all liveness calculations to use RegUnits instead to speed
it up for targets where RegAliasIterator is expensive, like AMDGPU.
On targets where RegAliasIterator is cheap, this alternative can be a little more expensive, but I believe the tradeoff is worth it.
2024-06-11 14:27:35 +02:00
Donát Nagy
546c816a52 [clang-tidy] Improve sizeof(pointer) handling in bugprone-sizeof-expression (#94356)
This commit reimplements the functionality of the Clang Static Analyzer
checker `alpha.core.SizeofPointer` within clang-tidy by adding a new
(off-by-default) option to bugprone-sizeof-expression which activates
reporting all the `sizeof(ptr)` expressions (where ptr is an expression
that produces a pointer).

The main motivation for this change is that `alpha.core.SizeofPointer`
was an AST-based checker, which did not rely on the path sensitive
capabilities of the Static Analyzer, so there was no reason to keep it
in the Static Analyzer instead of the more lightweight clang-tidy.

After this commit I'm planning to create a separate commit that deletes
`alpha.core.SizeofPointer` from Clang Static Analyzer.

It was natural to place this moved logic in bugprone-sizeof-expression,
because that check already provided several heuristics that reported
various especially suspicious classes of `sizeof(ptr)` expressions.

The new mode `WarnOnSizeOfPointer` is off-by-default, so it won't
surprise the existing users; but it can provide a more through coverage
for the vulnerability CWE-467 ("Use of sizeof() on a Pointer Type") than
the existing partial heuristics.

Previously this checker had an exception that the RHS of a
`sizeof(array) / sizeof(array[0])` expression is not reported; I
generalized this to an exception that the check doesn't report
`sizeof(expr[0])` and `sizeof(*expr)`. This idea is taken from the
Static Analyzer checker `alpha.core.SizeofPointer` (which had an
exception for `*expr`), but analysis of open source projects confirmed
that this indeed eliminates lots of unwanted results.

Note that the suppression of `sizeof(expr[0])` and `sizeof(*expr)`
reports also affects the "old" mode `WarnOnSizeOfPointerToAggregate`
which is enabled by default.

This commit also replaces the old message "suspicious usage of
'sizeof(A*)'; pointer to aggregate" with two more concrete messages; but
I feel that this tidy check would deserve a through cleanup of all the
diagnostic messages that it can produce. (I added a FIXME to mark one
outright misleading message.)
2024-06-11 14:16:42 +02:00
Stephen Tozer
ca920bb628 [MLIR][Flang][DebugInfo] Set debug info format in MLIR->IR translation (#95098)
MLIR's LLVM dialect does not internally support debug records, only
converting to/from debug intrinsics. To smooth the transition from
intrinsics to records, there is a step prior to IR->MLIR translation
that switches the IR module to intrinsic-form; this patch adds the
equivalent conversion to record-form at MLIR->IR translation, and also
modifies the flang front end to use the WriteNewDbgInfoFormat flag when
it is emitting LLVM IR.
2024-06-11 13:11:41 +01:00
Nathan Gauër
a141a28c0c [SPIR-V] Fix flakiness during switch generation. (#95001)
The case-list of the switches generated by this pass were not
"deterministic" (based on allocation patterns).
This is because the CaseList order relied on an unordered_set order.
Using the sorted exit target list for those should solve the problem.

Fixes #94961

Signed-off-by: Nathan Gauër <brioche@google.com>
2024-06-11 13:57:31 +02:00
Paul T Robinson
3f88311124 [Driver] Rearrange some Apple version testing (#94514)
There were four tests in Driver that actually tested bits of Driver and
bits of CodeGen, and therefore had target restrictions. Rework those
four tests into one Driver test (with no target restrictions) and two
target-specific CodeGen tests.
2024-06-11 07:51:21 -04:00
Timm Bäder
fa9745e8d3 [clang][Interp][NFC] Remove unneeded opcode initializers 2024-06-11 13:45:48 +02:00
Johannes Reifferscheid
9b225d01f8 Fix complex abs with nnan/ninf. (#95080)
The current logic tests for inf/inf and 0/0 inputs using a NaN check.
This doesn't work with all fastmath flags. With nnan and ninf, we can
just check for a 0 maximum. With only nnan, we have to check for both
cases separately.
2024-06-11 13:44:29 +02:00
donald chen
efbd64cbd9 [mlir][arith] Delete unnecessary error logs (#94970)
Function `getNeutralElement` already indicates "cannot find neutral
element" by returning nullptr through the return value, and no
additional error log needs to be output.
2024-06-11 19:41:01 +08:00
Simon Pilgrim
264bcbe1c8 [InstCombine] Add #38139 test coverage 2024-06-11 12:35:49 +01:00
Simon Pilgrim
00262ab7e3 [X86] Pull out repeated SDLoc in various ADD/SUB/XOR folds. NFC. 2024-06-11 12:35:49 +01:00
Timm Bäder
424188abe4 [clang][Interp][test] Add test for void* diagnostics changes 2024-06-11 13:28:23 +02:00
Stephen Tozer
2dc2290860 Revert new debug info format commits:
"[Flang] Update test to not check for tail calls on debug intrinsics" &
"Reapply#3 "[RemoveDIs] Load into new debug info format by default in LLVM (#89799)"

Recent updates to flang have added debug info generation via MLIR, a path
which currently does not support debug records. The patch that enables
debug records by default (and a small followup patch) are thus being
reverted until the MLIR path has been fixed.

This reverts commits:
  21396be865
  c5aeca732d
2024-06-11 12:19:06 +01:00
aengelke
fc6e97cf2f [MC][X86] Avoid copying MCInst in emitInstrEnd (#94947)
Copying an MCInst isn't cheap (copies all operands) and the whole
instruction is only used for the Intel erratum mitigation, which is off
by default. In all other cases, the opcode alone suffices.

This slightly pessimizes code that uses moves to segment registers --
but that's uncommon and not performance-sensitive anyway.

As a related change, also call canPadInst() only when the result is
actually used, which is typically only the case in emitInstrEnd.

This gives a minor performance improvement.
2024-06-11 13:10:36 +02:00
aengelke
214ff5036c [X86] Add AMXProgModel to YAML serialization (#94988)
This allows tested passes to depend on the AMX model in the function
info. Preparatory work for to adopt #94358 for other AMX passes.
2024-06-11 13:08:55 +02:00
Simon Pilgrim
2ca8c856ee [X86] is_fpclass.ll - add NDD test coverage 2024-06-11 11:23:17 +01:00
Jay Foad
9dfd0760cb [test] Fix documentation of %{fs-sep} et al (#95088) 2024-06-11 10:55:25 +01:00
c8ef
e5bdb7af86 [InstCombine] fold ldexp(x, sext(i1 y)) to fmul x, (select y, 0.5, 1.0) (#95073)
Follow up of #94887.

Context:
https://github.com/llvm/llvm-project/pull/94887#pullrequestreview-2106213891
2024-06-11 11:42:19 +02:00
Simon Pilgrim
995ba4afcd [CostModel][X86] Adjust ABS scalar SizeLatency cost to 3uops
This was previously set to 4uops which was including the cost of extra register moves in the original test code.
2024-06-11 10:29:18 +01:00
Pavel Samolysov
ec81c9b1dd [clang] Remove a redundant check in Mangle. NFC (#95071)
This addresses a review comment for PR #94987 Because that PR is a big
automatic change, this change was moved in a separate one.
2024-06-11 12:24:46 +03:00
Timm Bäder
529b43c1fd [clang][Interp] Refine diagnostics for casts from void*
This is still not perfect, but an improvement in general.
2024-06-11 11:19:06 +02:00
Jay Foad
35ddc17f36 [StackSafety] Make lit tests compatible with lit's internal shell. NFC. (#94971)
Use DEFINE: %{res} = ... instead of $(cat ...). Rewrite one use of a
subshell to write to a temporary file instead.
2024-06-11 10:04:12 +01:00
Braden Helmer
79ce70b803 [NFC] Mitigate pointless copies (#95052)
Fixes #95036 #95033 #94933 #94930
2024-06-11 09:54:00 +01:00
Arjun P
affd73aadb MathExtras: MulOverflow: use builtin when available (NFC) (#95046)
This matches the other two functions AddOverflow and SubOverflow.
2024-06-11 09:43:56 +01:00