mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Fix constant folding through bitcasts by no longer relying on undefined behaviour (converting NaN values between float and double).
SelectionDAG::getConstantFP(double Val, EVT VT, bool isTarget); should not be used when Val is not a simple constant (as the comment in SelectionDAG.h indicates). This patch avoids using this function when folding an unknown constant through a bitcast, where it cannot be guaranteed that Val will be a simple constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163703 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2454,9 +2454,9 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL,
|
||||
}
|
||||
case ISD::BITCAST:
|
||||
if (VT == MVT::f32 && C->getValueType(0) == MVT::i32)
|
||||
return getConstantFP(Val.bitsToFloat(), VT);
|
||||
return getConstantFP(APFloat(Val), VT);
|
||||
else if (VT == MVT::f64 && C->getValueType(0) == MVT::i64)
|
||||
return getConstantFP(Val.bitsToDouble(), VT);
|
||||
return getConstantFP(APFloat(Val), VT);
|
||||
break;
|
||||
case ISD::BSWAP:
|
||||
return getConstant(Val.byteSwap(), VT);
|
||||
|
Reference in New Issue
Block a user