[PATCH] D70478: [MIRVRegNamerUtils] Fix for BasicBlock numbering parameter.
Puyan Lotfi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 00:21:34 PST 2019
plotfi updated this revision to Diff 230201.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70478/new/
https://reviews.llvm.org/D70478
Files:
llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
llvm/lib/CodeGen/MIRNamerPass.cpp
llvm/lib/CodeGen/MIRVRegNamerUtils.h
Index: llvm/lib/CodeGen/MIRVRegNamerUtils.h
===================================================================
--- llvm/lib/CodeGen/MIRVRegNamerUtils.h
+++ llvm/lib/CodeGen/MIRVRegNamerUtils.h
@@ -84,7 +84,7 @@
/// Same as the above, but sets a BBNum depending on BB traversal that
/// will be used as prefix for the vreg names.
- bool renameVRegs(MachineBasicBlock *MBB, unsigned BBNum = 0);
+ bool renameVRegs(MachineBasicBlock *MBB, unsigned BBNum);
unsigned getCurrentBBNumber() const { return CurrentBBNumber; }
};
Index: llvm/lib/CodeGen/MIRNamerPass.cpp
===================================================================
--- llvm/lib/CodeGen/MIRNamerPass.cpp
+++ llvm/lib/CodeGen/MIRNamerPass.cpp
@@ -57,9 +57,10 @@
VRegRenamer Renamer(MF.getRegInfo());
+ unsigned BBIndex = 0;
ReversePostOrderTraversal<MachineBasicBlock *> RPOT(&*MF.begin());
for (auto &MBB : RPOT)
- Changed |= Renamer.renameVRegs(MBB);
+ Changed |= Renamer.renameVRegs(MBB, BBIndex++);
return Changed;
}
Index: llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
===================================================================
--- llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
+++ llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
@@ -49,10 +49,6 @@
cl::value_desc("N"),
cl::desc("Function number to canonicalize."));
-static cl::opt<unsigned> CanonicalizeBasicBlockNumber(
- "canon-nth-basicblock", cl::Hidden, cl::init(~0u), cl::value_desc("N"),
- cl::desc("BasicBlock number to canonicalize."));
-
namespace {
class MIRCanonicalizer : public MachineFunctionPass {
@@ -375,15 +371,7 @@
static bool runOnBasicBlock(MachineBasicBlock *MBB,
std::vector<StringRef> &bbNames,
- unsigned &basicBlockNum, VRegRenamer &Renamer) {
-
- if (CanonicalizeBasicBlockNumber != ~0U) {
- if (CanonicalizeBasicBlockNumber != basicBlockNum++)
- return false;
- LLVM_DEBUG(dbgs() << "\n Canonicalizing BasicBlock " << MBB->getName()
- << "\n";);
- }
-
+ unsigned BasicBlockNum, VRegRenamer &Renamer) {
if (llvm::find(bbNames, MBB->getName()) != bbNames.end()) {
LLVM_DEBUG({
dbgs() << "Found potentially duplicate BasicBlocks: " << MBB->getName()
@@ -412,7 +400,7 @@
Changed |= rescheduleCanonically(IdempotentInstCount, MBB);
LLVM_DEBUG(dbgs() << "MBB After Scheduling:\n"; MBB->dump(););
- Changed |= Renamer.renameVRegs(MBB);
+ Changed |= Renamer.renameVRegs(MBB, BasicBlockNum);
Changed |= doDefKillClear(MBB);
@@ -454,7 +442,7 @@
MachineRegisterInfo &MRI = MF.getRegInfo();
VRegRenamer Renamer(MRI);
for (auto MBB : RPOList)
- Changed |= runOnBasicBlock(MBB, BBNames, BBNum, Renamer);
+ Changed |= runOnBasicBlock(MBB, BBNames, BBNum++, Renamer);
return Changed;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70478.230201.patch
Type: text/x-patch
Size: 2921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191120/546908d8/attachment.bin>
More information about the llvm-commits
mailing list