1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[llvm-exegesis] Fix D80610.

Summary:
Using a .data() member on a StringRef was discarding the StringRef
size, breaking llvm-exegesis on machines with counter sums (e.g.
Zen2).

Reviewers: oontvoo

Subscribers: mstojanovic, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80982
This commit is contained in:
Clement Courbet 2020-06-02 09:36:11 +02:00
parent 7788e0be2b
commit 0857d5bd0f
3 changed files with 3 additions and 4 deletions

View File

@ -55,7 +55,7 @@ private:
for (auto &CounterName : CounterNames) {
CounterName = CounterName.trim();
auto CounterOrError =
State.getExegesisTarget().createCounter(CounterName.data(), State);
State.getExegesisTarget().createCounter(CounterName, State);
if (!CounterOrError)
return CounterOrError.takeError();

View File

@ -30,8 +30,7 @@ const ExegesisTarget *ExegesisTarget::lookup(Triple TT) {
}
Expected<std::unique_ptr<pfm::Counter>>
ExegesisTarget::createCounter(const char *CounterName,
const LLVMState &) const {
ExegesisTarget::createCounter(StringRef CounterName, const LLVMState &) const {
pfm::PerfEvent Event(CounterName);
if (!Event.valid())
return llvm::make_error<Failure>(

View File

@ -69,7 +69,7 @@ public:
// Targets can use this to create target-specific perf counters.
virtual Expected<std::unique_ptr<pfm::Counter>>
createCounter(const char *CounterName, const LLVMState &State) const;
createCounter(StringRef CounterName, const LLVMState &State) const;
// Targets can use this to add target-specific passes in assembleToStream();
virtual void addTargetSpecificPasses(PassManagerBase &PM) const {}