diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h index 9e7893d5c4142..dd1a1d8a792d6 100644 --- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h +++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h @@ -1306,7 +1306,7 @@ class TargetInstrInfo : public MCInstrInfo { MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstIdxForVirtReg) const; + DenseMap &InstIdxForVirtReg) const; /// When calculate the latency of the root instruction, accumulate the /// latency of the sequence to the root latency. @@ -1329,7 +1329,7 @@ class TargetInstrInfo : public MCInstrInfo { SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, ArrayRef OperandIndices, - DenseMap &InstrIdxForVirtReg) const; + DenseMap &InstrIdxForVirtReg) const; /// Reassociation of some instructions requires inverse operations (e.g. /// (X + A) - Y => (X - Y) + A). This method returns a pair of new opcodes diff --git a/llvm/lib/CodeGen/MachineCombiner.cpp b/llvm/lib/CodeGen/MachineCombiner.cpp index b8d59214a6ec3..54e2a009b464d 100644 --- a/llvm/lib/CodeGen/MachineCombiner.cpp +++ b/llvm/lib/CodeGen/MachineCombiner.cpp @@ -91,7 +91,7 @@ class MachineCombiner : public MachineFunctionPass { MachineInstr *getOperandDef(const MachineOperand &MO); bool isTransientMI(const MachineInstr *MI); unsigned getDepth(SmallVectorImpl &InsInstrs, - DenseMap &InstrIdxForVirtReg, + DenseMap &InstrIdxForVirtReg, MachineTraceMetrics::Trace BlockTrace, const MachineBasicBlock &MBB); unsigned getLatency(MachineInstr *Root, MachineInstr *NewRoot, @@ -100,7 +100,7 @@ class MachineCombiner : public MachineFunctionPass { MachineTraceMetrics::Trace BlockTrace, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg, + DenseMap &InstrIdxForVirtReg, unsigned Pattern, bool SlackIsAccurate); bool reduceRegisterPressure(MachineInstr &Root, MachineBasicBlock *MBB, SmallVectorImpl &InsInstrs, @@ -202,7 +202,7 @@ bool MachineCombiner::isTransientMI(const MachineInstr *MI) { /// \returns Depth of last instruction in \InsInstrs ("NewRoot") unsigned MachineCombiner::getDepth(SmallVectorImpl &InsInstrs, - DenseMap &InstrIdxForVirtReg, + DenseMap &InstrIdxForVirtReg, MachineTraceMetrics::Trace BlockTrace, const MachineBasicBlock &MBB) { SmallVector InstrDepth; @@ -217,7 +217,7 @@ MachineCombiner::getDepth(SmallVectorImpl &InsInstrs, continue; unsigned DepthOp = 0; unsigned LatencyOp = 0; - DenseMap::iterator II = + DenseMap::iterator II = InstrIdxForVirtReg.find(MO.getReg()); if (II != InstrIdxForVirtReg.end()) { // Operand is new virtual register not in trace @@ -353,7 +353,7 @@ bool MachineCombiner::improvesCriticalPathLen( MachineTraceMetrics::Trace BlockTrace, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg, unsigned Pattern, + DenseMap &InstrIdxForVirtReg, unsigned Pattern, bool SlackIsAccurate) { // Get depth and latency of NewRoot and Root. unsigned NewRootDepth = @@ -527,7 +527,7 @@ void MachineCombiner::verifyPatternOrder(MachineBasicBlock *MBB, for (auto P : Patterns) { SmallVector InsInstrs; SmallVector DelInstrs; - DenseMap InstrIdxForVirtReg; + DenseMap InstrIdxForVirtReg; TII->genAlternativeCodeSequence(Root, P, InsInstrs, DelInstrs, InstrIdxForVirtReg); // Found pattern, but did not generate alternative sequence. @@ -612,7 +612,7 @@ bool MachineCombiner::combineInstructions(MachineBasicBlock *MBB) { for (const auto P : Patterns) { SmallVector InsInstrs; SmallVector DelInstrs; - DenseMap InstrIdxForVirtReg; + DenseMap InstrIdxForVirtReg; TII->genAlternativeCodeSequence(MI, P, InsInstrs, DelInstrs, InstrIdxForVirtReg); // Found pattern, but did not generate alternative sequence. diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp index 7a905b65f26e5..e517ae1a7c44c 100644 --- a/llvm/lib/CodeGen/TargetInstrInfo.cpp +++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -1085,7 +1085,7 @@ void TargetInstrInfo::reassociateOps( SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, ArrayRef OperandIndices, - DenseMap &InstrIdxForVirtReg) const { + DenseMap &InstrIdxForVirtReg) const { MachineFunction *MF = Root.getMF(); MachineRegisterInfo &MRI = MF->getRegInfo(); const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo(); @@ -1250,7 +1250,7 @@ void TargetInstrInfo::genAlternativeCodeSequence( MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstIdxForVirtReg) const { + DenseMap &InstIdxForVirtReg) const { MachineRegisterInfo &MRI = Root.getMF()->getRegInfo(); // Select the previous instruction in the sequence based on the input pattern. diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 1d600e87230f3..c91590fa43601 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -7360,7 +7360,7 @@ static MachineInstr *genFusedMultiplyAcc( static Register genNeg(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl &InsInstrs, - DenseMap &InstrIdxForVirtReg, + DenseMap &InstrIdxForVirtReg, unsigned MnegOpc, const TargetRegisterClass *RC) { Register NewVR = MRI.createVirtualRegister(RC); MachineInstrBuilder MIB = @@ -7379,7 +7379,7 @@ static Register genNeg(MachineFunction &MF, MachineRegisterInfo &MRI, static MachineInstr *genFusedMultiplyAccNeg( MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl &InsInstrs, - DenseMap &InstrIdxForVirtReg, unsigned IdxMulOpd, + DenseMap &InstrIdxForVirtReg, unsigned IdxMulOpd, unsigned MaddOpc, unsigned MnegOpc, const TargetRegisterClass *RC) { assert(IdxMulOpd == 1); @@ -7406,7 +7406,7 @@ static MachineInstr *genFusedMultiplyIdx( static MachineInstr *genFusedMultiplyIdxNeg( MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl &InsInstrs, - DenseMap &InstrIdxForVirtReg, unsigned IdxMulOpd, + DenseMap &InstrIdxForVirtReg, unsigned IdxMulOpd, unsigned MaddOpc, unsigned MnegOpc, const TargetRegisterClass *RC) { assert(IdxMulOpd == 1); @@ -7472,13 +7472,12 @@ static MachineInstr *genMaddR(MachineFunction &MF, MachineRegisterInfo &MRI, /// Do the following transformation /// A - (B + C) ==> (A - B) - C /// A - (B + C) ==> (A - C) - B -static void -genSubAdd2SubSub(MachineFunction &MF, MachineRegisterInfo &MRI, - const TargetInstrInfo *TII, MachineInstr &Root, - SmallVectorImpl &InsInstrs, - SmallVectorImpl &DelInstrs, - unsigned IdxOpd1, - DenseMap &InstrIdxForVirtReg) { +static void genSubAdd2SubSub(MachineFunction &MF, MachineRegisterInfo &MRI, + const TargetInstrInfo *TII, MachineInstr &Root, + SmallVectorImpl &InsInstrs, + SmallVectorImpl &DelInstrs, + unsigned IdxOpd1, + DenseMap &InstrIdxForVirtReg) { assert(IdxOpd1 == 1 || IdxOpd1 == 2); unsigned IdxOtherOpd = IdxOpd1 == 1 ? 2 : 1; MachineInstr *AddMI = MRI.getUniqueVRegDef(Root.getOperand(2).getReg()); @@ -7531,7 +7530,7 @@ void AArch64InstrInfo::genAlternativeCodeSequence( MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const { + DenseMap &InstrIdxForVirtReg) const { MachineBasicBlock &MBB = *Root.getParent(); MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo(); MachineFunction &MF = *MBB.getParent(); diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/llvm/lib/Target/AArch64/AArch64InstrInfo.h index 3eab98139fa7c..6503d105c82cc 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.h +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.h @@ -454,7 +454,7 @@ class AArch64InstrInfo final : public AArch64GenInstrInfo { MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const override; + DenseMap &InstrIdxForVirtReg) const override; /// AArch64 supports MachineCombiner. bool useMachineCombiner() const override; diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index f12400490832b..f017073911950 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -767,7 +767,7 @@ void PPCInstrInfo::genAlternativeCodeSequence( MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const { + DenseMap &InstrIdxForVirtReg) const { switch (Pattern) { case PPCMachineCombinerPattern::REASSOC_XY_AMM_BMM: case PPCMachineCombinerPattern::REASSOC_XMM_AMM_BMM: @@ -787,7 +787,7 @@ void PPCInstrInfo::reassociateFMA( MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const { + DenseMap &InstrIdxForVirtReg) const { MachineFunction *MF = Root.getMF(); MachineRegisterInfo &MRI = MF->getRegInfo(); const TargetRegisterInfo *TRI = &getRegisterInfo(); diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.h b/llvm/lib/Target/PowerPC/PPCInstrInfo.h index d4554379cdb1d..83bc39e0c06bd 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.h +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.h @@ -241,7 +241,7 @@ class PPCInstrInfo : public PPCGenInstrInfo { void reassociateFMA(MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const; + DenseMap &InstrIdxForVirtReg) const; Register generateLoadForNewConst(unsigned Idx, MachineInstr *MI, Type *Ty, SmallVectorImpl &InsInstrs) const; @@ -370,7 +370,7 @@ class PPCInstrInfo : public PPCGenInstrInfo { MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const override; + DenseMap &InstrIdxForVirtReg) const override; /// Return true when there is potentially a faster code sequence for a fma /// chain ending in \p Root. All potential patterns are output in the \p diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 2fdf6bd36e88f..c197f06855b6e 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -2376,7 +2376,7 @@ static void genShXAddAddShift(MachineInstr &Root, unsigned AddOpIdx, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) { + DenseMap &InstrIdxForVirtReg) { MachineFunction *MF = Root.getMF(); MachineRegisterInfo &MRI = MF->getRegInfo(); const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo(); @@ -2435,7 +2435,7 @@ void RISCVInstrInfo::genAlternativeCodeSequence( MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const { + DenseMap &InstrIdxForVirtReg) const { MachineRegisterInfo &MRI = Root.getMF()->getRegInfo(); switch (Pattern) { default: diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.h b/llvm/lib/Target/RISCV/RISCVInstrInfo.h index 656cb38e11297..d68bd58885873 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.h +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.h @@ -274,7 +274,7 @@ class RISCVInstrInfo : public RISCVGenInstrInfo { MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const override; + DenseMap &InstrIdxForVirtReg) const override; bool hasReassociableOperands(const MachineInstr &Inst, const MachineBasicBlock *MBB) const override; diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 99a0259119d42..b13412df4b8b0 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -10857,7 +10857,7 @@ static void genAlternativeDpCodeSequence(MachineInstr &Root, const TargetInstrInfo &TII, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) { + DenseMap &InstrIdxForVirtReg) { MachineFunction *MF = Root.getMF(); MachineRegisterInfo &RegInfo = MF->getRegInfo(); @@ -10947,7 +10947,7 @@ void X86InstrInfo::genAlternativeCodeSequence( MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const { + DenseMap &InstrIdxForVirtReg) const { switch (Pattern) { default: // Reassociate instructions. diff --git a/llvm/lib/Target/X86/X86InstrInfo.h b/llvm/lib/Target/X86/X86InstrInfo.h index f383eaddfd0b4..ee86da71d81a4 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.h +++ b/llvm/lib/Target/X86/X86InstrInfo.h @@ -641,7 +641,7 @@ class X86InstrInfo final : public X86GenInstrInfo { MachineInstr &Root, unsigned Pattern, SmallVectorImpl &InsInstrs, SmallVectorImpl &DelInstrs, - DenseMap &InstrIdxForVirtReg) const override; + DenseMap &InstrIdxForVirtReg) const override; /// When calculate the latency of the root instruction, accumulate the /// latency of the sequence to the root latency.