OSDN Git Service

[MCA] Avoid an InstrDesc copy in mca::LSUnit::reserve.
authorDean Michael Berris <dberris@google.com>
Thu, 26 Jul 2018 00:02:54 +0000 (00:02 +0000)
committerDean Michael Berris <dberris@google.com>
Thu, 26 Jul 2018 00:02:54 +0000 (00:02 +0000)
Summary:
InstrDesc contains 4 vectors (as well as some other data), so it's
expensive to copy.

Authored By: orodley

Reviewers: andreadb, mattd, dberris

Reviewed By: mattd, dberris

Subscribers: dberris, gbedwell, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337985 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-mca/LSUnit.cpp

index 4406e30..9ee3b61 100644 (file)
@@ -52,7 +52,7 @@ void LSUnit::assignSQSlot(unsigned Index) {
 }
 
 bool LSUnit::reserve(const InstRef &IR) {
-  const InstrDesc Desc = IR.getInstruction()->getDesc();
+  const InstrDesc &Desc = IR.getInstruction()->getDesc();
   unsigned MayLoad = Desc.MayLoad;
   unsigned MayStore = Desc.MayStore;
   unsigned IsMemBarrier = Desc.HasSideEffects;