[llvm-commits] [llvm] r72741 - in /llvm/trunk: include/llvm/Analysis/ConstantFolding.h lib/Analysis/ConstantFolding.cpp
Dan Gohman
gohman at apple.com
Tue Jun 2 14:48:44 PDT 2009
Author: djg
Date: Tue Jun 2 16:48:15 2009
New Revision: 72741
URL: http://llvm.org/viewvc/llvm-project?rev=72741&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Analysis/ConstantFolding.h
llvm/trunk/lib/Analysis/ConstantFolding.cpp
Modified: llvm/trunk/include/llvm/Analysis/ConstantFolding.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ConstantFolding.h?rev=72741&r1=72740&r2=72741&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ConstantFolding.h (original)
+++ llvm/trunk/include/llvm/Analysis/ConstantFolding.h Tue Jun 2 16:48:15 2009
@@ -34,7 +34,7 @@
/// 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,
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=72741&r1=72740&r2=72741&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Tue Jun 2 16:48:15 2009
@@ -317,8 +317,6 @@
/// 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));
More information about the llvm-commits
mailing list