~ubuntu-branches/ubuntu/precise/llvm-2.8/precise

« back to all changes in this revision

Viewing changes to lib/Transforms/Scalar/LICM.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-09-21 14:03:34 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100921140334-i4xxl0a768fcqffl
Tags: 2.8~20100921-0ubuntu1
New upstream snapshot, taken from the 2.8 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
852
852
    ReplacedLoads[ALoad] = NewVal;
853
853
  }
854
854
  
 
855
  // If the preheader load is itself a pointer, we need to tell alias analysis
 
856
  // about the new pointer we created in the preheader block and about any PHI
 
857
  // nodes that just got inserted.
 
858
  if (PreheaderLoad->getType()->isPointerTy()) {
 
859
    // Copy any value stored to or loaded from a must-alias of the pointer.
 
860
    CurAST->copyValue(SomeValue, PreheaderLoad);
 
861
    
 
862
    for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
 
863
      CurAST->copyValue(SomeValue, NewPHIs[i]);
 
864
  }
 
865
  
855
866
  // Now that everything is rewritten, delete the old instructions from the body
856
867
  // of the loop.  They should all be dead now.
857
868
  for (unsigned i = 0, e = LoopUses.size(); i != e; ++i) {
882
893
    User->eraseFromParent();
883
894
  }
884
895
  
885
 
  // If the preheader load is itself a pointer, we need to tell alias analysis
886
 
  // about the new pointer we created in the preheader block and about any PHI
887
 
  // nodes that just got inserted.
888
 
  if (PreheaderLoad->getType()->isPointerTy()) {
889
 
    // Copy any value stored to or loaded from a must-alias of the pointer.
890
 
    CurAST->copyValue(SomeValue, PreheaderLoad);
891
 
 
892
 
    for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
893
 
      CurAST->copyValue(SomeValue, NewPHIs[i]);
894
 
  }
895
 
  
896
896
  // fwew, we're done!
897
897
}
898
898