aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-10-20 07:07:24 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-10-20 07:07:24 +0000
commitb83eb6447ba155342598f0fabe1f08f5baa9164a (patch)
treea5822f5fdac89033b7b16ba8e5aaf1ae10833b1c /lib/Analysis/ConstantFolding.cpp
parent6e7dd9db6bf677c9161a6ecc12f90651cf1231e0 (diff)
downloadexternal_llvm-b83eb6447ba155342598f0fabe1f08f5baa9164a.zip
external_llvm-b83eb6447ba155342598f0fabe1f08f5baa9164a.tar.gz
external_llvm-b83eb6447ba155342598f0fabe1f08f5baa9164a.tar.bz2
For PR950:
This patch implements the first increment for the Signless Types feature. All changes pertain to removing the ConstantSInt and ConstantUInt classes in favor of just using ConstantInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 7e802ba..359766d 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -163,14 +163,15 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
default:
break;
}
- } else if (ConstantUInt *Op = dyn_cast<ConstantUInt>(Operands[0])) {
- uint64_t V = Op->getValue();
+ } else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
+ assert(Op->getType()->isUnsigned() && "bswap args must be unsigned");
+ uint64_t V = Op->getZExtValue();
if (Name == "llvm.bswap.i16")
- return ConstantUInt::get(Ty, ByteSwap_16(V));
+ return ConstantInt::get(Ty, ByteSwap_16(V));
else if (Name == "llvm.bswap.i32")
- return ConstantUInt::get(Ty, ByteSwap_32(V));
+ return ConstantInt::get(Ty, ByteSwap_32(V));
else if (Name == "llvm.bswap.i64")
- return ConstantUInt::get(Ty, ByteSwap_64(V));
+ return ConstantInt::get(Ty, ByteSwap_64(V));
}
} else if (Operands.size() == 2) {
if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {