summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-04-24 21:34:13 +0000
committerDale Johannesen <dalej@apple.com>2009-04-24 21:34:13 +0000
commit56cb14c8741f39124ec3cd523391597f950f517f (patch)
treee4ce9116a0b6dba92a27aaad655d46b6fe2bc6ec /llvm/lib
parentc78d34699fc47e947939d640b5ba215f9018b4fc (diff)
downloadbcm5719-llvm-56cb14c8741f39124ec3cd523391597f950f517f.tar.gz
bcm5719-llvm-56cb14c8741f39124ec3cd523391597f950f517f.zip
Fix PR 4057, a crash doing float->char const folding.
This particular one is undefined behavior (although this isn't related to the crash), so it will no longer do it at compile time, which seems better. llvm-svn: 69990
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index edd985ed1ad..954b84233bb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2197,16 +2197,17 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL,
}
case ISD::FP_TO_SINT:
case ISD::FP_TO_UINT: {
- integerPart x;
+ integerPart x[2];
bool ignored;
assert(integerPartWidth >= 64);
// FIXME need to be more flexible about rounding mode.
- APFloat::opStatus s = V.convertToInteger(&x, 64U,
+ APFloat::opStatus s = V.convertToInteger(x, VT.getSizeInBits(),
Opcode==ISD::FP_TO_SINT,
APFloat::rmTowardZero, &ignored);
if (s==APFloat::opInvalidOp) // inexact is OK, in fact usual
break;
- return getConstant(x, VT);
+ APInt api(VT.getSizeInBits(), 2, x);
+ return getConstant(api, VT);
}
case ISD::BIT_CONVERT:
if (VT == MVT::i32 && C->getValueType(0) == MVT::f32)
OpenPOWER on IntegriCloud