mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Change ConstantFoldConstantExpression to accept a null
TargetData pointer. The only thing it's used for are calls to ConstantFoldCompareInstOperands and ConstantFoldInstOperands, which both already accept a null TargetData pointer. This makes ConstantFoldConstantExpression easier to use in clients where TargetData is optional. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -34,7 +34,7 @@ Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
|
|||||||
/// using the specified TargetData. If successful, the constant result is
|
/// using the specified TargetData. If successful, the constant result is
|
||||||
/// result is returned, if not, null is returned.
|
/// result is returned, if not, null is returned.
|
||||||
Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
|
Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
|
||||||
const TargetData *TD);
|
const TargetData *TD = 0);
|
||||||
|
|
||||||
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
|
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
|
||||||
/// specified operands. If successful, the constant result is returned, if not,
|
/// specified operands. If successful, the constant result is returned, if not,
|
||||||
|
@@ -317,8 +317,6 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I, const TargetData *TD) {
|
|||||||
/// result is returned, if not, null is returned.
|
/// result is returned, if not, null is returned.
|
||||||
Constant *llvm::ConstantFoldConstantExpression(ConstantExpr *CE,
|
Constant *llvm::ConstantFoldConstantExpression(ConstantExpr *CE,
|
||||||
const TargetData *TD) {
|
const TargetData *TD) {
|
||||||
assert(TD && "ConstantFoldConstantExpression requires a valid TargetData.");
|
|
||||||
|
|
||||||
SmallVector<Constant*, 8> Ops;
|
SmallVector<Constant*, 8> Ops;
|
||||||
for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i)
|
for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i)
|
||||||
Ops.push_back(cast<Constant>(*i));
|
Ops.push_back(cast<Constant>(*i));
|
||||||
|
Reference in New Issue
Block a user