Op<0>() = Agg;
}
- /// Indicies - These identify which value to extract.
+ /// Indices - These identify which value to extract.
const SmallVector<unsigned, 4> Indices;
/// Transparently provide more efficient getOperand methods.
Op<1>() = Val;
}
- /// Indicies - These identify the position for the insertion.
+ /// Indices - These identify the position for the insertion.
const SmallVector<unsigned, 4> Indices;
/// Transparently provide more efficient getOperand methods.
"insertvalue indices invalid!");
assert(Agg->getType() == ReqTy &&
"insertvalue type invalid!");
-
assert(Agg->getType()->isFirstClassType() &&
"Non-first-class type for constant InsertValue expression");
+ if (Constant *FC = ConstantFoldInsertValueInstruction(Agg, Val, Idxs, NumIdx))
+ return FC; // Fold a few common cases...
// Look up the constant in the table first to ensure uniqueness
std::vector<Constant*> ArgVec;
ArgVec.push_back(Agg);
"extractvalue indices invalid!");
assert(Agg->getType()->isFirstClassType() &&
"Non-first-class type for constant extractvalue expression");
+ if (Constant *FC = ConstantFoldExtractValueInstruction(Agg, Idxs, NumIdx))
+ return FC; // Fold a few common cases...
// Look up the constant in the table first to ensure uniqueness
std::vector<Constant*> ArgVec;
ArgVec.push_back(Agg);
- SmallVector<unsigned, 4> Indices;
+ SmallVector<unsigned, 4> Indices(Idxs, Idxs + NumIdx);
const ExprMapKeyType Key(Instruction::ExtractValue, ArgVec, 0, Indices);
return ExprConstants->getOrCreate(ReqTy, Key);
}