[PATCH] D137970: [RISCV] Transform fixable instruction in place in RISCVSExtWRemoval. NFC
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 21 19:27:18 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e6adb394ebc: [RISCV] Transform fixable instruction in place in RISCVSExtWRemoval. NFC (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137970/new/
https://reviews.llvm.org/D137970
Files:
llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
Index: llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
+++ llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
@@ -492,6 +492,7 @@
MachineRegisterInfo &MRI = MF.getRegInfo();
const RISCVSubtarget &ST = MF.getSubtarget<RISCVSubtarget>();
+ const RISCVInstrInfo &TII = *ST.getInstrInfo();
if (!ST.is64Bit())
return false;
@@ -531,22 +532,14 @@
Register DstReg = MI->getOperand(0).getReg();
if (!MRI.constrainRegClass(SrcReg, MRI.getRegClass(DstReg)))
continue;
- // Replace Fixable instructions with their W versions.
+ // Convert Fixable instructions to their W versions.
for (MachineInstr *Fixable : FixableDef) {
- MachineBasicBlock &MBB = *Fixable->getParent();
- const DebugLoc &DL = Fixable->getDebugLoc();
- unsigned Code = getWOp(Fixable->getOpcode());
- MachineInstrBuilder Replacement =
- BuildMI(MBB, Fixable, DL, ST.getInstrInfo()->get(Code));
- for (auto Op : Fixable->operands())
- Replacement.add(Op);
- for (auto *Op : Fixable->memoperands())
- Replacement.addMemOperand(Op);
-
LLVM_DEBUG(dbgs() << "Replacing " << *Fixable);
- LLVM_DEBUG(dbgs() << " with " << *Replacement);
-
- Fixable->eraseFromParent();
+ Fixable->setDesc(TII.get(getWOp(Fixable->getOpcode())));
+ Fixable->clearFlag(MachineInstr::MIFlag::NoSWrap);
+ Fixable->clearFlag(MachineInstr::MIFlag::NoUWrap);
+ Fixable->clearFlag(MachineInstr::MIFlag::IsExact);
+ LLVM_DEBUG(dbgs() << " with " << *Fixable);
++NumTransformedToWInstrs;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137970.477048.patch
Type: text/x-patch
Size: 1683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221122/fe1e04ba/attachment.bin>
More information about the llvm-commits
mailing list