Skip to content

Commit

Permalink
IR: Declare LookupKey right before its use, NFC
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215956 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dexonsmith committed Aug 19, 2014
1 parent fd0a813 commit 79f9f85
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/IR/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2660,8 +2660,6 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
LLVMContextImpl *pImpl = getType()->getContext().pImpl;

SmallVector<Constant*, 8> Values;
LLVMContextImpl::ArrayConstantsTy::LookupKey Lookup;
Lookup.first = cast<ArrayType>(getType());
Values.reserve(getNumOperands()); // Build replacement array.

// Fill values with the modified operands of the constant array. Also,
Expand All @@ -2687,7 +2685,8 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
Replacement = UndefValue::get(getType());
} else {
// Check to see if we have this array type already.
Lookup.second = makeArrayRef(Values);
LLVMContextImpl::ArrayConstantsTy::LookupKey Lookup(
cast<ArrayType>(getType()), makeArrayRef(Values));
LLVMContextImpl::ArrayConstantsTy::MapTy::iterator I =
pImpl->ArrayConstants.find(Lookup);

Expand Down Expand Up @@ -2736,8 +2735,6 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
assert(getOperand(OperandToUpdate) == From && "ReplaceAllUsesWith broken!");

SmallVector<Constant*, 8> Values;
LLVMContextImpl::StructConstantsTy::LookupKey Lookup;
Lookup.first = cast<StructType>(getType());
Values.reserve(getNumOperands()); // Build replacement struct.

// Fill values with the modified operands of the constant struct. Also,
Expand Down Expand Up @@ -2773,7 +2770,8 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
Replacement = UndefValue::get(getType());
} else {
// Check to see if we have this struct type already.
Lookup.second = makeArrayRef(Values);
LLVMContextImpl::StructConstantsTy::LookupKey Lookup(
cast<StructType>(getType()), makeArrayRef(Values));
LLVMContextImpl::StructConstantsTy::MapTy::iterator I =
pImpl->StructConstants.find(Lookup);

Expand Down

0 comments on commit 79f9f85

Please sign in to comment.