[llvm] r279739 - [Hexagon] vector store print tracing.

Ron Lieberman via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 06:35:50 PDT 2016


Author: ronl
Date: Thu Aug 25 08:35:48 2016
New Revision: 279739

URL: http://llvm.org/viewvc/llvm-project?rev=279739&view=rev
Log:
[Hexagon] vector store print tracing.

Add vector store print tracing option for hexagon vector instructions.

https://reviews.llvm.org/D23870


Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp
    llvm/trunk/test/CodeGen/Hexagon/v6vec-vprint.ll

Modified: llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp?rev=279739&r1=279738&r2=279739&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonVectorPrint.cpp Thu Aug 25 08:35:48 2016
@@ -20,6 +20,10 @@
 
 using namespace llvm;
 
+static cl::opt<bool> TraceHexVectorStoresOnly("trace-hex-vector-stores-only",
+  cl::Hidden, cl::ZeroOrMore, cl::init(false),
+  cl::desc("Enables tracing of vector stores"));
+
 namespace llvm {
   FunctionPass *createHexagonVectorPrint();
   void initializeHexagonVectorPrintPass(PassRegistry&);
@@ -89,7 +93,7 @@ static bool getInstrVecReg(const Machine
   if (MI.getOperand(0).isReg() && MI.getOperand(0).isDef()) {
     Reg = MI.getOperand(0).getReg();
     if (isVecReg(Reg))
-      return true;
+      return !TraceHexVectorStoresOnly;
   }
   // Vec store.
   if (MI.mayStore() && MI.getNumOperands() >= 3 && MI.getOperand(2).isReg()) {
@@ -117,7 +121,8 @@ bool HexagonVectorPrint::runOnMachineFun
       if (MI.isBundle()) {
         MachineBasicBlock::instr_iterator MII = MI.getIterator();
         for (++MII; MII != MBB.instr_end() && MII->isInsideBundle(); ++MII) {
-          if (MII->getNumOperands() < 1) continue;
+          if (MII->getNumOperands() < 1)
+            continue;
           unsigned Reg = 0;
           if (getInstrVecReg(*MII, Reg)) {
             VecPrintList.push_back((&*MII));
@@ -134,7 +139,8 @@ bool HexagonVectorPrint::runOnMachineFun
     }
 
   Changed = VecPrintList.size() > 0;
-  if (!Changed) return Changed;
+  if (!Changed)
+    return Changed;
 
   for (auto *I : VecPrintList) {
     DebugLoc DL = I->getDebugLoc();
@@ -146,11 +152,15 @@ bool HexagonVectorPrint::runOnMachineFun
     MachineBasicBlock::instr_iterator MII = I->getIterator();
     if (I->isInsideBundle()) {
       DEBUG(dbgs() << "add to end of bundle\n"; I->dump());
-      while (MII->isInsideBundle()) ++MII;
+      while (MBB->instr_end() != MII && MII->isInsideBundle())
+        MII++;
     } else {
       DEBUG(dbgs() << "add after instruction\n"; I->dump());
       MII++;
     }
+    if (MBB->instr_end() == MII)
+      continue;
+
     if (Reg >= Hexagon::V0 && Reg <= Hexagon::V31) {
       DEBUG(dbgs() << "adding dump for V" << Reg-Hexagon::V0 << '\n');
       addAsmInstr(MBB, Reg, MII, DL, QII, Fn);

Modified: llvm/trunk/test/CodeGen/Hexagon/v6vec-vprint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/v6vec-vprint.ll?rev=279739&r1=279738&r2=279739&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/v6vec-vprint.ll (original)
+++ llvm/trunk/test/CodeGen/Hexagon/v6vec-vprint.ll Thu Aug 25 08:35:48 2016
@@ -1,6 +1,11 @@
 ; RUN: llc -march=hexagon -mcpu=hexagonv60 -enable-hexagon-hvx -disable-hexagon-shuffle=0 -O2 -enable-hexagon-vector-print < %s | FileCheck --check-prefix=CHECK %s
+; RUN: llc -march=hexagon -mcpu=hexagonv60 -enable-hexagon-hvx -disable-hexagon-shuffle=0 -O2 -enable-hexagon-vector-print -trace-hex-vector-stores-only < %s | FileCheck --check-prefix=VSTPRINT %s
 ;   generate .long XXXX which is a vector debug print instruction.
 ; CHECK: .long 0x1dffe0
+; CHECK: .long 0x1dffe0
+; CHECK: .long 0x1dffe0
+; VSTPRINT: .long 0x1dffe0
+; VSTPRINT-NOT: .long 0x1dffe0
 target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a:0-n16:32"
 target triple = "hexagon"
 




More information about the llvm-commits mailing list