From 0a7413dad84887bee51f20d7a5f1c4c1c7bb4c1e Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 16 Jun 2008 13:13:08 +0000 Subject: [PATCH] Pass around Instruction* instead of Instruction& in FindInsertedValue and friends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52318 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/ValueTracking.h | 2 +- lib/Analysis/ValueTracking.cpp | 10 +++++----- lib/Transforms/Scalar/InstructionCombining.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index df59c703a57..1dc1468209f 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -58,7 +58,7 @@ namespace llvm { Value *FindInsertedValue(Value *V, const unsigned *idx_begin, const unsigned *idx_end, - Instruction &InsertBefore); + Instruction *InsertBefore); } // end namespace llvm #endif diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index a3eb82d62b8..64cdc246b91 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -764,7 +764,7 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) { Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType, SmallVector &Idxs, unsigned IdxSkip, - Instruction &InsertBefore) { + Instruction *InsertBefore) { const llvm::StructType *STy = llvm::dyn_cast(IndexedType); if (STy) { // General case, the type indexed by Idxs is a struct @@ -782,11 +782,11 @@ Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType, // 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 @@ Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType, // // 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 @@ Value *BuildSubAggregate(Value *From, const unsigned *idx_begin, /// 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) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 42cfd8a8f2b..0878008d719 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -10521,7 +10521,7 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) { 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