forked from OSchip/llvm-project
Fix PR3468: a crash when constant folding a bitcast of
i80 to x86 long double (this was presumably generated by sroa). llvm-svn: 63730
This commit is contained in:
parent
4ded601445
commit
1ea1173143
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
; RUN: llvm-as < %s | opt -instcombine
|
||||
; PR3468
|
||||
|
||||
define x86_fp80 @cast() {
|
||||
%tmp = bitcast i80 0 to x86_fp80 ; <x86_fp80> [#uses=1]
|
||||
ret x86_fp80 %tmp
|
||||
}
|
Loading…
Reference in New Issue