Commit Graph

6276 Commits

Author SHA1 Message Date
Douglas Yung 34b8daf4a8 Revert "[llvm-objcopy] Fix --section-add when section contain empty bytes"
This reverts commit 0041382198.

The test added is failing on Windows:
  - https://lab.llvm.org/buildbot/#/builders/216/builds/13762
  - https://lab.llvm.org/buildbot/#/builders/123/builds/14447
2022-12-02 22:40:32 -08:00
Guilhem 0041382198 [llvm-objcopy] Fix --section-add when section contain empty bytes
Implicit cast between char* and StringRef when writing sections.

Reproduce:
```
$> llvm-objcopy --dump-section=name=name.data out.wasm
$> llvm-objcopy --remove-section=name out.wasm out_no_name.wasm
$> llvm-objcopy --add-section=name=name.data out_no_name.wasm out_new_name.wasm

# With wasm-objdump -h we can see that the name section is not totally copied in the new wasm file (if it actually contain empty bytes)

```

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D139210
2022-12-02 16:59:57 -08:00
Matt Arsenault a74c5707be Fix some test files with executable permissions 2022-12-02 17:12:03 -05:00
Rong Xu 077baefc99 [llvm-profdata] Use flattening sample profile in profile supplementation
We need to flatten the SampleFDO profile in profile supplementation
because the InstrFDO profile does not have inlined callsite counters.
Without flattening profile, FDO optimizations are not stable:
we will not supplement the second generation profile when the modified
functions are all inlined.

This patch fixes this issue: we will flatten the profile for functions
that appears in FDO profile.

Note that we only need to find the hot/warm functions in SampleFDO
profile, so we will not perform a full flatten. We will use
a DFS traversal to compute the accumulated entry count and max bodycount.
This is much cheaper than full flattening.

Differential Revision: https://reviews.llvm.org/D138893
2022-11-29 22:23:47 -08:00
Mircea Trofin 255e7e1c21 [UpdateTestChecks] Fix `update_*_test_checks.py` to add "unused" prefixes
The support introduced in D124306 was only added to
update_llc_test_checks.py, but the motivating usecases (see
https://lists.llvm.org/pipermail/llvm-dev/2021-February/148326.html)
cover update_test_checks.py, update_cc_test_checks.py, and
update_analyze_test_checks.py, too.

Issue #59220.

Differential Revision: https://reviews.llvm.org/D138836
2022-11-28 13:24:32 -08:00
Martin Storsjö 30d5b755ea [llvm-objcopy] [COFF] Always set PointerToRawData when writing a COFF file
If we don't want to set PointerToRawData, for an empty section,
we do must set it to zero explicitly. Some object file generators
do set it to zero for empty sections, while others set a nonzero
value pointing at the end of the previous section.

If the value was nonzero on input, we need to update it - either
setting it to zero, or to a valid offset in the output file (not
out of bounds)

This fixes https://github.com/mstorsjo/llvm-mingw/issues/313.

Testing this is tricky, because we can't use yaml2obj, since that
doesn't produce object files with nonzero PointerToRawData for
empty sections. We can use llvm-mc to assemble a small file
(assuming that LLVM's MC layer keeps this behaviour), or bundle
a small binary object file. I opted for using llvm-mc for now here
(with a test that it actually does keep this property), but I don't
mind changing it to a canned object file to make the test less brittle.

Differential Revision: https://reviews.llvm.org/D138783
2022-11-28 22:40:00 +02:00
Simon Pilgrim f51170bffd [X86] Fix SLM ldmxcsr/stmxcsr schedule classes
Fix a long standing FIXME comment using a mixture of llvm-exegesis and Agner numbers
2022-11-28 17:43:17 +00:00
Simon Pilgrim c65d5d4aec [X86] Remove unnecessary (V)?PBLENDW(Y)?rm overrides
The znver1/znver2 overrides shouldn't need 2uops for the xmm case (but znver1 should double-pump for the ymm case).

Found with the help of D138359
2022-11-28 16:32:55 +00:00
Matt Arsenault 7dc1009d13 llvm-split: Convert tests to opaque pointers
global.ll and scc-const-alias.ll needed some manual fixups; the script
seems to not correctly deal with constantexpr bitcasts.
2022-11-28 09:48:21 -05:00
Fangrui Song a273c40820 llvm/tools: Convert tests to opaque pointers 2022-11-27 20:20:04 -08:00
Matt Arsenault 8e3e218a5f llvm-reduce: Fix producing invalid reductions on ifunc 2022-11-27 12:41:29 -05:00
Simon Pilgrim 026df9514e [X86] Remove unnecessary VBLENDWYrr overrides
The znver2 override already matched the WriteBlendY class exactly, and the znver1 override wasn't accounting for ymm double-pumping.

Found with the help of D138359
2022-11-27 16:54:47 +00:00
Simon Pilgrim 2285ba9acc [X86] Fix uops counts for SLM extract/extract-store instructions
Matches Intel AoM + Agner
2022-11-27 16:16:36 +00:00
Daniel Rodríguez Troitiño 652713e268 [MachO][ObjCopy] Handle exports trie in LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE
The exports trie used to be pointed by the information in LC_DYLD_INFO,
but when chained fixups are present, the exports trie is pointed by
LC_DYLD_EXPORTS_TRIE instead.

Modify ObjCopy code to calculate the right offset and size needed
depending on the existence of LC_DYLD_INFO or LC_DYLD_EXPORTS_TRIE, read
the exports from either of those places, and write the export
information as pointed to either of those places.

Depends on D134571.

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D137879
2022-11-22 18:50:06 -08:00
Simon Pilgrim 746cf4f13f [X86] Synchronise scheduler classes of VPERM2F128/VBROADCASTF128/VEXTRACTF128/VINSERTF128 with I128 equivalents
znver1/znver2 has barely any difference in behaviour between the AVX1/2 variants of these instructions - it looks like it was a copy+paste mistake to miss the AVX2 integer domain instructions in the overrides.

Having said that the override numbers don't appear to match the numbers in the AMD 17h SoGs very well - for instance vperm2f128/vperm2i128 might be microcoded from the AMD sense of >3 uops, but it doesn't have a 100cy latency..... These will need to be further addressed.
2022-11-21 17:15:47 +00:00
zhijian a56d0e84da [XCOFF] llvm-readobj support display symbol table of loader section of xcoff object file.
Reviewers: James Henderson, Esme Yi

Differential Revision: https://reviews.llvm.org/D135887
2022-11-21 10:11:12 -05:00
Simon Pilgrim 89365b159e [X86] IceLakeServer - PACKS instructions take latency 3cy
This appears to be a slow down vs Skylake (which the model was copied off) - confirmed with uops.info / instlatx64

Noticed as D138359 was reporting that many of the PACKS overrides were redundant, but were in fact incorrect
2022-11-20 19:28:35 +00:00
Simon Pilgrim 7de156d1cc [MCA][X86] Add missing test coverage for BWI instructions 2022-11-20 17:19:58 +00:00
Simon Pilgrim 421bdc119a [MCA][X86] Add test coverage for IFMA instructions 2022-11-20 17:19:58 +00:00
Simon Pilgrim 6a8fabf5c3 [MCA][X86] Add test coverage for XSAVE instructions 2022-11-20 13:56:04 +00:00
Simon Pilgrim 9148aeac00 [X86] Remove unnecessary string instruction overrides from znver1/znver2 models
Reported by D138359 - they were being overridden as WriteMicrocoded despite already being declared WriteMicrocoded

It also fixes a rather funny instregex mismatch that was matching the movsldup shuffle by mistake
2022-11-20 12:57:44 +00:00
Simon Pilgrim 357f1c4ef1 [X86] Improve LOOP/LOOPE/LOOPNE schedule on SandyBridge model
D138359 was reporting that this override was superfluous, but it had never been setup - I took the numbers from uops.info (I couldn't find an estimate in Intel docs).
2022-11-20 12:13:02 +00:00
Simon Pilgrim 420d02bb55 [MCA][X86] Add test coverage for LOOP/LOOPE/LOOPNE instructions
These were missed for some reason - only noticed this while investigating a FIXME in the SandyBridge model

Also sync the znver2/znver3 tests which had been missed when LOCK test coverage was added
2022-11-20 11:35:21 +00:00
Simon Pilgrim 13fd7373b6 [X86] znver2 - (V)EXTRACTPSrr takes 2 uops
D138359 was reporting that the EXTRACTPSrr override was unnecessary, however the AMD SoG and Agner both confirm that both the rr and rm versions take 2uops (matching znver1)
2022-11-20 09:24:55 +00:00
Simon Pilgrim 474e41f1b9 [MCA][X86] Add test coverage for BF16 instructions 2022-11-19 21:46:23 +00:00
Simon Pilgrim ba5714d773 [MCA][X86] Add test coverage for VP2INTERSECT instructions
NOTE: For IceLakeServer we actually test TigerLake as that's the only target that supports it (we do something similar for F16C on IvyBridge in the SandyBridge tests).
2022-11-19 21:46:23 +00:00
Simon Pilgrim 420d0d3aa6 [MCA][X86] Add test coverage for VAES instructions 2022-11-19 21:02:19 +00:00
Vitaly Buka be954243f4 Revert "[XCOFF] llvvm-readobj support display symbol table of loader section of xcoff object file."
Use of uninitialized value.

This reverts commit 037f5c283a.
2022-11-19 09:58:14 -08:00
Simon Pilgrim aae08b1d37 [MCA][X86] Add test coverage for BITALG instructions 2022-11-19 12:04:45 +00:00
Brad Smith 96c037ef9c [llvm] - Recognizing 'PT_OPENBSD_MUTABLE' segment type.
Recognizing 'PT_OPENBSD_MUTABLE' segment type.

bd249b5664

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D137903
2022-11-18 20:42:10 -05:00
Simon Pilgrim 91deae999a [MCA][X86] Add test coverage for VPCLMULQDQ instructions 2022-11-18 21:22:10 +00:00
Simon Pilgrim ffe05b8f57 [MCA][X86] Add missing IceLake test coverage for VPOPCNTDQ instructions 2022-11-18 20:58:29 +00:00
Simon Pilgrim 4c854120c2 [MCA][X86] Add test coverage for AVX512CD instructions 2022-11-18 20:58:29 +00:00
zhijian 037f5c283a [XCOFF] llvvm-readobj support display symbol table of loader section of xcoff object file.
Reviewers: James Henderson, Esme Yi

Differential Revision: https://reviews.llvm.org/D135887
2022-11-18 12:11:13 -05:00
Florian Hahn 5b6575d50e
[llvm-reduce] Do not crash when accessing landingpads of invokes.
Unconditionally removing landing pads results in invalid IR,
if there is a different `invoke` that uses it. Update the code
to only remove the landing pad if the current invoke is the only
user. Also carefully avoid creating plain branches to bbs with
landing pads we couldn't remove.

Reviewed By: arsenm, aeubanks

Differential Revision: https://reviews.llvm.org/D138072
2022-11-18 15:19:50 +00:00
gbreynoo dcbf61b352 [llvm-ar] Fix when llvm-ar fails to replace existing members when updating a thin archive
As seen in https://github.com/llvm/llvm-project/issues/55023 when a thin
archive is updated when not in the CWD, replacement does not work as
expected. This change fixes the relative file path comparison so the
correct files are updated.

Differential Revision: https://reviews.llvm.org/D138218
2022-11-18 14:37:56 +00:00
Muhammad Omair Javaid f678217c24 [llvm-objcopy] XFAIL ELF/update-section.test on 32-bit arm
ELF/update-section.test is failing on 32-bit arm targets. It was
enabled by commit 4f0a1201a4. I am marking it as XFAIL for now.
2022-11-16 21:50:26 +04:00
Simon Pilgrim c6a838e9c8 [MCA][X86] Add test coverage for VBMI instructions 2022-11-16 16:58:26 +00:00
Simon Pilgrim 896271dbea [MCA][X86] Ensure the avx512 gfni tests use the upper xmm/ymm registers
Ensure we're testing the avx512vl gfni instructions and not the avx gfni instructions
2022-11-15 11:06:59 +00:00
Jonas Devlieghere 17737437ed
[dsymutil] Fix assertion in the Reproducer/FileCollector when TMPDIR is empty
Fix a assertion in dsymutil coming from the Reproducer/FileCollector.
When TMPDIR is empty, the root becomes a relative path, triggering an
assertion when adding a relative path to the VFS mapping. This patch
fixes the issue by resolving the relative path and also moves the
assertion up to make it easier to diagnose these issues in the future.

rdar://102170986

Differential revision: https://reviews.llvm.org/D137959
2022-11-14 19:11:34 -08:00
Jonas Devlieghere fd824bdc5e
Revert "[dsymutil] Fix assertion in the Reproducer/FileCollector when TMPDIR is empty"
This reverts commit 68efb4772c because the
test fails on some of the buildbots.
2022-11-14 13:03:47 -08:00
Xiang Li ad68c66a38 [DirectX backend] Fix build and test error caused by out of sync with upstream change.
Fix build and test error caused by
a2620e00ff#
and
304f1d59ca

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D137815
2022-11-14 12:50:23 -08:00
Jonas Devlieghere 68efb4772c
[dsymutil] Fix assertion in the Reproducer/FileCollector when TMPDIR is empty
Fix a assertion in dsymutil coming from the Reproducer/FileCollector.
When TMPDIR is empty, the root becomes a relative path, triggering an
assertion when adding a relative path to the VFS mapping. This patch
fixes the issue by resolving the relative path and also moves the
assertion up to make it easier to diagnose these issues in the future.

rdar://102170986

Differential revision: https://reviews.llvm.org/D137959
2022-11-14 12:34:16 -08:00
Simon Pilgrim 7e78685752 [MCA][X86] Ensure the avx512 vnni tests use the upper xmm/ymm registers
Ensure we're testing the avx512vl vnni instructions and not the avx vnni instructions
2022-11-14 16:29:31 +00:00
Simon Pilgrim d7208b0404 [MCA][X86] Add test coverage for VBMI2 instructions 2022-11-14 16:29:31 +00:00
Simon Pilgrim e5120a43d5 [X86] Update WriteMPSAD class and remove VMPSADBWrri override
AMD 15h SoG + Agner both indicate there's no difference between MPSADBWrri + VMPSADBWrri - I can't find any data on the folded variant so I've kept the existing numbers

Removes the last X86 override for WriteMPSAD/WritePSADBW classes - removing a further 3 entries from every sched class table
2022-11-13 15:19:37 +00:00
Simon Pilgrim 6a99f23845 [MCA][X86] Add test coverage for VDBPSADBW instructions 2022-11-13 15:19:36 +00:00
Simon Pilgrim 313a4aef7f [X86] Fix scheduler tag for GFNI YMM instructions
These were hardcoded to XMM width
2022-11-13 14:10:09 +00:00
Simon Pilgrim e19cb9c57f [X86] Cleanup CVTPD2PS schedule values
The znver1/znver2 schedules for CVTPD2PS were incorrectly double pumping the xmm-load variant instead of the ymm variants (znver1 only)

Also, the xmm-load variant was incorrectly using FP03 instead of just FP3

Confirmed by the AMD SoG 17h tables, Agner + uops.info

Another step towards removing a lot of unnecessary overrides from all the x86 scheduler models - these should hopefully be convertible into regular WriteCvtPD2I classes soon.
2022-11-13 11:13:30 +00:00
Simon Pilgrim 4a28b7ba98 [X86] IceLakeModel - conversion instructions don't use Port015
Fixes a lot of throughput mismatches - the more complicated conversion instructions use ICXPort5+ICXPort01, not ICXPort5+ICXPort015 (ICXPort015 is mainly used for basic Logic + blend ops)

Fixing this should allow us to remove a lot of unnecessary scheduler overrides from IceLakeModel

Confirmed by both Agner + uops.info
2022-11-12 18:19:32 +00:00