|
19 | 19 | #include "llvm/CodeGen/LiveIntervals.h" |
20 | 20 |
|
21 | 21 | using namespace llvm; |
22 | | -extern cl::opt<bool> EnableCoalescingForWideCopy; |
23 | 22 |
|
24 | 23 | bool AIEBaseRegisterInfo::shouldCoalesce( |
25 | 24 | MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, |
26 | 25 | const TargetRegisterClass *DstRC, unsigned DstSubReg, |
27 | 26 | const TargetRegisterClass *NewRC, LiveIntervals &LIS) const { |
28 | | - MachineBasicBlock *MBB = MI->getParent(); |
29 | | - if (EnableCoalescingForWideCopy || AIELoopUtils::isSingleMBBLoop(MBB)) { |
30 | | - return TargetRegisterInfo::shouldCoalesce(MI, SrcRC, SubReg, DstRC, |
31 | | - DstSubReg, NewRC, LIS); |
32 | | - } |
33 | | - const unsigned SrcSize = getRegSizeInBits(*SrcRC); |
34 | | - const unsigned DstSize = getRegSizeInBits(*DstRC); |
35 | | - MachineFunction *MF = MI->getMF(); |
36 | | - const AIEBaseInstrInfo *TII = |
37 | | - static_cast<const AIEBaseInstrInfo *>(MF->getSubtarget().getInstrInfo()); |
38 | | - const unsigned BasicVectorSize = TII->getBasicVecRegSize(); |
39 | | - // Should not coalesce if copying from bigger source. |
40 | | - if (SrcSize < DstSize && |
41 | | - (SrcSize >= BasicVectorSize || DstSize >= BasicVectorSize)) { |
42 | | - LiveInterval &LI = LIS.getInterval(MI->getOperand(1).getReg()); |
43 | | - const MachineInstr *FirstMI = |
44 | | - LI.empty() ? nullptr : LIS.getInstructionFromIndex(LI.beginIndex()); |
45 | | - const MachineInstr *LastMI = |
46 | | - LI.empty() ? nullptr : LIS.getInstructionFromIndex(LI.endIndex()); |
47 | | - // Coalescing inside the same basic block found beneficial. So, check that |
48 | | - // the LiveInterval is not just local to MBB. |
49 | | - if (!FirstMI || FirstMI->getParent() != MBB || !LastMI || |
50 | | - LastMI->getParent() != MBB) |
51 | | - return false; |
52 | | - } |
53 | | - |
54 | 27 | return TargetRegisterInfo::shouldCoalesce(MI, SrcRC, SubReg, DstRC, DstSubReg, |
55 | 28 | NewRC, LIS); |
56 | 29 | } |
0 commit comments