[llvm-commits] [llvm] r52318 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h lib/Analysis/ValueTracking.cpp lib/Transforms/Scalar/InstructionCombining.cpp

Matthijs Kooijman matthijs at stdin.nl
Mon Jun 16 06:13:08 PDT 2008


Author: matthijs
Date: Mon Jun 16 08:13:08 2008
New Revision: 52318

URL: http://llvm.org/viewvc/llvm-project?rev=52318&view=rev
Log:
Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.

Modified:
    llvm/trunk/include/llvm/Analysis/ValueTracking.h
    llvm/trunk/lib/Analysis/ValueTracking.cpp
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=52318&r1=52317&r2=52318&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original)
+++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Mon Jun 16 08:13:08 2008
@@ -58,7 +58,7 @@
   Value *FindInsertedValue(Value *V,
                          const unsigned *idx_begin,
                          const unsigned *idx_end,
-                         Instruction &InsertBefore);
+                         Instruction *InsertBefore);
 } // end namespace llvm
 
 #endif

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52318&r1=52317&r2=52318&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Jun 16 08:13:08 2008
@@ -764,7 +764,7 @@
 Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,
                                  SmallVector<unsigned, 10> &Idxs,
                                  unsigned IdxSkip,
-                                 Instruction &InsertBefore) {
+                                 Instruction *InsertBefore) {
   const llvm::StructType *STy = llvm::dyn_cast<llvm::StructType>(IndexedType);
   if (STy) {
     // General case, the type indexed by Idxs is a struct
@@ -782,11 +782,11 @@
     // IdxSkip indices when indexing the sub struct).
     Instruction *V = llvm::ExtractValueInst::Create(From, Idxs.begin(),
                                                     Idxs.end(), "tmp",
-                                                    &InsertBefore);
+                                                    InsertBefore);
     Instruction *Ins = llvm::InsertValueInst::Create(To, V,
                                                      Idxs.begin() + IdxSkip,
                                                      Idxs.end(), "tmp",
-                                                     &InsertBefore);
+                                                     InsertBefore);
     return Ins;
   }
 }
@@ -804,7 +804,7 @@
 //
 // Any inserted instructions are inserted before InsertBefore
 Value *BuildSubAggregate(Value *From, const unsigned *idx_begin,
-                         const unsigned *idx_end, Instruction &InsertBefore) {
+                         const unsigned *idx_end, Instruction *InsertBefore) {
   const Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(),
                                                              idx_begin,
                                                              idx_end);
@@ -819,7 +819,7 @@
 /// the scalar value indexed is already around as a register, for example if it
 /// were inserted directly into the aggregrate.
 Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,
-                         const unsigned *idx_end, Instruction &InsertBefore) {
+                         const unsigned *idx_end, Instruction *InsertBefore) {
   // Nothing to index? Just return V then (this is useful at the end of our
   // recursion)
   if (idx_begin == idx_end)

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=52318&r1=52317&r2=52318&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jun 16 08:13:08 2008
@@ -10521,7 +10521,7 @@
 Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
   // See if we are trying to extract a known value. If so, use that instead.
   if (Value *Elt = FindInsertedValue(EV.getOperand(0), EV.idx_begin(),
-                                     EV.idx_end(), EV))
+                                     EV.idx_end(), &EV))
     return ReplaceInstUsesWith(EV, Elt);
 
   // No changes





More information about the llvm-commits mailing list