diff options
| author | Devang Patel <dpatel@apple.com> | 2011-10-20 17:42:23 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2011-10-20 17:42:23 +0000 |
| commit | 1d8ab465bf46f842b9d64b019215fe213b170a6d (patch) | |
| tree | 87c7102b896815b6686ef29b7bb26bc31422b2d6 /llvm/lib/CodeGen | |
| parent | 830c776a94eb18273c1bd6cf03fb997dd91e5c3e (diff) | |
| download | bcm5719-llvm-1d8ab465bf46f842b9d64b019215fe213b170a6d.tar.gz bcm5719-llvm-1d8ab465bf46f842b9d64b019215fe213b170a6d.zip | |
As Evan suggested, loads from constant pool are safe to speculate.
llvm-svn: 142593
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/MachineLICM.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp index c693386f9bb..964e9712079 100644 --- a/llvm/lib/CodeGen/MachineLICM.cpp +++ b/llvm/lib/CodeGen/MachineLICM.cpp @@ -762,15 +762,15 @@ void MachineLICM::UpdateRegPressure(const MachineInstr *MI) { } } -/// isLoadFromGOT - Return true if this machine instruction loads from -/// global offset table. -static bool isLoadFromGOT(MachineInstr &MI) { +/// isLoadFromGOTOrConstantPool - Return true if this machine instruction +/// loads from global offset table or constant pool. +static bool isLoadFromGOTOrConstantPool(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()) + if (PSV == PSV->getGOT() || PSV == PSV->getConstantPool()) return true; } } @@ -792,7 +792,7 @@ bool MachineLICM::IsLICMCandidate(MachineInstr &I) { // from constant memory are not safe to speculate all the time, for example // indexed load from a jump table. // Stores and side effects are already checked by isSafeToMove. - if (I.getDesc().mayLoad() && !isLoadFromGOT(I) && + if (I.getDesc().mayLoad() && !isLoadFromGOTOrConstantPool(I) && !IsGuaranteedToExecute(I.getParent())) return false; |

