Skip to content

Commit 7da6a56

Browse files
asbmahesh-attarde
authored andcommitted
[RISCV][NFC] Add NumTransformedToNonWInstrs statistic to RISCVOptWInstrs extend debug printing
RISCVOptWInstrs has a NumTransformedToWInstrs statistic, but didn't have one for the W=>Non-W transform done by stripWSuffixes. It also didn't do debug printing of the transformation. This patch addresses both issues. Reviewed as part of <llvm#149071>, but landing separately.
1 parent 5093f3a commit 7da6a56

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ using namespace llvm;
4848
STATISTIC(NumRemovedSExtW, "Number of removed sign-extensions");
4949
STATISTIC(NumTransformedToWInstrs,
5050
"Number of instructions transformed to W-ops");
51+
STATISTIC(NumTransformedToNonWInstrs,
52+
"Number of instructions transformed to non-W-ops");
5153

5254
static cl::opt<bool> DisableSExtWRemoval("riscv-disable-sextw-removal",
5355
cl::desc("Disable removal of sext.w"),
@@ -739,7 +741,10 @@ bool RISCVOptWInstrs::stripWSuffixes(MachineFunction &MF,
739741
}
740742

741743
if (hasAllWUsers(MI, ST, MRI)) {
744+
LLVM_DEBUG(dbgs() << "Replacing " << MI);
742745
MI.setDesc(TII.get(Opc));
746+
LLVM_DEBUG(dbgs() << " with " << MI);
747+
++NumTransformedToNonWInstrs;
743748
MadeChange = true;
744749
}
745750
}

0 commit comments

Comments
 (0)