summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-10-17 17:35:01 +0000
committerDevang Patel <dpatel@apple.com>2011-10-17 17:35:01 +0000
commit69a4565e65d632471173a6a7c734e3855b008a5e (patch)
tree46d482a45f19de1e1feb45534614405417920bb0 /llvm/lib/CodeGen
parentd4bde54da5a2c4054a88bce72a96aa357aa3eacb (diff)
downloadbcm5719-llvm-69a4565e65d632471173a6a7c734e3855b008a5e.tar.gz
bcm5719-llvm-69a4565e65d632471173a6a7c734e3855b008a5e.zip
It is safe to speculate load from GOT. This fixes performance regression caused by r141689.
Radar 10281206. llvm-svn: 142202
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineLICM.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index a1f80d5282e..8f7a8ebb264 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -762,6 +762,21 @@ void MachineLICM::UpdateRegPressure(const MachineInstr *MI) {
}
}
+/// isLoadFromGOT - Return true if this machine instruction loads from
+/// global offset table.
+static bool isLoadFromGOT(MachineInstr &MI) {
+ assert (MI.getDesc().mayLoad() && "Expected MI that loads!");
+ for (MachineInstr::mmo_iterator I = MI.memoperands_begin(),
+ E = MI.memoperands_end(); I != E; ++I) {
+ if (const Value *V = (*I)->getValue()) {
+ if (const PseudoSourceValue *PSV = dyn_cast<PseudoSourceValue>(V))
+ if (PSV == PSV->getGOT())
+ return true;
+ }
+ }
+ return false;
+}
+
/// IsLICMCandidate - 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.
@@ -775,7 +790,8 @@ bool MachineLICM::IsLICMCandidate(MachineInstr &I) {
// it dominates all exiting blocks. If it doesn't, then there is a path out of
// the loop which does not execute this load, so we can't hoist it.
// Stores and side effects are already checked by isSafeToMove.
- if (I.getDesc().mayLoad() && !IsGuaranteedToExecute(I.getParent()))
+ if (I.getDesc().mayLoad() && !isLoadFromGOT(I) &&
+ !IsGuaranteedToExecute(I.getParent()))
return false;
return true;
OpenPOWER on IntegriCloud