summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-30 23:15:43 +0000
committerChris Lattner <sabre@nondot.org>2007-01-30 23:15:43 +0000
commit8dbea5454d824734017c8f6866fcac092db1e6fc (patch)
tree2000520f5f855a06d518bcf73105e1b88c6d314f /llvm/lib/Analysis/ConstantFolding.cpp
parent0d74d3c09b033986dfa6cf4bfa3ab91e0a5b4fda (diff)
downloadbcm5719-llvm-8dbea5454d824734017c8f6866fcac092db1e6fc.tar.gz
bcm5719-llvm-8dbea5454d824734017c8f6866fcac092db1e6fc.zip
adjust to constant folding api changes.
llvm-svn: 33673
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 46f9c577270..ef70ece7765 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -85,23 +85,24 @@ llvm::canConstantFoldCallTo(Function *F) {
}
}
-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 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
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])) {
OpenPOWER on IntegriCloud