[llvm-commits] [llvm] r142593 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp

Devang Patel dpatel at apple.com
Thu Oct 20 10:42:23 PDT 2011


Author: dpatel
Date: Thu Oct 20 12:42:23 2011
New Revision: 142593

URL: http://llvm.org/viewvc/llvm-project?rev=142593&view=rev
Log:
As Evan suggested, loads from constant pool are safe to speculate.

Modified:
    llvm/trunk/lib/CodeGen/MachineLICM.cpp

Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=142593&r1=142592&r2=142593&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Thu Oct 20 12:42:23 2011
@@ -762,15 +762,15 @@
   }
 }
 
-/// 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 @@
   // 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;
 





More information about the llvm-commits mailing list