aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-02 21:48:15 +0000
committerDan Gohman <gohman@apple.com>2009-06-02 21:48:15 +0000
commitebe2d0079b086caa4d68ea9b63397751e4df6564 (patch)
treec8c2337a78ffb65fb9401c45017780ed3a127c2c
parent8d1ab3e2a7fe8adcec3db9576aa84d34be679033 (diff)
downloadexternal_llvm-ebe2d0079b086caa4d68ea9b63397751e4df6564.zip
external_llvm-ebe2d0079b086caa4d68ea9b63397751e4df6564.tar.gz
external_llvm-ebe2d0079b086caa4d68ea9b63397751e4df6564.tar.bz2
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
-rw-r--r--include/llvm/Analysis/ConstantFolding.h2
-rw-r--r--lib/Analysis/ConstantFolding.cpp2
2 files changed, 1 insertions, 3 deletions
diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h
index bf360f7..5fdf6d2 100644
--- a/include/llvm/Analysis/ConstantFolding.h
+++ b/include/llvm/Analysis/ConstantFolding.h
@@ -34,7 +34,7 @@ Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
/// using the specified TargetData. If successful, the constant result is
/// result is returned, if not, null is returned.
Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
- const TargetData *TD);
+ const TargetData *TD = 0);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
/// specified operands. If successful, the constant result is returned, if not,
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index e5ab322..261c635 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -317,8 +317,6 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I, const TargetData *TD) {
/// result is returned, if not, null is returned.
Constant *llvm::ConstantFoldConstantExpression(ConstantExpr *CE,
const TargetData *TD) {
- assert(TD && "ConstantFoldConstantExpression requires a valid TargetData.");
-
SmallVector<Constant*, 8> Ops;
for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i)
Ops.push_back(cast<Constant>(*i));