[llvm-commits] CVS: llvm/lib/Analysis/ConstantFolding.cpp ScalarEvolution.cpp
Chris Lattner
sabre at nondot.org
Tue Jan 30 15:15:59 PST 2007
Changes in directory llvm/lib/Analysis:
ConstantFolding.cpp updated: 1.10 -> 1.11
ScalarEvolution.cpp updated: 1.90 -> 1.91
---
Log message:
adjust to constant folding api changes.
---
Diffs of the changes: (+8 -7)
ConstantFolding.cpp | 11 ++++++-----
ScalarEvolution.cpp | 4 ++--
2 files changed, 8 insertions(+), 7 deletions(-)
Index: llvm/lib/Analysis/ConstantFolding.cpp
diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.10 llvm/lib/Analysis/ConstantFolding.cpp:1.11
--- llvm/lib/Analysis/ConstantFolding.cpp:1.10 Mon Jan 15 00:27:37 2007
+++ llvm/lib/Analysis/ConstantFolding.cpp Tue Jan 30 17:15:43 2007
@@ -85,23 +85,24 @@
}
}
-Constant *
-llvm::ConstantFoldFP(double (*NativeFP)(double), double V, const Type *Ty) {
+static Constant *ConstantFoldFP(double (*NativeFP)(double), double V,
+ const Type *Ty) {
errno = 0;
V = NativeFP(V);
if (errno == 0)
return ConstantFP::get(Ty, V);
+ errno = 0;
return 0;
}
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
/// with the specified arguments, returning null if unsuccessful.
Constant *
-llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
+llvm::ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands) {
const std::string &Name = F->getName();
const Type *Ty = F->getReturnType();
- if (Operands.size() == 1) {
+ if (NumOperands == 1) {
if (ConstantFP *Op = dyn_cast<ConstantFP>(Operands[0])) {
double V = Op->getValue();
switch (Name[0])
@@ -172,7 +173,7 @@
else if (Name == "llvm.bswap.i64")
return ConstantInt::get(Ty, ByteSwap_64(V));
}
- } else if (Operands.size() == 2) {
+ } else if (NumOperands == 2) {
if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {
double Op1V = Op1->getValue();
if (ConstantFP *Op2 = dyn_cast<ConstantFP>(Operands[1])) {
Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.90 llvm/lib/Analysis/ScalarEvolution.cpp:1.91
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.90 Fri Jan 19 15:13:56 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp Tue Jan 30 17:15:43 2007
@@ -1761,8 +1761,8 @@
return ConstantExpr::getSelect(Operands[0], Operands[1], Operands[2]);
case Instruction::Call:
if (Function *GV = dyn_cast<Function>(Operands[0])) {
- Operands.erase(Operands.begin());
- return ConstantFoldCall(cast<Function>(GV), Operands);
+ return ConstantFoldCall(cast<Function>(GV), &Operands[1],
+ Operands.size()-1);
}
return 0;
case Instruction::GetElementPtr: {
More information about the llvm-commits
mailing list