mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-01 07:30:33 +00:00
[llvm-mca] Fix how views are added to the InstructionTables.
This should fix the stack-use-after-scope reported by the asan buildbots after revision 328493. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4432622fbc
commit
7fa3ae5ae3
@ -134,6 +134,109 @@ unpcklps (%rax), %xmm2
|
||||
xorps %xmm0, %xmm2
|
||||
xorps (%rax), %xmm2
|
||||
|
||||
|
||||
# CHECK: Instruction Info:
|
||||
# CHECK-NEXT: [1]: #uOps
|
||||
# CHECK-NEXT: [2]: Latency
|
||||
# CHECK-NEXT: [3]: RThroughput
|
||||
# CHECK-NEXT: [4]: MayLoad
|
||||
# CHECK-NEXT: [5]: MayStore
|
||||
# CHECK-NEXT: [6]: HasSideEffects
|
||||
|
||||
# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
|
||||
# CHECK-NEXT: 1 3 1.00 addps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 8 1.00 * addps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 addss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 8 1.00 * addss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 andnps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * andnps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 andps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * andps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 cmpps $0, %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * cmpps $0, (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 cmpss $0, %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * cmpss $0, (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 comiss %xmm0, %xmm1
|
||||
# CHECK-NEXT: 1 8 1.00 * comiss (%rax), %xmm1
|
||||
# CHECK-NEXT: 1 3 1.00 cvtsi2ssl %ecx, %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 cvtsi2ssq %rcx, %xmm2
|
||||
# CHECK-NEXT: 1 8 1.00 * cvtsi2ssl (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 8 1.00 * cvtsi2ssl (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 cvtss2si %xmm0, %ecx
|
||||
# CHECK-NEXT: 1 3 1.00 cvtss2si %xmm0, %rcx
|
||||
# CHECK-NEXT: 1 8 1.00 * cvtss2si (%rax), %ecx
|
||||
# CHECK-NEXT: 1 8 1.00 * cvtss2si (%rax), %rcx
|
||||
# CHECK-NEXT: 1 3 1.00 cvttss2si %xmm0, %ecx
|
||||
# CHECK-NEXT: 1 3 1.00 cvttss2si %xmm0, %rcx
|
||||
# CHECK-NEXT: 1 8 1.00 * cvttss2si (%rax), %ecx
|
||||
# CHECK-NEXT: 1 8 1.00 * cvttss2si (%rax), %rcx
|
||||
# CHECK-NEXT: 1 19 19.00 divps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 24 19.00 * divps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 19 19.00 divss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 24 19.00 * divss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 5 1.00 * * * ldmxcsr (%rax)
|
||||
# CHECK-NEXT: 1 2 1.00 maxps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * maxps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 maxss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * maxss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 minps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * minps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 minss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * minss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 movaps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 1 1.00 * movaps %xmm0, (%rax)
|
||||
# CHECK-NEXT: 1 5 1.00 * movaps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 movhlps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 movlhps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 1 1.00 * movhps %xmm0, (%rax)
|
||||
# CHECK-NEXT: 1 6 1.00 * movhps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 1.00 * movlps %xmm0, (%rax)
|
||||
# CHECK-NEXT: 1 6 1.00 * movlps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 movmskps %xmm0, %ecx
|
||||
# CHECK-NEXT: 1 3 1.00 * movntps %xmm0, (%rax)
|
||||
# CHECK-NEXT: 1 1 0.50 movss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 1 1.00 * movss %xmm0, (%rax)
|
||||
# CHECK-NEXT: 1 5 1.00 * movss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 movups %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 1 1.00 * movups %xmm0, (%rax)
|
||||
# CHECK-NEXT: 1 5 1.00 * movups (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 mulps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * mulps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 mulss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * mulss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 orps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * orps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 pinsrw $1, %eax, %xmm1
|
||||
# CHECK-NEXT: 1 6 1.00 * pinsrw $1, (%rax), %xmm1
|
||||
# CHECK-NEXT: 1 2 1.00 rcpps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * rcpps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 rcpss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * rcpss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 rsqrtps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * rsqrtps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 2 1.00 rsqrtss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 7 1.00 * rsqrtss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 shufps $1, %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * shufps $1, (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 21 21.00 sqrtps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 26 21.00 * sqrtps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 21 21.00 sqrtss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 26 21.00 * sqrtss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 1.00 * * * stmxcsr (%rax)
|
||||
# CHECK-NEXT: 1 3 1.00 subps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 8 1.00 * subps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 subss %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 8 1.00 * subss (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 3 1.00 ucomiss %xmm0, %xmm1
|
||||
# CHECK-NEXT: 1 8 1.00 * ucomiss (%rax), %xmm1
|
||||
# CHECK-NEXT: 1 1 0.50 unpckhps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * unpckhps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 unpcklps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * unpcklps (%rax), %xmm2
|
||||
# CHECK-NEXT: 1 1 0.50 xorps %xmm0, %xmm2
|
||||
# CHECK-NEXT: 1 6 1.00 * xorps (%rax), %xmm2
|
||||
|
||||
|
||||
# CHECK: Resources:
|
||||
# CHECK-NEXT: [0] - JALU0
|
||||
# CHECK-NEXT: [1] - JALU1
|
||||
|
@ -69,12 +69,17 @@ void InstructionTables::run() {
|
||||
}
|
||||
}
|
||||
|
||||
// Now send a fake instruction issued event to all the listeners.
|
||||
// Now send a fake instruction issued event to all the views.
|
||||
HWInstructionIssuedEvent Event(IR.first, UsedResources);
|
||||
for (HWEventListener *Listener : Listeners)
|
||||
for (std::unique_ptr<View> &Listener : Views)
|
||||
Listener->onInstructionEvent(Event);
|
||||
S.updateNext();
|
||||
}
|
||||
}
|
||||
|
||||
void InstructionTables::printReport(llvm::raw_ostream &OS) const {
|
||||
for (const std::unique_ptr<View> &V : Views)
|
||||
V->printView(OS);
|
||||
}
|
||||
|
||||
} // namespace mca
|
||||
|
@ -17,9 +17,10 @@
|
||||
#ifndef LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
|
||||
#define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
|
||||
|
||||
#include "HWEventListener.h"
|
||||
#include "View.h"
|
||||
#include "InstrBuilder.h"
|
||||
#include "SourceMgr.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/MC/MCSchedule.h"
|
||||
|
||||
namespace mca {
|
||||
@ -28,19 +29,20 @@ class InstructionTables {
|
||||
const llvm::MCSchedModel &SM;
|
||||
InstrBuilder &IB;
|
||||
SourceMgr &S;
|
||||
std::set<HWEventListener *> Listeners;
|
||||
llvm::SmallVector<std::unique_ptr<View>, 8> Views;
|
||||
|
||||
public:
|
||||
InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder,
|
||||
SourceMgr &Source)
|
||||
: SM(Model), IB(Builder), S(Source) {}
|
||||
|
||||
void addEventListener(HWEventListener *Listener) {
|
||||
if (Listener)
|
||||
Listeners.insert(Listener);
|
||||
void addView(std::unique_ptr<View> V) {
|
||||
Views.emplace_back(std::move(V));
|
||||
}
|
||||
|
||||
void run();
|
||||
|
||||
void printReport(llvm::raw_ostream &OS) const;
|
||||
};
|
||||
} // namespace mca
|
||||
|
||||
|
@ -273,8 +273,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
std::unique_ptr<buffer_ostream> BOS;
|
||||
|
||||
std::unique_ptr<mca::SourceMgr> S =
|
||||
llvm::make_unique<mca::SourceMgr>(PrintInstructionTables ? 1 : Iterations);
|
||||
std::unique_ptr<mca::SourceMgr> S = llvm::make_unique<mca::SourceMgr>(
|
||||
PrintInstructionTables ? 1 : Iterations);
|
||||
MCStreamerWrapper Str(Ctx, S->getSequence());
|
||||
|
||||
std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
|
||||
@ -343,14 +343,13 @@ int main(int argc, char **argv) {
|
||||
mca::InstructionTables IT(STI->getSchedModel(), *IB, *S);
|
||||
|
||||
if (PrintInstructionInfoView) {
|
||||
mca::InstructionInfoView IIV(*STI, *MCII, *S, *IP);
|
||||
IT.addEventListener(&IIV);
|
||||
IT.addView(
|
||||
llvm::make_unique<mca::InstructionInfoView>(*STI, *MCII, *S, *IP));
|
||||
}
|
||||
|
||||
mca::ResourcePressureView RPV(*STI, *IP, *S);
|
||||
IT.addEventListener(&RPV);
|
||||
IT.addView(llvm::make_unique<mca::ResourcePressureView>(*STI, *IP, *S));
|
||||
IT.run();
|
||||
RPV.printView(TOF->os());
|
||||
IT.printReport(TOF->os());
|
||||
TOF->keep();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user