Commit Graph

6365 Commits

Author SHA1 Message Date
Alex Brachet
b712aef5b3 [llvm-driver] Mark some tests unsupported
These tests rely on making symlinks to unkown tool names which will
fail when in the llvm-driver build.
2023-01-07 17:45:26 +00:00
Roman Lebedev
3b2e904ed5 [NFC][Exegesis][X86] Test that we don't crash while coming up with snippets
These tests take less than a second each,
so they are fine to have as tests.

It will be useful to add similar ones
for `prepare-and-assemble-snippet` x repetition mode,
but there we have a problem of not being truly ISA set independent...
2023-01-05 19:32:16 +03:00
Matt Arsenault
a50cec5bf9 llvm-reduce: Don't delete instructions in global variable reduction
For some reason the global variable reduction was trying to delete
use instructions. This broke the verifier if the user was a terminator,
since the block now no longer has one. It doesn't make sense for this
reduction to delete the users, so just stop doing that.
2023-01-05 10:26:02 -05:00
Roman Lebedev
e0ad2af691 [exegesis] "Skip codegen" dry-run mode
While "skip measurements mode" is super useful for test coverage,
i've come to discover it's trade-offs. It still calls back-end
to actually codegen the target assembly, and that is what is taking
80%+ of the time regardless of whether or not we skip the measurements.

On the other hand, just being able to see that exegesis can come up
with a snippet to measure something, is already very useful,
and takes maybe a second for a all-opcode sweep.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D140702
2023-01-05 17:47:17 +03:00
Nikita Popov
6236d77d2b [llvm-reduce] Remove typed pointer test (NFC)
There already is a test using opaque pointers instead.
2023-01-05 12:26:39 +01:00
Nikita Popov
569d657321 [UpdateTestChecks] Convert tests to opaque pointers (NFC) 2023-01-05 12:25:31 +01:00
Roman Lebedev
6a67b633b9 [exegesis] Analysis: filtering for benchmark results
By default, all benchmark results are analysed, but sometimes it may be useful
to only look at those that to not involve memory, or vice versa. This option
allows to either keep all benchmarks, or filter out (ignore) either all the
ones that do involve memory (involve instructions that may read or write to
memory), or the opposite, to only keep such benchmarks.

Personally, so far i have found the benchmarks that do involve memory
to have dubious results. But the ones that do not involve memory,
are generally actionable. So i would like to have a toggle to declutter results.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D140734
2023-01-04 21:16:11 +03:00
Matt Arsenault
a455c91601 llvm-reduce: Add reduction for invokes
Main thing I was unsure about was to whether try to delete the now
dead landing blocks, or leave that for the unreachable block reduction.

Personality function is not reduced, but that should be a separate
reduction on the function.

Fixes #58815
2023-01-03 17:03:44 -05:00
Matt Arsenault
f4cb935ce8 llvm-reduce: Fix invalid reductions for exceptions, tokens and swifterror
Copies the same special cases that bugpoint uses. Technically the
token condition is stricter than what the verifier enforces.

Part 1 of #58815
2023-01-03 17:03:20 -05:00
Matt Arsenault
84e888e5e4 llvm-reduce: Speculative fix for windows build bot
I'm guessing grep wasn't matching the backtick in the message for some
reason.
2023-01-03 17:00:35 -05:00
Matt Arsenault
9c8b89f580 llvm-reduce: Refine missing argument behavior
We required the test and input arguments for --print-delta-passes
which is unhelpful. Also, start printing the help output if no
arguments were supplied.

It looks like there's more sophisticated ways to accomplish this with
the opt library, but it was less work to manually emit these errors.
2023-01-03 16:01:36 -05:00
Matt Arsenault
d5b7514c3d llvm-reduce: Don't remove strictfp
The verifier should fail if constrained intrinsics are used in
functions with strictfp, but that patch hasn't been pushed yet.

Ideally we would be able to analyze the function body to see if any
constrained intrinsics were used, but we seem to be missing a utility
function to check for any constrained ops.
2023-01-03 15:57:58 -05:00
Matt Arsenault
7cd0fd6f51 llvm-reduce: Avoid invalid attribute reduction on optnone functions
We have this ridiculous restriction that optnone requires noinline,
so the pair needs to be removed if we want to remove noinline.
2023-01-03 15:48:14 -05:00
Chris Bieneman
621ffbcbe4 [DX] Improve parse error messages
This change refactors the parte parsing logic to operate on StringRefs
of the part data rather than starting from an offset and splicing down.
It also improves some of the error reporting around part layout.

Specifically, this code now reports a distinct error if there isn't
enough data in the buffer to store the part size and it reports an
error if the parts overlap.

Reviewed By: bob80905

Differential Revision: https://reviews.llvm.org/D139681
2023-01-03 12:50:22 -06:00
Matt Arsenault
5f6bf752d9 llvm-reduce: Reduce individual operands of named metadata
The current reduction tries all or nothing elimination of named
metadata. I noticed in one case where one of the module flags was
necessary, but it left the rest. Reduce the individual operands of
named metadata nodes that are known to behave like lists. Be
conservative since some named metadata may have more specific verifier
requirements for the operands.
2023-01-03 11:48:00 -05:00
Matt Arsenault
e60b0d2a22 llvm-reduce: Reduce prologue data
Identical to the prefix data handling, and also had broken cloning.
2023-01-03 11:07:02 -05:00
Matt Arsenault
4afb10d572 llvm-reduce: Reduce prefix data
Also fixes broken cloning.
2023-01-03 11:03:43 -05:00
Matt Arsenault
47e44c0c2e llvm-reduce: Add reduction for function personalities
Fixes second piece of #58815
2023-01-03 11:02:34 -05:00
Matt Arsenault
cf99be5c7c llvm-reduce: Restrict set of run delta passes in invoke test
Also stop using cat
2023-01-03 10:13:17 -05:00
Matt Arsenault
3f3b71ae02 llvm-reduce: Try to fix error message test on windows
It seems the execute implementations have gone out of their way to
produce inconsistent error messages. The unix version explicitly
checks if the file exists before trying to execute. The windows
version checks if it's executable. I don't understand why they
wouldn't just try the execution and check the error code.
2023-01-03 09:58:29 -05:00
Matt Arsenault
40903bad46 llvm-reduce: Fix missing newline after error message
Fixes missing test coverage for the failed to execute case. However,
this test fails to verify the newline is printed. I can't figure out
how to get FileCheck to match the trailing newline.
2023-01-03 09:09:17 -05:00
Daan De Meyer
556af19330 [llvm-objcopy] Use getNumberOfSymbols() instead of getRawNumberOfSymbols()
getRawNumberOfSymbols() assumes that a symbol table exists, which isn't
always guaranteed, while getNumberOfSymbols() handles and tolerates objects
without a symbol table. When there is a symbol table, both methods return
the same value.

Also add a test to ensure we don't regress in this regard. The test
generates a basic COFF object with symbols and overrides the symbol table
pointer with zeros to craft the input required to verify llvm-objcopy works
as expected in this scenario.
2023-01-02 13:22:50 +01:00
Qfrost
239babe31d llvm-readobj COFFDumper print PEHeader CheckSum
Differential Revision:https://reviews.llvm.org/D140555
2022-12-31 11:48:58 +08:00
Roman Lebedev
498704d511 [NFC][exegesis] By default, don't dump objects to disk
It's a strictly-developer feature, which is useless most of the time.

Fixes https://github.com/llvm/llvm-project/issues/59082

Reviewed By: RKSimon, gchatelet

Differential Revision: https://reviews.llvm.org/D140700
2022-12-28 16:56:54 +03:00
zhongyunde
c69d83908a [AArch64][MachineScheduler] Set no side effect for movprfx
The movprfx is a vector copy, so it doesn't access memory. Set the
value of hasSideEffects 0 to avoid return true for the hasUnmodeledSideEffects(),
which will block the machine scheduler which load/store instructions.

Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D140680
2022-12-28 01:18:14 +08:00
Andrei Safronov
310f7652f7 [Xtensa 2/10] Add Xtensa ELF definitions
Add file with Xtensa ELF relocations. Add Xtensa support to ELF.h,
ELFObject.h and ELFYAML.cpp. Add simple test of Xtensa ELF representation in YAML.

Differential Revision: https://reviews.llvm.org/D64827
2022-12-26 13:30:51 +01:00
Matt Arsenault
d8fb46ee55 llvm-reduce: Remove test dependence on registered targets
This reverts e4b126cc2d and
e57ab8fe91.

This previously depended on where the target happened to construct (or
not) the MachineFunctionInfo during the initial MIR construction. Now
that the MachineFunctionInfo is consistently constructed at
MachineFunction construction time, this should always work.
2022-12-21 10:50:21 -05:00
Alexey Lapshin
11e0500598 [DWARFv4][DWARFv5][DWARFLinker] support debug_macinfo/debug_macro tables.
This patch adds handling of debug_macinfo/debug_macro tables to the DWARFLinker.
It uses already existing code for reading tables from DWARFDebugMacro.h.
It adds new code writing tables into the DwarfStreamer::emitMacroTables.

Differential Revision: https://reviews.llvm.org/D140223
2022-12-21 13:38:41 +01:00
Matt Arsenault
b55b4150e9 Revert "llvm-reduce: Try to fix test on windows"
This reverts commit 3b0b0965c4.

I hadn't noticed 638b257115
2022-12-20 21:28:58 -05:00
Matt Arsenault
3b0b0965c4 llvm-reduce: Try to fix test on windows
It seems to not like the environment variable set syntax.
2022-12-20 20:38:41 -05:00
Douglas Yung
638b257115 Fix test added in 95abdeb to set environment variables in a way that works on both Windows and linux.
This should fix the test failure on Windows bots such as https://lab.llvm.org/buildbot/#/builders/216/builds/14829.
2022-12-20 17:31:01 -08:00
Matt Arsenault
95abdeba61 llvm-reduce: Disable crash reports, symbolization and core dumps
These are going to waste a lot of time and produce clutter when we're
bulk introducing crashes. Add a flag to disable this behavior in case
this matters to a reproducer.
2022-12-20 19:01:26 -05:00
Jonas Devlieghere
0b401ba713 [dsymutil] Require x86 backend for odr-two-units-in-single-file.test 2022-12-20 15:35:58 -08:00
Jonas Devlieghere
c9cbe6937b [dsymutil] Track uncloned references in the DIEInfo.
To improve deduplication across CUs within a single object file,
2b747241a6 changed the way we track ODR canonical candidates. The
result is that some assumptions no longer hold. Because of the
aforementioned change, the following condition

  assert(Ref > InputDIE.getOffset());

in DWARFLinker::DIECloner::cloneDieReferenceAttribute is no longer an
invariant. An example of a situation where this assertion no longer
holds is when we have decided to replace a backward reference in the
current CU with a forward reference in a subsequent CU. The ODR
canonical DIE hasn't been emitted yet, but the references DIE has an
offset smaller than the current DIE. The assertion is only true if the
referenced DIE was the ODR canonical DIE, which is no longer guaranteed
to be part of the same CU.

Big thanks to Alexey for putting a test together.

Differential revision: https://reviews.llvm.org/D138176
2022-12-20 12:53:17 -08:00
Simon Pilgrim
e16b4f5b16 [X86] Fix SLM uops/resources counts for CMPXCHG instructions
LOCK + CMPXCHG8/CMPXCHG16 variants still need overriding as they are not completely correct - already much better though

Based off llvm-exegesis captures, confirmed with Agner + uops.info
2022-12-20 13:07:03 +00:00
Archibald Elliott
142aa1bdd1 [Support] Move Target/CPU Printing out of CommandLine
This change is rather more invasive than intended. The main intention
here is to make CommandLine.cpp not rely on llvm/Support/Host.h. Right
now, this reliance is only in 3 superficial places:
- Choosing how to expand response files (in two places)
- Printing the default triple and current CPU in `--version` output.

The built in version system has a method for adding "extra version
printers", commonly used by several tools (such as llc) to report the
registered targets in the built version of LLVM. It was reasonably easy
to move the logic for printing the default triple and current CPU into
a similar function, and register it with any relevant binaries.

The incompatible change here is that now, even if
LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO is defined, most binaries
will no longer print out the default target triple and cpu when provided
with `--version`, for instance llvm-as and llvm-dis. This breakage is
intended, but the changes in this patch keep printing the default target
and detected in `llc` and `opt` as these were remarked as important
binaries in the LLVM install.

The change to expanding response files may also be controversial, but I
believe that these macros should correspond exactly to the host triple
introspection used before.

Differential Revision: https://reviews.llvm.org/D137837
2022-12-20 09:56:14 +00:00
Simon Pilgrim
e5abaf8dec [X86] Fix SLM uops counts for WriteBitTestSetRegRMW instructions
The set/reset/complement RMW variants use +1uop compared to the BT read-only instructions

Based off llvm-exegesis captures, confirmed with Agner + uops.info
2022-12-19 18:21:31 +00:00
Simon Pilgrim
c39c2cc954 [X86] Fix SLM uops counts for AES instructions
Based off llvm-exegesis captures, confirmed with uops.info
2022-12-19 11:03:41 +00:00
Roman Lebedev
8685445b3c [llvm-exegesis][X86] Explicitly not support WRFSBASE opcode.
We can't serialize if for latency measurements, and when measuring uops,
it crashes so hard even `CrashRecoveryContext` doesn't stop it.

Looks like *this* was the last crasher, now `--opcode-index=-1`
succeeds for all three benchmark modes here.
At least with Duplication repetitor.
2022-12-18 20:07:02 +03:00
Roman Lebedev
f95ddf0ee7 [llvm-exegesis] Benchmark: gracefully handle lack of configurations to run
Otherwise the progress meter would assert.
2022-12-18 20:07:02 +03:00
Roman Lebedev
18da9a0cb3 [llvm-exegesis] Fix 'min' repetition mode in presence of missing measurements
This was a regression from 17e202424c.
Previously we'd gracefully handle missing measurements,
but that handling got accidentally lost during the code move,
and we'd assert.

What we want to do, is to discard all measurements (from all repetitors
in a given config) if any of them failed, but do append the snippet,
and do emit the empty measurement.
2022-12-18 17:52:04 +03:00
Kristina Bessonova
5441812519 [llvm-objdump][AArch64] Fix ADRP target label calculation
This patch makes ADRP target label address calculations the same as
label address calculations (see AArch64InstPrinter::printAdrpLabel()).

Otherwise the target label looks misleading as ADRP's immediate offset is,
actually, not an offset to this PC, but an offset to the current PC's
page address in pages.

See for example, `llvm-objdump/ELF/AArch64/pcrel-address.yaml`.
Before this patch the target label `<_start+0x80>` represents the
address `0x200100 + 0x80` while `0x220000` is expected.

Note that with this patch llvm-objdump output matches GNU objdump.

Reviewed By: simon_tatham

Differential Revision: https://reviews.llvm.org/D139407
2022-12-18 14:25:27 +02:00
Roman Lebedev
a340019113 [llvm-exegesis] Unbreak --benchmarks-file=<f>
I'm absolutely flabbergasted by this.
I was absolutely sure this worked.
But apparently not.

When outputting to the file, we'd write a single `InstructionBenchmark`
to it, and then close the file. And for the next `InstructionBenchmark`,
we'd reopen the file, truncating it in process,
and thus the first `InstructionBenchmark` would be gone...
2022-12-18 03:50:10 +03:00
Simon Pilgrim
bbf84fcf18 [X86] SandyBridge - fix ADC RMW uop count
These should consistently use the fused domain count, not the unfused domain

Confirmed with Agner + uops.info
2022-12-17 21:52:44 +00:00
Simon Pilgrim
ed37234f9b [X86] Fix BMI uop/throughputs on znver1/znver2
Most BMI ops are 2uop and 0.5 throughput - interestingly TZCNTrm doesn't take an extra uop but the other instructions do

Confirmed by AMD SoG + Agner
2022-12-17 20:38:40 +00:00
Simon Pilgrim
2bc2bcb246 [X86] All the WriteBLS instructions take 2uops, not 1uop
Confirmed by AMD SoG + Agner + uops.info
2022-12-17 15:40:41 +00:00
Hongtao Yu
5d7950a403 [CSSPGO][llvm-profgen] Missing frame inference.
This change introduces a missing frame inferrer aiming at fixing missing frames. It current only handles missing frames due to the compiler tail call elimination (TCE) but could also be extended to supporting other scenarios like frame pointer omission. When a tail called function is sampled, the caller frame will be missing from the call chain because the caller frame is reused for the callee frame. While TCE is beneficial to both perf and reducing stack overflow, a workaround being made in this change aims to find back the missing frames as much as possible.

The idea behind this work is to build a dynamic call graph that consists of only tail call edges constructed from LBR samples and DFS-search for a unique path for a given source frame and target frame on the graph. The unique path will be used to fill in the missing frames between the source and target. Note that only a unique path counts. Multiple paths are treated unreachable since we don't want to overcount for any particular possible path.

A switch --infer-missing-frame is introduced and defaults to be on.

Some testing results:
- 0.4% perf win according to three internal benchmarks.
- About 2/3 of the missing tail call frames can be recovered, according to an internal benchmark.
- 10% more profile generation time.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D139367
2022-12-16 08:44:43 -08:00
David Spickett
beae6bfa14 [LLVM][objcopy] Fix update-section.test on 32 bit platforms
This used %zu to print a uint64_t type. z is for size_t so on 32 bit
we tried to treat it as a 32 bit number.

Use PRIu64 instead to print as 64 bit everywhere.
2022-12-16 11:12:15 +00:00
David Spickett
7e61c68174 [LLVM][objcopy] Update Arm XFAIL in update section test
a1b4e13cff updated this to use
the target= syntax.

However the triple for our Arm bots is usually like:
armv8l-unknown-linux-gnueabihf

With "eabihf" on the end. I assume before we just checked for
"linux-gnu" being in the triple at all but now it is a proper
regex match.

Add .* on the end to account for the ABI tag on the end.
2022-12-16 10:59:56 +00:00
Paul Robinson
a1b4e13cff [llvm] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-12-15 14:40:26 -08:00