summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorZaara Syeda <syzaara@ca.ibm.com>2018-03-19 16:19:44 +0000
committerZaara Syeda <syzaara@ca.ibm.com>2018-03-19 16:19:44 +0000
commit01f414baaade28c7e5e0f79a04e18e7fc6cc79f2 (patch)
tree4857f4a803ffeacc775d583d9429aeaab7cb7968 /llvm/lib/CodeGen
parent826e833121d0f84a4ddf5f089e61bb8d3d79ef0e (diff)
downloadbcm5719-llvm-01f414baaade28c7e5e0f79a04e18e7fc6cc79f2.tar.gz
bcm5719-llvm-01f414baaade28c7e5e0f79a04e18e7fc6cc79f2.zip
Revert [MachineLICM] This reverts commit rL327856
Failing build bots. Revert the commit now. llvm-svn: 327864
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineLICM.cpp81
-rw-r--r--llvm/lib/CodeGen/TargetRegisterInfo.cpp23
2 files changed, 1 insertions, 103 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 2b73d492615..2c1b4f09a32 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -71,10 +71,6 @@ SinkInstsToAvoidSpills("sink-insts-to-avoid-spills",
cl::desc("MachineLICM should sink instructions into "
"loops to avoid register spills"),
cl::init(false), cl::Hidden);
-static cl::opt<bool>
-HoistConstStores("hoist-const-stores",
- cl::desc("Hoist invariant stores"),
- cl::init(true), cl::Hidden);
STATISTIC(NumHoisted,
"Number of machine instructions hoisted out of loops");
@@ -86,8 +82,6 @@ STATISTIC(NumCSEed,
"Number of hoisted machine instructions CSEed");
STATISTIC(NumPostRAHoisted,
"Number of machine instructions hoisted out of loops post regalloc");
-STATISTIC(NumStoreConst,
- "Number of stores of const phys reg hoisted out of loops");
namespace {
@@ -732,10 +726,6 @@ void MachineLICMBase::HoistOutOfLoop(MachineDomTreeNode *HeaderN) {
MachineInstr *MI = &*MII;
if (!Hoist(MI, Preheader))
UpdateRegPressure(MI);
- // If we have hoisted an instruction that may store, it can only be a
- // constant store.
- else if (MI->mayStore())
- NumStoreConst++;
MII = NextMII;
}
@@ -899,79 +889,13 @@ static bool mayLoadFromGOTOrConstantPool(MachineInstr &MI) {
return false;
}
-// This function iterates through all the operands of the input store MI and
-// checks that each register operand statisfies isCallerPreservedPhysReg.
-// This means, the value being stored and the address where it is being stored
-// is constant throughout the body of the function (not including prologue and
-// epilogue). When called with an MI that isn't a store, it returns false.
-static bool isInvariantStore(const MachineInstr &MI,
- const TargetRegisterInfo *TRI,
- const MachineRegisterInfo *MRI) {
-
- if (!MI.mayStore() || MI.hasUnmodeledSideEffects() ||
- (MI.getNumOperands() == 0))
- return false;
-
- // Check that all register operands are caller-preserved physical registers.
- for (const MachineOperand &MO : MI.operands()) {
- if (MO.isReg()) {
- unsigned Reg = MO.getReg();
- // If operand is a virtual register, check if it comes from a copy of a
- // physical register.
- if (TargetRegisterInfo::isVirtualRegister(Reg))
- Reg = TRI->lookThruCopyLike(MO.getReg(), MRI);
- if (TargetRegisterInfo::isVirtualRegister(Reg))
- return false;
- if (!TRI->isCallerPreservedPhysReg(Reg, *MI.getMF()))
- return false;
- }
- }
- return true;
-}
-
-// Return true if the input MI is a copy instruction that feeds an invariant
-// store instruction. This means that the src of the copy has to satisfy
-// isCallerPreservedPhysReg and atleast one of it's users should satisfy
-// isInvariantStore.
-static bool isCopyFeedingInvariantStore(const MachineInstr &MI,
- const MachineRegisterInfo *MRI,
- const TargetRegisterInfo *TRI) {
-
- // FIXME: If targets would like to look through instructions that aren't
- // pure copies, this can be updated to a query.
- if (!MI.isCopy())
- return false;
-
- const MachineFunction *MF = MI.getMF();
- // Check that we are copying a constant physical register.
- unsigned CopySrcReg = MI.getOperand(1).getReg();
- if (TargetRegisterInfo::isVirtualRegister(CopySrcReg))
- return false;
-
- if (!TRI->isCallerPreservedPhysReg(CopySrcReg, *MF))
- return false;
-
- unsigned CopyDstReg = MI.getOperand(0).getReg();
- // Check if any of the uses of the copy are invariant stores.
- assert (TargetRegisterInfo::isVirtualRegister(CopyDstReg) &&
- "copy dst is not a virtual reg");
-
- for (MachineInstr &UseMI : MRI->use_instructions(CopyDstReg)) {
- if (UseMI.mayStore() && isInvariantStore(UseMI, TRI, MRI))
- return true;
- }
- return false;
-}
-
/// Returns true if the instruction may be a suitable candidate for LICM.
/// e.g. If the instruction is a call, then it's obviously not safe to hoist it.
bool MachineLICMBase::IsLICMCandidate(MachineInstr &I) {
// Check if it's safe to move the instruction.
bool DontMoveAcrossStore = true;
- if ((!I.isSafeToMove(AA, DontMoveAcrossStore)) &&
- !(HoistConstStores && isInvariantStore(I, TRI, MRI))) {
+ if (!I.isSafeToMove(AA, DontMoveAcrossStore))
return false;
- }
// If it is load then check if it is guaranteed to execute by making sure that
// it dominates all exiting blocks. If it doesn't, then there is a path out of
@@ -1191,9 +1115,6 @@ bool MachineLICMBase::IsProfitableToHoist(MachineInstr &MI) {
// - When hoisting the last use of a value in the loop, that value no longer
// needs to be live in the loop. This lowers register pressure in the loop.
- if (HoistConstStores && isCopyFeedingInvariantStore(MI, MRI, TRI))
- return true;
-
bool CheapInstr = IsCheapInstruction(MI);
bool CreatesCopy = HasLoopPHIUse(&MI);
diff --git a/llvm/lib/CodeGen/TargetRegisterInfo.cpp b/llvm/lib/CodeGen/TargetRegisterInfo.cpp
index 8b5cd3e73ac..5db1c58d349 100644
--- a/llvm/lib/CodeGen/TargetRegisterInfo.cpp
+++ b/llvm/lib/CodeGen/TargetRegisterInfo.cpp
@@ -472,29 +472,6 @@ unsigned TargetRegisterInfo::getRegSizeInBits(unsigned Reg,
return getRegSizeInBits(*RC);
}
-unsigned
-TargetRegisterInfo::lookThruCopyLike(unsigned SrcReg,
- const MachineRegisterInfo *MRI) const {
- while (true) {
- const MachineInstr *MI = MRI->getVRegDef(SrcReg);
- if (!MI->isCopyLike())
- return SrcReg;
-
- unsigned CopySrcReg;
- if (MI->isCopy())
- CopySrcReg = MI->getOperand(1).getReg();
- else {
- assert(MI->isSubregToReg() && "Bad opcode for lookThruCopyLike");
- CopySrcReg = MI->getOperand(2).getReg();
- }
-
- if (!isVirtualRegister(CopySrcReg))
- return CopySrcReg;
-
- SrcReg = CopySrcReg;
- }
-}
-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD
void TargetRegisterInfo::dumpReg(unsigned Reg, unsigned SubRegIndex,
OpenPOWER on IntegriCloud