[llvm-mca] Use llvm::ArrayRef in class SourceMgr. NFCI

Class SourceMgr now uses type ArrayRef<MCInst> to reference the
sequence of code from a "CodeRegion".

llvm-svn: 344911
diff --git a/llvm/tools/llvm-mca/include/SourceMgr.h b/llvm/tools/llvm-mca/include/SourceMgr.h
index 573ca7a..8941283 100644
--- a/llvm/tools/llvm-mca/include/SourceMgr.h
+++ b/llvm/tools/llvm-mca/include/SourceMgr.h
@@ -16,29 +16,29 @@
 #ifndef LLVM_TOOLS_LLVM_MCA_SOURCEMGR_H
 #define LLVM_TOOLS_LLVM_MCA_SOURCEMGR_H
 
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCInst.h"
 #include <vector>
 
 namespace mca {
 
-typedef std::pair<unsigned, const llvm::MCInst *> SourceRef;
+typedef std::pair<unsigned, const llvm::MCInst &> SourceRef;
 
 class SourceMgr {
-  using InstVec = std::vector<std::unique_ptr<const llvm::MCInst>>;
-  const InstVec &Sequence;
+  llvm::ArrayRef<llvm::MCInst> Sequence;
   unsigned Current;
   unsigned Iterations;
   static const unsigned DefaultIterations = 100;
 
 public:
-  SourceMgr(const InstVec &MCInstSequence, unsigned NumIterations)
+  SourceMgr(llvm::ArrayRef<llvm::MCInst> MCInstSequence, unsigned NumIterations)
       : Sequence(MCInstSequence), Current(0),
         Iterations(NumIterations ? NumIterations : DefaultIterations) {}
 
   unsigned getCurrentIteration() const { return Current / Sequence.size(); }
   unsigned getNumIterations() const { return Iterations; }
   unsigned size() const { return Sequence.size(); }
-  const InstVec &getSequence() const { return Sequence; }
+  llvm::ArrayRef<llvm::MCInst> getSequence() const { return Sequence; }
 
   bool hasNext() const { return Current < (Iterations * size()); }
   void updateNext() { Current++; }
@@ -46,7 +46,7 @@
   const SourceRef peekNext() const {
     assert(hasNext() && "Already at end of sequence!");
     unsigned Index = getCurrentInstructionIndex();
-    return SourceRef(Current, Sequence[Index].get());
+    return SourceRef(Current, Sequence[Index]);
   }
 
   unsigned getCurrentInstructionIndex() const {
@@ -54,7 +54,7 @@
   }
 
   const llvm::MCInst &getMCInstFromIndex(unsigned Index) const {
-    return *Sequence[Index % size()];
+    return Sequence[Index % size()];
   }
 
   bool isEmpty() const { return size() == 0; }