[PATCH] D62543: [MIR-Canon] Add support for rewriting VRegs that are typed but don't have an RC.
Puyan Lotfi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 30 10:04:25 PDT 2019
plotfi updated this revision to Diff 202234.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62543/new/
https://reviews.llvm.org/D62543
Files:
llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
llvm/test/CodeGen/MIR/AArch64/addrspace-memoperands.mir
Index: llvm/test/CodeGen/MIR/AArch64/addrspace-memoperands.mir
===================================================================
--- llvm/test/CodeGen/MIR/AArch64/addrspace-memoperands.mir
+++ llvm/test/CodeGen/MIR/AArch64/addrspace-memoperands.mir
@@ -1,4 +1,5 @@
# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass none -o - %s | FileCheck %s
+# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass mir-canonicalizer -o - %s
--- |
Index: llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
===================================================================
--- llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
+++ llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
@@ -500,14 +500,15 @@
return virtualVRegNumber;
}
- unsigned createVirtualRegister(const TargetRegisterClass *RC) {
+ unsigned createVirtualRegister(unsigned VReg) {
std::string S;
raw_string_ostream OS(S);
OS << "namedVReg" << (virtualVRegNumber & ~0x80000000);
OS.flush();
virtualVRegNumber++;
-
- return MRI.createVirtualRegister(RC, OS.str());
+ if (auto RC = MRI.getRegClassOrNull(VReg))
+ return MRI.createVirtualRegister(RC, OS.str());
+ return MRI.createGenericVirtualRegister(MRI.getType(VReg), OS.str());
}
};
} // namespace
@@ -557,7 +558,7 @@
continue;
}
- auto Rename = NVC.createVirtualRegister(MRI.getRegClass(Reg));
+ auto Rename = NVC.createVirtualRegister(Reg);
if (VRegRenameMap.find(Reg) == VRegRenameMap.end()) {
LLVM_DEBUG(dbgs() << "Mapping vreg ";);
@@ -741,7 +742,7 @@
MachineInstr &MI = *MII++;
Changed = true;
unsigned vRegToRename = MI.getOperand(0).getReg();
- auto Rename = NVC.createVirtualRegister(MRI.getRegClass(vRegToRename));
+ auto Rename = NVC.createVirtualRegister(vRegToRename);
std::vector<MachineOperand *> RenameMOs;
for (auto &MO : MRI.reg_operands(vRegToRename)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62543.202234.patch
Type: text/x-patch
Size: 1882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190530/879ff369/attachment.bin>
More information about the llvm-commits
mailing list