diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-09-02 21:17:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-08 17:34:50 +0000 |
commit | 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch) | |
tree | 62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp | |
parent | cf037972ea8863e2bab7461d77345367d2c1e054 (diff) | |
parent | 7fa27ce4a07f19b07799a767fc29416f3b625afb (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp index cd8644029530..f879c5fcf20c 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineCSE.cpp @@ -68,12 +68,12 @@ static cl::opt<int> namespace { class MachineCSE : public MachineFunctionPass { - const TargetInstrInfo *TII; - const TargetRegisterInfo *TRI; - AliasAnalysis *AA; - MachineDominatorTree *DT; - MachineRegisterInfo *MRI; - MachineBlockFrequencyInfo *MBFI; + const TargetInstrInfo *TII = nullptr; + const TargetRegisterInfo *TRI = nullptr; + AliasAnalysis *AA = nullptr; + MachineDominatorTree *DT = nullptr; + MachineRegisterInfo *MRI = nullptr; + MachineBlockFrequencyInfo *MBFI = nullptr; public: static char ID; // Pass identification @@ -175,9 +175,7 @@ INITIALIZE_PASS_END(MachineCSE, DEBUG_TYPE, bool MachineCSE::PerformTrivialCopyPropagation(MachineInstr *MI, MachineBasicBlock *MBB) { bool Changed = false; - for (MachineOperand &MO : MI->operands()) { - if (!MO.isReg() || !MO.isUse()) - continue; + for (MachineOperand &MO : MI->all_uses()) { Register Reg = MO.getReg(); if (!Reg.isVirtual()) continue; @@ -291,9 +289,7 @@ bool MachineCSE::hasLivePhysRegDefUses(const MachineInstr *MI, PhysDefVector &PhysDefs, bool &PhysUseDef) const { // First, add all uses to PhysRefs. - for (const MachineOperand &MO : MI->operands()) { - if (!MO.isReg() || MO.isDef()) - continue; + for (const MachineOperand &MO : MI->all_uses()) { Register Reg = MO.getReg(); if (!Reg) continue; @@ -483,8 +479,8 @@ bool MachineCSE::isProfitableToCSE(Register CSReg, Register Reg, // Heuristics #2: If the expression doesn't not use a vr and the only use // of the redundant computation are copies, do not cse. bool HasVRegUse = false; - for (const MachineOperand &MO : MI->operands()) { - if (MO.isReg() && MO.isUse() && MO.getReg().isVirtual()) { + for (const MachineOperand &MO : MI->all_uses()) { + if (MO.getReg().isVirtual()) { HasVRegUse = true; break; } |