From ffd0b31c7cbaa8322d2963afe6ace4e3a0889ddb Mon Sep 17 00:00:00 2001 From: David Green Date: Tue, 1 Sep 2020 07:39:54 +0100 Subject: [PATCH] Revert "[ARM] Register pressure with -mthumb forces register reload before each call" Expensive checks are failing, complaining about additional MMO operands added to the branch. --- llvm/lib/Target/ARM/Thumb1InstrInfo.cpp | 34 --------------------- llvm/lib/Target/ARM/Thumb1InstrInfo.h | 7 ----- llvm/test/CodeGen/ARM/minsize-call-cse-2.ll | 20 ------------ llvm/test/CodeGen/ARM/minsize-call-cse-3.ll | 16 ---------- 4 files changed, 77 deletions(-) delete mode 100644 llvm/test/CodeGen/ARM/minsize-call-cse-2.ll delete mode 100644 llvm/test/CodeGen/ARM/minsize-call-cse-3.ll diff --git a/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp index 7eec05df88ca..79afa378cb62 100644 --- a/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp +++ b/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp @@ -152,37 +152,3 @@ bool Thumb1InstrInfo::canCopyGluedNodeDuringSchedule(SDNode *N) const { return false; } - -MachineInstr *Thumb1InstrInfo::foldMemoryOperandImpl( - MachineFunction &MF, MachineInstr &MI, ArrayRef Ops, - MachineBasicBlock::iterator InsertPt, MachineInstr &LoadMI, - LiveIntervals *LIS) const { - // Replace: - // ldr Rd, func address - // blx Rd - // with: - // bl func - - if (MI.getOpcode() == ARM::tBLXr && LoadMI.getOpcode() == ARM::tLDRpci && - MI.getParent() == LoadMI.getParent()) { - unsigned CPI = LoadMI.getOperand(1).getIndex(); - const MachineConstantPool *MCP = MF.getConstantPool(); - if (CPI >= MCP->getConstants().size()) - return nullptr; - const MachineConstantPoolEntry &CPE = MCP->getConstants()[CPI]; - assert(!CPE.isMachineConstantPoolEntry() && "Invalid constpool entry"); - const Function *Callee = dyn_cast(CPE.Val.ConstVal); - if (!Callee) - return nullptr; - const char *FuncName = MF.createExternalSymbolName(Callee->getName()); - MachineInstrBuilder MIB = - BuildMI(*MI.getParent(), InsertPt, MI.getDebugLoc(), get(ARM::tBL)) - .add(predOps(ARMCC::AL)) - .addExternalSymbol(FuncName); - for (auto &MO : MI.implicit_operands()) - MIB.add(MO); - return MIB.getInstr(); - } - - return nullptr; -} diff --git a/llvm/lib/Target/ARM/Thumb1InstrInfo.h b/llvm/lib/Target/ARM/Thumb1InstrInfo.h index bc4da451ca5d..017b7222337c 100644 --- a/llvm/lib/Target/ARM/Thumb1InstrInfo.h +++ b/llvm/lib/Target/ARM/Thumb1InstrInfo.h @@ -53,13 +53,6 @@ public: const TargetRegisterInfo *TRI) const override; bool canCopyGluedNodeDuringSchedule(SDNode *N) const override; - -protected: - virtual MachineInstr *foldMemoryOperandImpl( - MachineFunction &MF, MachineInstr &MI, ArrayRef Ops, - MachineBasicBlock::iterator InsertPt, MachineInstr &LoadMI, - LiveIntervals *LIS = nullptr) const override; - private: void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override; }; diff --git a/llvm/test/CodeGen/ARM/minsize-call-cse-2.ll b/llvm/test/CodeGen/ARM/minsize-call-cse-2.ll deleted file mode 100644 index 4f9e508c1c97..000000000000 --- a/llvm/test/CodeGen/ARM/minsize-call-cse-2.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: llc < %s | FileCheck %s - -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "thumbv6m-arm-none-eabi" - -; CHECK-LABEL: f: -; CHECK: bl g -; CHECK: blx r -; CHECK: bl g -; CHECK: bl g -define void @f(i32* %p, i32 %x, i32 %y, i32 %z) minsize optsize { -entry: - call void @g(i32* %p, i32 %x, i32 %y, i32 %z) - call void @g(i32* %p, i32 %x, i32 %y, i32 %z) - call void @g(i32* %p, i32 %x, i32 %y, i32 %z) - call void @g(i32* %p, i32 %x, i32 %y, i32 %z) - ret void -} - -declare void @g(i32*,i32,i32,i32) diff --git a/llvm/test/CodeGen/ARM/minsize-call-cse-3.ll b/llvm/test/CodeGen/ARM/minsize-call-cse-3.ll deleted file mode 100644 index abe1f0347e5d..000000000000 --- a/llvm/test/CodeGen/ARM/minsize-call-cse-3.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llc < %s -; Verify that we don't crash on indirect function calls -; in Thumb1InstrInfo::foldMemoryOperand. - -target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" -target triple = "thumbv6m-arm-none-eabi" - -; Function Attrs: minsize nounwind optsize -define void @test(i32* %p, i32 %x, i32 %y, i32 %z) { -entry: - tail call void inttoptr (i32 19088743 to void (i32*, i32, i32, i32)*)(i32* %p, i32 %x, i32 %y, i32 %z) - tail call void inttoptr (i32 19088743 to void (i32*, i32, i32, i32)*)(i32* %p, i32 %x, i32 %y, i32 %z) - tail call void inttoptr (i32 19088743 to void (i32*, i32, i32, i32)*)(i32* %p, i32 %x, i32 %y, i32 %z) - tail call void inttoptr (i32 19088743 to void (i32*, i32, i32, i32)*)(i32* %p, i32 %x, i32 %y, i32 %z) - ret void -}