26
26
27
27
#include " RISCV.h"
28
28
#include " RISCVSubtarget.h"
29
+ #include " llvm/ADT/Statistic.h"
29
30
#include " llvm/CodeGen/LiveIntervals.h"
30
31
#include " llvm/CodeGen/MachineFunctionPass.h"
31
32
#include < queue>
@@ -34,6 +35,9 @@ using namespace llvm;
34
35
#define DEBUG_TYPE " riscv-insert-vsetvli"
35
36
#define RISCV_INSERT_VSETVLI_NAME " RISC-V Insert VSETVLI pass"
36
37
38
+ STATISTIC (NumInsertedVSETVL, " Number of VSETVL inst inserted" );
39
+ STATISTIC (NumRemovedVSETVL, " Number of VSETVL inst removed" );
40
+
37
41
static cl::opt<bool > DisableInsertVSETVLPHIOpt (
38
42
" riscv-disable-insert-vsetvl-phi-opt" , cl::init(false ), cl::Hidden,
39
43
cl::desc(" Disable looking through phis when inserting vsetvlis." ));
@@ -911,6 +915,7 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB,
911
915
MachineBasicBlock::iterator InsertPt, DebugLoc DL,
912
916
const VSETVLIInfo &Info, const VSETVLIInfo &PrevInfo) {
913
917
918
+ ++NumInsertedVSETVL;
914
919
if (PrevInfo.isValid () && !PrevInfo.isUnknown ()) {
915
920
// Use X0, X0 form if the AVL is the same and the SEW+LMUL gives the same
916
921
// VLMAX.
@@ -1578,6 +1583,7 @@ void RISCVInsertVSETVLI::doLocalPostpass(MachineBasicBlock &MBB) {
1578
1583
Used = getDemanded (MI, MRI, ST);
1579
1584
}
1580
1585
1586
+ NumRemovedVSETVL += ToDelete.size ();
1581
1587
for (auto *MI : ToDelete)
1582
1588
MI->eraseFromParent ();
1583
1589
}
0 commit comments