else
dstAdj = llvm::ConstantExpr::getNSWAdd(srcAdj, adj);
- return llvm::ConstantExpr::getInsertValue(src, dstAdj, 1);
+ llvm::Constant *res = ConstantFoldInsertValueInstruction(src, dstAdj, 1);
+ assert(res != nullptr && "Folding must succeed");
+ return res;
}
llvm::Constant *
auto *CAgg = dyn_cast<Constant>(Agg);
auto *CVal = dyn_cast<Constant>(Val);
if (CAgg && CVal)
- return Fold(ConstantExpr::getInsertValue(CAgg, CVal, IdxList));
+ return ConstantFoldInsertValueInstruction(CAgg, CVal, IdxList);
return nullptr;
}
auto *CAgg = dyn_cast<Constant>(Agg);
auto *CVal = dyn_cast<Constant>(Val);
if (CAgg && CVal)
- return ConstantExpr::getInsertValue(CAgg, CVal, IdxList);
+ return ConstantFoldInsertValueInstruction(CAgg, CVal, IdxList);
return nullptr;
}
case Instruction::InsertElement:
return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2]);
case Instruction::InsertValue:
- return ConstantExpr::getInsertValue(
+ return ConstantFoldInsertValueInstruction(
Ops[0], Ops[1], cast<InsertValueInst>(InstOrCE)->getIndices());
case Instruction::ShuffleVector:
return ConstantExpr::getShuffleVector(