if (const ExtractValueConstantExpr *EVCE =
dyn_cast<ExtractValueConstantExpr>(this))
return EVCE->Indices;
- if (const InsertValueConstantExpr *IVCE =
- dyn_cast<InsertValueConstantExpr>(this))
- return IVCE->Indices;
- assert(0 && "ConstantExpr does not have indices!");
+
+ return cast<InsertValueConstantExpr>(this)->Indices;
}
/// ConstantExpr::get* - Return some common constants without having to
Op2 = (OpNo == 2) ? Op : getOperand(2);
return ConstantExpr::getShuffleVector(Op0, Op1, Op2);
case Instruction::InsertValue: {
- const SmallVector<unsigned, 4> Indices = getIndices();
+ const SmallVector<unsigned, 4> &Indices = getIndices();
Op0 = (OpNo == 0) ? Op : getOperand(0);
Op1 = (OpNo == 1) ? Op : getOperand(1);
return ConstantExpr::getInsertValue(Op0, Op1,
}
case Instruction::ExtractValue: {
assert(OpNo == 0 && "ExtractaValue has only one operand!");
- const SmallVector<unsigned, 4> Indices = getIndices();
+ const SmallVector<unsigned, 4> &Indices = getIndices();
return
ConstantExpr::getExtractValue(Op, &Indices[0], Indices.size());
}
case Instruction::ShuffleVector:
return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]);
case Instruction::InsertValue: {
- const SmallVector<unsigned, 4> Indices = getIndices();
+ const SmallVector<unsigned, 4> &Indices = getIndices();
return ConstantExpr::getInsertValue(Ops[0], Ops[1],
&Indices[0], Indices.size());
}
case Instruction::ExtractValue: {
- const SmallVector<unsigned, 4> Indices = getIndices();
+ const SmallVector<unsigned, 4> &Indices = getIndices();
return ConstantExpr::getExtractValue(Ops[0],
&Indices[0], Indices.size());
}