summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-02-04 10:17:14 +0000
committerDuncan Sands <baldrick@free.fr>2009-02-04 10:17:14 +0000
commita06aef6ec55552640e45ffada96e43cae96cfc01 (patch)
tree6aecaeb4008b2c805ff1d92aeec1a4c77a4470c6 /lib/VMCore
parent5caa883afc2c768c293757d4ca30d85b9094e876 (diff)
downloadllvm-a06aef6ec55552640e45ffada96e43cae96cfc01.tar.gz
llvm-a06aef6ec55552640e45ffada96e43cae96cfc01.tar.bz2
llvm-a06aef6ec55552640e45ffada96e43cae96cfc01.tar.xz
Fix PR3468: a crash when constant folding a bitcast of
i80 to x86 long double (this was presumably generated by sroa). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/ConstantFold.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 5c1578f74b..5f7cbcd0b6 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -153,12 +153,11 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
// Integral -> Integral. This is a no-op because the bit widths must
// be the same. Consequently, we just fold to V.
return V;
-
- if (DestTy->isFloatingPoint()) {
- assert((DestTy == Type::DoubleTy || DestTy == Type::FloatTy) &&
- "Unknown FP type!");
- return ConstantFP::get(APFloat(CI->getValue()));
- }
+
+ if (DestTy->isFloatingPoint())
+ return ConstantFP::get(APFloat(CI->getValue(),
+ DestTy != Type::PPC_FP128Ty));
+
// Otherwise, can't fold this (vector?)
return 0;
}