OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
37d94b4
)
Fix Transforms/ConstProp/2007-02-05-BitCast.ll
author
Chris Lattner
<sabre@nondot.org>
Tue, 6 Feb 2007 02:22:56 +0000
(
02:22
+0000)
committer
Chris Lattner
<sabre@nondot.org>
Tue, 6 Feb 2007 02:22:56 +0000
(
02:22
+0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33948
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/VMCore/ConstantFold.cpp
patch
|
blob
|
history
diff --git
a/lib/VMCore/ConstantFold.cpp
b/lib/VMCore/ConstantFold.cpp
index
41078d9
..
a540f4e
100644
(file)
--- a/
lib/VMCore/ConstantFold.cpp
+++ b/
lib/VMCore/ConstantFold.cpp
@@
-296,8
+296,12
@@
Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
// Handle ConstantFP input.
if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
// FP -> Integral.
- if (DestTy->isInteger())
+ if (DestTy == Type::Int32Ty) {
+ return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
+ } else {
+ assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!");
return ConstantInt::get(DestTy, DoubleToBits(FP->getValue()));
+ }
}
return 0;
default: