79 Commits

Author SHA1 Message Date
Joel Galenson
8352988dc1 [cfi-verify] Support AArch64.
This patch adds support for AArch64 to cfi-verify.

This required three changes to cfi-verify.  First, it generalizes checking if an instruction is a trap by adding a new isTrap flag to TableGen (and defining it for x86 and AArch64).  Second, the code that ensures that the operand register is not clobbered between the CFI check and the indirect call needs to allow a single dereference (in x86 this happens as part of the jump instruction).  Third, we needed to ensure that return instructions are not counted as indirect branches.  Technically, returns are indirect branches and can be covered by CFI, but LLVM's forward-edge CFI does not protect them, and x86 does not consider them, so we keep that behavior.

In addition, we had to improve AArch64's code to evaluate the branch target of a MCInst to handle calls where the destination is not the first operand (which it often is not).

Differential Revision: https://reviews.llvm.org/D48836

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337007 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-13 15:19:33 +00:00
John Brawn
ed0d4dabbe [llvm-exegesis] Adjust AArch64 unit test
The signature of setRegToConstant changed in r336171, so adjust the AArch64
unit test in a similar way to how the X86 unit test was changed in that commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336188 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 10:52:20 +00:00
John Brawn
a5c6980ab7 [llvm-exegesis] Add an AArch64 target
The target does just enough to be able to run llvm-exegesis in latency mode for
at least some opcodes.

Differential Revision: https://reviews.llvm.org/D48780


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336187 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 10:10:29 +00:00
Clement Courbet
c978388e74 [llvm-exegesis] ExegisX86Target::setRegToConstant() should depend on the subtarget features.
Summary: This fixes PR38008.

Reviewers: gchatelet, RKSimon

Subscribers: tschuett, craig.topper, llvm-commits

Differential Revision: https://reviews.llvm.org/D48820

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336171 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 06:17:05 +00:00
Clement Courbet
d6bc0c7274 [llvm-exegesis] Get the BenchmarkRunner from the ExegesisTarget.
Summary:
This allows targets to override code generation for some instructions.
As an example of override, this also moves ad-hoc instruction filtering
for X86 into the X86 ExegesisTarget.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48587

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335582 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 08:49:30 +00:00
Eric Christopher
6eef3c63b2 Fix unsigned/signed comparison failure in unittest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335547 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 23:12:04 +00:00
Clement Courbet
14a520d832 [llvm-exegesis][NFC] Remove unnecessary member variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335470 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 13:44:27 +00:00
Clement Courbet
15fac97085 [llvm-exegesis] Generate snippet setup code.
Summary:
This ensures that the snippet always sees the same values for registers,
making measurements reproducible.
This will also allow exploring different values.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48542

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335465 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-25 13:12:02 +00:00
Clement Courbet
859d067297 [llvm-exegesis] Add mechanism to add target-specific passes.
Summary:
createX86FloatingPointStackifierPass is disabled until we handle
TracksLiveness correctly.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48360

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335117 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 11:54:35 +00:00
Guillaume Chatelet
793551740b [llvm-exegesis] Fix failing test.
Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48358

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335115 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 11:09:36 +00:00
Guillaume Chatelet
b1497a74ad [llvm-exegesis] Use a Prototype to defer picking a value for free vars.
Summary: Introducing a Prototype object to capture Variables that must be set but keeps degrees of freedom as Invalid. This allows exploring non constraint variables later on.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48316

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335105 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-20 08:52:30 +00:00
Clement Courbet
41d0646d59 Re-land r335038 "[llvm-exegesis] A mechanism to add target-specific functionality.""
Fix typo: LLVM_NATIVE_ARCH -> LLVM_EXEGESIS_NATIVE_ARCH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335041 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 11:28:59 +00:00
Clement Courbet
0dae1a0252 Revert r335038 "[llvm-exegesis] A mechanism to add target-specific functionality."
Breaks buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335040 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 10:54:12 +00:00
Clement Courbet
fdc767cc01 [llvm-exegesis] A mechanism to add target-specific functionality.
Summary: This is a step towards implementing memory operands and X87.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48210

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335038 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19 10:39:50 +00:00
Clement Courbet
49fb4d413f [llvm-exegesis] Use BenchmarkResult::Instructions instead of OpcodeName
Summary:
Get rid of OpcodeName.

To remove the opcode name from an old file:
```
cat old_file | sed '/opcode_name.*/d'
```

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48121

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334691 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-14 06:57:52 +00:00
Guillaume Chatelet
f246e3e960 [llvm-exegesis] Fix buildbot - power was using native target for X86.
Reviewers: courbet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48125

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334601 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 14:07:36 +00:00
Guillaume Chatelet
c855277f2a [llvm-exegesis] Fix failing assert when creating Snippet for LAHF.
Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48123

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334599 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 13:53:56 +00:00
Guillaume Chatelet
7f976eb280 [llvm-exegesis] Cleaner design without mutable data.
Summary: Previous design was relying on the 'mutate' keyword and was quite confusing. This version separate mutable from immutable data and makes it clearer what changes and what doesn't.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48020

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334596 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 13:24:41 +00:00
Guillaume Chatelet
331580afbf [llvm-exegesis] Move libpfm linking to LLVMExegesis.
Summary: This patch moves linking of libpfm from different places to a single one.

Reviewers: courbet

Subscribers: mgorny, tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48075

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12 13:07:16 +00:00
Guillaume Chatelet
184b9569f9 [llvm-exegesis] Improve error reporting.
Summary: BenchmarkResult IO functions now return an Error or Expected so caller can deal take proper action.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D47868

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334167 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 07:51:16 +00:00
Guillaume Chatelet
a1c8d87b41 [llvm-exegesis] Serializes instruction's operand in BenchmarkResult's key.
Summary: Follow up patch to https://reviews.llvm.org/D47764.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D47785

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-07 07:40:40 +00:00
Clement Courbet
f37d193460 [llvm-exegesis] move Mode from Key to BenchmarResult.
Moves the Mode field out of the Key. The existing yaml benchmark results can be fixed with the following script:

```
readonly FILE=$1
readonly MODE=latency # Change to uops to fix a uops benchmark.
cat $FILE | \
  sed "/^\ \+mode:\ \+$MODE$/d" | \
  sed "/^cpu_name.*$/i mode:            $MODE"
```

Differential Revision: https://reviews.llvm.org/D47813

Authored by: Guillaume Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334079 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-06 09:42:36 +00:00
Clement Courbet
bed775073b [llvm-exegesis] Add instructions to BenchmarkResult Key.
We want llvm-exegesis to explore instructions (effect of initial register values, effect of operand selection). To enable this a BenchmarkResult muststore all the relevant data in its key. This patch starts adding such data. Here we simply allow to store the generated instructions, following patches will add operands and initial values for registers.

https://reviews.llvm.org/D47764

Authored by: Guilluame Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334008 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-05 10:56:19 +00:00
Clement Courbet
2d87e5abe5 [llvm-exegesis][NFC] Use an enum instead of a string for benchmark mode.
Summary: YAML encoding is backwards-compatible.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D47705

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04 11:43:40 +00:00
Clement Courbet
1d12ed5273 [llvm-exegesis] Analysis: Display idealized sched class port pressure.
Summary: Screenshot in phabricator diff.

Reviewers: gchatelet

Subscribers: mgorny, tschuett, mgrang, llvm-commits

Differential Revision: https://reviews.llvm.org/D47329

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333753 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 14:18:02 +00:00
Clement Courbet
df5bf794d6 [llvm-exegesis] Analysis: Show value extents.
Summary: Screenshot attached in phabricator.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D47318

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333181 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 12:41:02 +00:00
Clement Courbet
a38d19ff57 [llvm-exegesis] Analysis output uses HTML.
Summary: This makes the report much more readable.

Reviewers: gchatelet

Subscribers: tschuett, mgrang, craig.topper, RKSimon, llvm-commits

Differential Revision: https://reviews.llvm.org/D47189

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332979 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 13:31:29 +00:00
Clement Courbet
710be84a00 [llvm-exegesis] Fix compile error on VS.
llvm::BitVector::const_set_bits_iterator is not formally a
ForwardIterator. Using it as such results in compile time errors on some
compilers:

FAILED: unittests/tools/llvm-exegesis/X86/CMakeFiles/LLVMExegesisX86Tests.dir/RegisterAliasingTest.cpp.obj
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xutility(967): error C2794: 'iterator_category': is not a member of any direct or indirect base class of 'std::iterator_traits<_InIt>'
        with
        [
            _InIt=llvm::BitVector::const_set_bits_iterator
        ]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332697 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-18 07:18:56 +00:00
Clement Courbet
3c529c01cb [llvm-exegesis] Disable failing ARM assembler tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332604 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 12:41:56 +00:00
Clement Courbet
4cdd921c67 [llvm-exegesis] Disable the tests failing on buildbots while we investigate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332600 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 11:55:08 +00:00
Clement Courbet
8f090f67c0 [llvm-exegesis][NFC] Remove dead function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332597 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 11:51:49 +00:00
Clement Courbet
8603d60d15 Fix r332592 : X86 tests should use the X86 target, not the native targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332594 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 11:31:24 +00:00
Clement Courbet
4f11b743f4 reland r332579: [llvm-exegesis] Update to cover latency through another opcode.
Restructuring the code to measure latency and uops.
The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
It now uses BitVector instead of Graph for performance reasons.

https://reviews.llvm.org/D46821

(with fixed ARM tests)

Authored by Guillaume Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332592 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 10:52:18 +00:00
Clement Courbet
9bb99f85e4 Revert r332579 "[llvm-exegesis] Update to cover latency through another opcode."
The revision failed to update the ARM tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 08:12:29 +00:00
Clement Courbet
33d415b159 [llvm-exegesis] Update to cover latency through another opcode.
Restructuring the code to measure latency and uops.
    The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
    It now uses BitVector instead of Graph for performance reasons.

    https://reviews.llvm.org/D46821

    Authored by Guillaume Chatelet

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332579 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 07:38:21 +00:00
Clement Courbet
bb3b3c2dfc [llvm-exegesis] Split AsmTemplate.Name into components.
Summary:
AsmTemplate becomes IntructionBenchmarkKey, which has three components.
This allows retreiving the opcode for analysis.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D46873

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332348 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 13:07:05 +00:00
Clement Courbet
6357b5f405 [llvm-exegesis] InMemoryAssembler: handle return-less targets (e.g. arm).
Summary: Arm does not have a ret code per se.

Reviewers: gchatelet

Subscribers: mgorny, javed.absar, kristof.beyls, tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D45672

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332331 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 07:40:21 +00:00
Clement Courbet
e17809bf50 Re-land r332230 "[llvm-exegesis]Fix a warning in r332221"
comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp:60:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
    ASSERT_EQ(FromDiskVector.size(), 1);

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332235 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 12:00:35 +00:00
Clement Courbet
4f14c9bd16 [llvm-exegesis] Revert accidentally commited code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332231 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 11:35:37 +00:00
Clement Courbet
a0b75d92d7 [llvm-exegesis] Fix a warning in r332221
comparison of integers of different signs: 'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

unittests/tools/llvm-exegesis/BenchmarkResultTest.cpp:60:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<unsigned long, int>' requested here
    ASSERT_EQ(FromDiskVector.size(), 1);

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332230 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 11:31:02 +00:00
Clement Courbet
6cf914db39 [llvm-exegesis] Allow lists of BenchmarkResults to be parsed as std::vector<BenchmarkResult>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332221 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 09:01:22 +00:00
Nico Weber
e0c7deb8d5 Make CMakeLists.txt formatting more consistent with the rest of LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331837 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09 01:15:38 +00:00
Clement Courbet
7b8a8728fb Re-land r331622 "[llvm-exegesis] Add a library to cluster benchmark results."
Add missing move.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331624 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07 09:09:48 +00:00
Clement Courbet
bfa2014b78 Revert r331622 "[llvm-exegesis] Add a library to cluster benchmark results."
Breaks build over llvm::Error copy construction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331623 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07 08:30:18 +00:00
Clement Courbet
073b5b41a6 [llvm-exegesis] Add a library to cluster benchmark results.
Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D46432

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331622 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07 08:20:00 +00:00
Clement Courbet
6bda3ad720 Revert r330027: "[llvm-exegesis] re-enable failing tests after r330026."
The tests are still failing on some bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330033 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 15:19:16 +00:00
Clement Courbet
c70bdbc4be [llvm-exegesis] re-enable failing tests after r330026.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330027 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 14:50:10 +00:00
Clement Courbet
89eb2f7341 [llvm-exegesis][NFC] Add more logging in case target creation fails.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330020 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 14:29:52 +00:00
Clement Courbet
a0c1588192 [llvm-exegesis] Create test files in temporary directory.
Currently the test fails in sandboxed environnements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330015 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 13:37:07 +00:00
Clement Courbet
7f6ed30360 Partially revert r330008.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330010 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 12:43:55 +00:00