Skip to content

[llvm-mca] Abort on parse error without -skip-unsupported-instructions #90474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions llvm/docs/CommandGuide/llvm-mca.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ option specifies "``-``", then the output will also be sent to standard output.
no extra information, and InstrumentManager never overrides the default
schedule class for a given instruction.

.. option:: -skip-unsupported-instructions=<reason>

Force :program:`llvm-mca` to continue in the presence of instructions which do
not parse or lack key scheduling information. Note that the resulting analysis
is impacted since those unsupported instructions are ignored as-if they are
not supplied as a part of the input.

The choice of `<reason>` controls the when mca will report an error.
`<reason>` may be `none` (default), `lack-sched`, `parse-failure`, `any`.

EXIT STATUS
-----------

Expand Down
8 changes: 8 additions & 0 deletions llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ Changes to the LLVM tools
(`#89162 <https://github.com/llvm/llvm-project/pull/89162>`_)
``--raw-relr`` has been removed.

* llvm-mca now aborts by default if it is given bad input where previously it
would continue. Additionally, it can now continue when it encounters
instructions which lack scheduling information. The behaviour can be
controlled by the newly introduced
`--skip-unsupported-instructions=<none|lack-sched|parse-failure|any>`, as
documented in `--help` output and the command guide. (`#90474
<https://github.com/llvm/llvm-project/pull/90474>`)

Changes to LLDB
---------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m3 -resource-pressure=false < %s | FileCheck %s -check-prefixes=ALL,EM3
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m3 -resource-pressure=false -skip-unsupported-instructions=parse-failure < %s | FileCheck %s -check-prefixes=ALL,EM3
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m4 -resource-pressure=false < %s | FileCheck %s -check-prefixes=ALL,EM4
# RUN: llvm-mca -march=aarch64 -mcpu=exynos-m5 -resource-pressure=false < %s | FileCheck %s -check-prefixes=ALL,EM5

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-mca/AArch64/Exynos/float-integer.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
# RUN: llvm-mca -mtriple=aarch64-linux-gnu -mcpu=exynos-m3 -resource-pressure=false < %s | FileCheck %s -check-prefixes=ALL,EM3
# RUN: llvm-mca -mtriple=aarch64-linux-gnu -mcpu=exynos-m3 -resource-pressure=false -skip-unsupported-instructions=parse-failure < %s | FileCheck %s -check-prefixes=ALL,EM3
# RUN: llvm-mca -mtriple=aarch64-linux-gnu -mcpu=exynos-m4 -resource-pressure=false < %s | FileCheck %s -check-prefixes=ALL,EM4
# RUN: llvm-mca -mtriple=aarch64-linux-gnu -mcpu=exynos-m5 -resource-pressure=false < %s | FileCheck %s -check-prefixes=ALL,EM5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
adc pc, r5, r6, ror #2
adc r4, r5, r6, ror #31
adc r6, r7, r8, lsl r9
adc pc, r7, r8, lsl r9
adc r6, r7, r8, lsr r9
adc r6, r7, r8, asr r9
adc r6, r7, r8, ror r9
Expand Down
27 changes: 23 additions & 4 deletions llvm/test/tools/llvm-mca/ARM/cortex-a57-thumb.s
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@
itett ne
cmpne r7, #243
addeq r7, r1, r2
addne r7, r1, r2
uxthne r7, r7
itttt lt
cmplt r7, #243
uxthlt r7, r1
strhlt r2, [r7, #22]
lsrlt r1, r6, #3
uxthne r7, r7
strh r2, [r7, #22]
asrs r1, r6, #7
lsrs r1, r6, #31
Expand Down Expand Up @@ -253,7 +254,7 @@
ldrd r0, r1, [r2, #-0]!
ldrd r0, r1, [r2, #0]!
ldrd r0, r1, [r2, #-0]
ldrd r1, r1, [r0], #0
ldrd r1, r2, [r0], #0
ldrex r1, [r4]
ldrex r8, [r4]
ldrex r2, [sp, #128]
Expand Down Expand Up @@ -648,7 +649,7 @@
str r10, [r11], #0
strd r1, r1, [r0], #0
strd r6, r3, [r5], #-8
strd r8, r5, [r5], #-0
strd r8, r5, [r6], #-0
strd r7, r4, [r5], #-4
strd r0, r1, [r2, #-0]!
strd r0, r1, [r2, #0]!
Expand Down Expand Up @@ -1010,6 +1011,13 @@
# CHECK-NEXT: 0 0 0.00 U itett ne
# CHECK-NEXT: 1 1 0.50 cmpne r7, #243
# CHECK-NEXT: 1 1 0.50 addeq r7, r1, r2
# CHECK-NEXT: 1 1 0.50 addne r7, r1, r2
# CHECK-NEXT: 1 1 0.50 uxthne r7, r7
# CHECK-NEXT: 0 0 0.00 U itttt lt
# CHECK-NEXT: 1 1 0.50 cmplt r7, #243
# CHECK-NEXT: 1 1 0.50 uxthlt r7, r1
# CHECK-NEXT: 1 1 1.00 * strhlt r2, [r7, #22]
# CHECK-NEXT: 1 1 0.50 lsrlt r1, r6, #3
# CHECK-NEXT: 1 1 1.00 * strh r2, [r7, #22]
# CHECK-NEXT: 1 2 1.00 asrs r1, r6, #7
# CHECK-NEXT: 1 2 1.00 lsrs r1, r6, #31
Expand Down Expand Up @@ -1162,6 +1170,7 @@
# CHECK-NEXT: 4 4 2.00 * ldrd r0, r1, [r2, #-0]!
# CHECK-NEXT: 4 4 2.00 * ldrd r0, r1, [r2, #0]!
# CHECK-NEXT: 2 4 2.00 * ldrd r0, r1, [r2, #-0]
# CHECK-NEXT: 4 4 2.00 * ldrd r1, r2, [r0], #0
# CHECK-NEXT: 0 0 0.00 * * U ldrex r1, [r4]
# CHECK-NEXT: 0 0 0.00 * * U ldrex r8, [r4]
# CHECK-NEXT: 0 0 0.00 * * U ldrex r2, [sp, #128]
Expand Down Expand Up @@ -1556,6 +1565,7 @@
# CHECK-NEXT: 2 1 1.00 * str r10, [r11], #0
# CHECK-NEXT: 2 1 1.00 * strd r1, r1, [r0], #0
# CHECK-NEXT: 2 1 1.00 * strd r6, r3, [r5], #-8
# CHECK-NEXT: 2 1 1.00 * strd r8, r5, [r6], #-0
# CHECK-NEXT: 2 1 1.00 * strd r7, r4, [r5], #-4
# CHECK-NEXT: 2 1 1.00 * strd r0, r1, [r2, #-0]!
# CHECK-NEXT: 2 1 1.00 * strd r0, r1, [r2, #0]!
Expand Down Expand Up @@ -1827,7 +1837,7 @@

# CHECK: Resource pressure per iteration:
# CHECK-NEXT: [0] [1.0] [1.1] [2] [3] [4] [5] [6]
# CHECK-NEXT: 12.00 164.00 164.00 221.00 313.00 44.00 - -
# CHECK-NEXT: 12.00 168.00 168.00 223.00 313.00 46.00 - -

# CHECK: Resource pressure by instruction:
# CHECK-NEXT: [0] [1.0] [1.1] [2] [3] [4] [5] [6] Instructions:
Expand Down Expand Up @@ -1924,6 +1934,13 @@
# CHECK-NEXT: - - - - - - - - itett ne
# CHECK-NEXT: - 0.50 0.50 - - - - - cmpne r7, #243
# CHECK-NEXT: - 0.50 0.50 - - - - - addeq r7, r1, r2
# CHECK-NEXT: - 0.50 0.50 - - - - - addne r7, r1, r2
# CHECK-NEXT: - 0.50 0.50 - - - - - uxthne r7, r7
# CHECK-NEXT: - - - - - - - - itttt lt
# CHECK-NEXT: - 0.50 0.50 - - - - - cmplt r7, #243
# CHECK-NEXT: - 0.50 0.50 - - - - - uxthlt r7, r1
# CHECK-NEXT: - - - - - 1.00 - - strhlt r2, [r7, #22]
# CHECK-NEXT: - 0.50 0.50 - - - - - lsrlt r1, r6, #3
# CHECK-NEXT: - - - - - 1.00 - - strh r2, [r7, #22]
# CHECK-NEXT: - - - - 1.00 - - - asrs r1, r6, #7
# CHECK-NEXT: - - - - 1.00 - - - lsrs r1, r6, #31
Expand Down Expand Up @@ -2076,6 +2093,7 @@
# CHECK-NEXT: - 1.00 1.00 2.00 - - - - ldrd r0, r1, [r2, #-0]!
# CHECK-NEXT: - 1.00 1.00 2.00 - - - - ldrd r0, r1, [r2, #0]!
# CHECK-NEXT: - - - 2.00 - - - - ldrd r0, r1, [r2, #-0]
# CHECK-NEXT: - 1.00 1.00 2.00 - - - - ldrd r1, r2, [r0], #0
# CHECK-NEXT: - - - - - - - - ldrex r1, [r4]
# CHECK-NEXT: - - - - - - - - ldrex r8, [r4]
# CHECK-NEXT: - - - - - - - - ldrex r2, [sp, #128]
Expand Down Expand Up @@ -2470,6 +2488,7 @@
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - str r10, [r11], #0
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - strd r1, r1, [r0], #0
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - strd r6, r3, [r5], #-8
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - strd r8, r5, [r6], #-0
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - strd r7, r4, [r5], #-4
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - strd r0, r1, [r2, #-0]!
# CHECK-NEXT: - 0.50 0.50 - - 1.00 - - strd r0, r1, [r2, #0]!
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/tools/llvm-mca/X86/BtVer2/simple-test.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=100 < %s | FileCheck %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=100 -skip-unsupported-instructions=lack-sched < %s | FileCheck %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=100 -skip-unsupported-instructions=parse-failure < %s | FileCheck %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=100 -skip-unsupported-instructions=any < %s | FileCheck %s

add %edi, %eax

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: not llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -skip-unsupported-instructions %s 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK-SKIP %s
# RUN: not llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -skip-unsupported-instructions=lack-sched %s 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK-SKIP %s
# RUN: not llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 %s 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK-ERROR %s

# Test defends that if all instructions are skipped leaving an empty input, an error is printed.
Expand All @@ -7,7 +7,7 @@ bzhi %eax, %ebx, %ecx

# CHECK-ALL-NOT: error

# CHECK-ERROR: error: found an unsupported instruction in the input assembly sequence, use -skip-unsupported-instructions to ignore.
# CHECK-ERROR: error: found an unsupported instruction in the input assembly sequence, use -skip-unsupported-instructions=lack-sched to ignore these on the input.

# CHECK-SKIP: warning: found an unsupported instruction in the input assembly sequence, skipping with -skip-unsupported-instructions, note accuracy will be impacted:
# CHECK-SKIP: note: instruction: bzhil %eax, %ebx, %ecx
Expand Down
9 changes: 6 additions & 3 deletions llvm/test/tools/llvm-mca/X86/BtVer2/unsupported-instruction.s
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -skip-unsupported-instructions -timeline %s 2>&1 | FileCheck --check-prefix=CHECK-SKIP %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -skip-unsupported-instructions=any -timeline %s 2>&1 | FileCheck --check-prefix=CHECK-SKIP %s
# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -skip-unsupported-instructions=lack-sched -timeline %s 2>&1 | FileCheck --check-prefix=CHECK-SKIP %s
# RUN: not llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -skip-unsupported-instructions=parse-failure -timeline %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
# RUN: not llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s

# Test checks that unsupported instructions exit with an error, unless -skip-unsupported-instructions is passed, in which case the remaining instructions should be analysed.
# Test checks that unsupported instructions exit with an error, unless -skip-unsupported-instructions=lack-sched is passed, in which case the remaining instructions should be analysed.
# Additionally check that -skip-unsupported-instructions=parse-failure continues to raise the lack of scheduling information.

# CHECK-SKIP: warning: found an unsupported instruction in the input assembly sequence, skipping with -skip-unsupported-instructions, note accuracy will be impacted:
# CHECK-ERROR: error: found an unsupported instruction in the input assembly sequence, use -skip-unsupported-instructions to ignore.
# CHECK-ERROR: error: found an unsupported instruction in the input assembly sequence, use -skip-unsupported-instructions=lack-sched to ignore these on the input.

bzhi %eax, %ebx, %ecx

Expand Down
14 changes: 14 additions & 0 deletions llvm/test/tools/llvm-mca/bad-input.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# RUN: not llvm-mca %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK %s
# RUN: not llvm-mca -skip-unsupported-instructions=none %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK %s
# RUN: not llvm-mca -skip-unsupported-instructions=lack-sched %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK %s
# RUN: not llvm-mca -skip-unsupported-instructions=parse-failure %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK-SKIP %s
# RUN: not llvm-mca -skip-unsupported-instructions=any %s -o /dev/null 2>&1 | FileCheck --check-prefixes=CHECK-ALL,CHECK-SKIP %s
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference: https://lab.llvm.org/buildbot/#/builders/60/builds/17086

I've just become aware that this appears to be failing on builders with messages like:

not c:\buildbot\as-builder-1\x-armv7l\build\bin\llvm-mca.exe C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llvm-mca\bad-input.s -o /dev/null 2>&1 | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe --check-prefixes=CHECK-ALL,CHECK C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llvm-mca\bad-input.s
# executed command: not 'c:\buildbot\as-builder-1\x-armv7l\build\bin\llvm-mca.exe' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llvm-mca\bad-input.s' -o /dev/null
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' --check-prefixes=CHECK-ALL,CHECK 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llvm-mca\bad-input.s'
# .---command stderr------------
# | C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llvm-mca\bad-input.s:11:10: error: CHECK: expected string not found in input
# | # CHECK: error: Assembly input parsing had errors, use -skip-unsupported-instructions=parse-failure to drop failing lines from the input.
# |          ^
# | <stdin>:1:1: note: scanning from here
# | 'skylake-avx512' is not a recognized processor for this target (ignoring processor)
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llvm-mca\bad-input.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           1: 'skylake-avx512' is not a recognized processor for this target (ignoring processor) 
# | check:11     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |           2: 'skylake-avx512' is not a recognized processor for this target (ignoring processor) 
# | check:11     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

The bots for which this have failed appear to be cross-compilers which don't have the native build target enabled.

It seems the safest immediate fix is to move/copy this test to x86/arm so that there is some coverage for this test for two common targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed fix committed as afc10fc for now. I'll monitor the bots.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite there. Looks like we can't rely on the default mcpu for bad inputs, since this fails if we run on a CPU for which there is no scheduling information.

So I've gone for supplying mtriple and mcpu for this case, committed in 458d706.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patches LGTM.


# Test checks that MCA does not produce a total cycles estimate if it encounters parse errors.

# CHECK-ALL-NOT: Total Cycles:

# CHECK: error: Assembly input parsing had errors, use -skip-unsupported-instructions=parse-failure to drop failing lines from the input.
# CHECK-SKIP: error: no assembly instructions found.

This is not a valid assembly file for any architecture (by virtue of this text.)
13 changes: 11 additions & 2 deletions llvm/tools/llvm-mca/CodeRegionGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace mca {
CodeRegionGenerator::~CodeRegionGenerator() {}

Expected<const CodeRegions &> AsmCodeRegionGenerator::parseCodeRegions(
const std::unique_ptr<MCInstPrinter> &IP) {
const std::unique_ptr<MCInstPrinter> &IP, bool SkipFailures) {
MCTargetOptions Opts;
Opts.PreserveAsmComments = false;
CodeRegions &Regions = getRegions();
Expand Down Expand Up @@ -61,7 +61,16 @@ Expected<const CodeRegions &> AsmCodeRegionGenerator::parseCodeRegions(
"This target does not support assembly parsing.",
inconvertibleErrorCode());
Parser->setTargetParser(*TAP);
Parser->Run(false);
// Parser->Run() confusingly returns true on errors, in which case the errors
// were already shown to the user. SkipFailures implies continuing in the
// presence of any kind of failure within the parser, in which case failing
// input lines are not represented, but the rest of the input remains.
if (Parser->Run(false) && !SkipFailures) {
const char *Message = "Assembly input parsing had errors, use "
"-skip-unsupported-instructions=parse-failure "
"to drop failing lines from the input.";
return make_error<StringError>(Message, inconvertibleErrorCode());
}

if (CCP->hadErr())
return make_error<StringError>("There was an error parsing comments.",
Expand Down
34 changes: 22 additions & 12 deletions llvm/tools/llvm-mca/CodeRegionGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ class CodeRegionGenerator {
CodeRegionGenerator(const CodeRegionGenerator &) = delete;
CodeRegionGenerator &operator=(const CodeRegionGenerator &) = delete;
virtual Expected<const CodeRegions &>
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP) = 0;
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) = 0;

public:
CodeRegionGenerator() {}
Expand All @@ -164,7 +165,8 @@ class AnalysisRegionGenerator : public virtual CodeRegionGenerator {
AnalysisRegionGenerator(llvm::SourceMgr &SM) : Regions(SM) {}

virtual Expected<const AnalysisRegions &>
parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP) = 0;
parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) = 0;
};

/// Abstract CodeRegionGenerator with InstrumentRegionsRegions member
Expand All @@ -176,7 +178,8 @@ class InstrumentRegionGenerator : public virtual CodeRegionGenerator {
InstrumentRegionGenerator(llvm::SourceMgr &SM) : Regions(SM) {}

virtual Expected<const InstrumentRegions &>
parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP) = 0;
parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) = 0;
};

/// This abstract class is responsible for parsing input ASM and
Expand All @@ -202,7 +205,8 @@ class AsmCodeRegionGenerator : public virtual CodeRegionGenerator {

unsigned getAssemblerDialect() const { return AssemblerDialect; }
Expected<const CodeRegions &>
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP) override;
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) override;
};

class AsmAnalysisRegionGenerator final : public AnalysisRegionGenerator,
Expand All @@ -222,17 +226,20 @@ class AsmAnalysisRegionGenerator final : public AnalysisRegionGenerator,
MCStreamerWrapper *getMCStreamer() override { return &Streamer; }

Expected<const AnalysisRegions &>
parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP) override {
Expected<const CodeRegions &> RegionsOrErr = parseCodeRegions(IP);
parseAnalysisRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) override {
Expected<const CodeRegions &> RegionsOrErr =
parseCodeRegions(IP, SkipFailures);
if (!RegionsOrErr)
return RegionsOrErr.takeError();
else
return static_cast<const AnalysisRegions &>(*RegionsOrErr);
}

Expected<const CodeRegions &>
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP) override {
return AsmCodeRegionGenerator::parseCodeRegions(IP);
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) override {
return AsmCodeRegionGenerator::parseCodeRegions(IP, SkipFailures);
}
};

Expand All @@ -254,17 +261,20 @@ class AsmInstrumentRegionGenerator final : public InstrumentRegionGenerator,
MCStreamerWrapper *getMCStreamer() override { return &Streamer; }

Expected<const InstrumentRegions &>
parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP) override {
Expected<const CodeRegions &> RegionsOrErr = parseCodeRegions(IP);
parseInstrumentRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) override {
Expected<const CodeRegions &> RegionsOrErr =
parseCodeRegions(IP, SkipFailures);
if (!RegionsOrErr)
return RegionsOrErr.takeError();
else
return static_cast<const InstrumentRegions &>(*RegionsOrErr);
}

Expected<const CodeRegions &>
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP) override {
return AsmCodeRegionGenerator::parseCodeRegions(IP);
parseCodeRegions(const std::unique_ptr<MCInstPrinter> &IP,
bool SkipFailures) override {
return AsmCodeRegionGenerator::parseCodeRegions(IP, SkipFailures);
}
};

Expand Down
Loading