From 27670548239fe53bf364766fe5754f2b33bd518e Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Sun, 1 Feb 2015 21:20:58 +0000 Subject: [PATCH] [PowerPC] Remove the PPCVSXCopyCleanup pass This MI-level pass was necessary when VSX support was first being developed, specifically, before the ABI code had been updated to use VSX registers for arguments (the register assignments did not change, in a physical sense, but the VSX super-registers are now used). Unfortunately, I never went back and removed this pass after that was done. I believe this code is now effectively dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227767 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPC.h | 1 - lib/Target/PowerPC/PPCInstrInfo.cpp | 76 ------------------------- lib/Target/PowerPC/PPCTargetMachine.cpp | 2 - 3 files changed, 79 deletions(-) diff --git a/lib/Target/PowerPC/PPC.h b/lib/Target/PowerPC/PPC.h index 7912464d1ac..2102afd4efb 100644 --- a/lib/Target/PowerPC/PPC.h +++ b/lib/Target/PowerPC/PPC.h @@ -36,7 +36,6 @@ namespace llvm { #endif FunctionPass *createPPCEarlyReturnPass(); FunctionPass *createPPCVSXCopyPass(); - FunctionPass *createPPCVSXCopyCleanupPass(); FunctionPass *createPPCVSXFMAMutatePass(); FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index c1cfc2567c4..b844f63c86f 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -2035,82 +2035,6 @@ char PPCVSXCopy::ID = 0; FunctionPass* llvm::createPPCVSXCopyPass() { return new PPCVSXCopy(); } -#undef DEBUG_TYPE -#define DEBUG_TYPE "ppc-vsx-copy-cleanup" - -namespace llvm { - void initializePPCVSXCopyCleanupPass(PassRegistry&); -} - -namespace { - // PPCVSXCopyCleanup pass - We sometimes end up generating self copies of VSX - // registers (mostly because the ABI code still places all values into the - // "traditional" floating-point and vector registers). Remove them here. - struct PPCVSXCopyCleanup : public MachineFunctionPass { - static char ID; - PPCVSXCopyCleanup() : MachineFunctionPass(ID) { - initializePPCVSXCopyCleanupPass(*PassRegistry::getPassRegistry()); - } - - const TargetInstrInfo *TII; - -protected: - bool processBlock(MachineBasicBlock &MBB) { - bool Changed = false; - - SmallVector ToDelete; - for (MachineBasicBlock::iterator I = MBB.begin(), IE = MBB.end(); - I != IE; ++I) { - MachineInstr *MI = I; - if (MI->getOpcode() == PPC::XXLOR && - MI->getOperand(0).getReg() == MI->getOperand(1).getReg() && - MI->getOperand(0).getReg() == MI->getOperand(2).getReg()) - ToDelete.push_back(MI); - } - - if (!ToDelete.empty()) - Changed = true; - - for (unsigned i = 0, ie = ToDelete.size(); i != ie; ++i) { - DEBUG(dbgs() << "Removing VSX self-copy: " << *ToDelete[i]); - ToDelete[i]->eraseFromParent(); - } - - return Changed; - } - -public: - bool runOnMachineFunction(MachineFunction &MF) override { - // If we don't have VSX don't bother doing anything here. - const PPCSubtarget &STI = MF.getSubtarget(); - if (!STI.hasVSX()) - return false; - TII = STI.getInstrInfo(); - - bool Changed = false; - - for (MachineFunction::iterator I = MF.begin(); I != MF.end();) { - MachineBasicBlock &B = *I++; - if (processBlock(B)) - Changed = true; - } - - return Changed; - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - MachineFunctionPass::getAnalysisUsage(AU); - } - }; -} - -INITIALIZE_PASS(PPCVSXCopyCleanup, DEBUG_TYPE, - "PowerPC VSX Copy Cleanup", false, false) - -char PPCVSXCopyCleanup::ID = 0; -FunctionPass* -llvm::createPPCVSXCopyCleanupPass() { return new PPCVSXCopyCleanup(); } - #undef DEBUG_TYPE #define DEBUG_TYPE "ppc-early-ret" STATISTIC(NumBCLR, "Number of early conditional returns"); diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 08ecc6fb9b5..0a3f6e59646 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -262,8 +262,6 @@ void PPCPassConfig::addPreRegAlloc() { } void PPCPassConfig::addPreSched2() { - addPass(createPPCVSXCopyCleanupPass(), false); - if (getOptLevel() != CodeGenOpt::None) addPass(&IfConverterID); } -- 2.34.1