File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -233,22 +233,29 @@ jobject InstrKindInfoGetter::handleFloatLiteralInst() {
233
233
FloatLiteralInst* castInst = cast<FloatLiteralInst>(instr);
234
234
APFloat value = castInst->getValue ();
235
235
236
- if (value.isFinite ()) {
236
+ if (&value.getSemantics () == &APFloat::IEEEsingle ()) {
237
+ // To Float
238
+ node = (*wala)->makeConstant (value.convertToFloat ());
239
+ }
240
+ else if (&value.getSemantics () == &APFloat::IEEEdouble ()) {
241
+ // To Double
242
+ node = (*wala)->makeConstant (value.convertToDouble ());
243
+ }
244
+ else if (value.isFinite ()) {
237
245
// To BigDecimal
238
246
SmallVector<char , 128 > buf;
239
247
value.toString (buf);
240
248
jobject bigDecimal = (*wala).makeBigDecimal (buf.data (), buf.size ());
241
249
node = (*wala)->makeConstant (bigDecimal);
242
- nodeMap->insert (std::make_pair (castInst, node));
243
250
}
244
251
else {
245
252
// Infinity or NaN, convert to double
246
253
// as BigDecimal constructor cannot accept strings of these
247
254
bool APFLosesInfo;
248
255
value.convert (APFloat::IEEEdouble (), APFloat::rmNearestTiesToEven, &APFLosesInfo);
249
256
node = (*wala)->makeConstant (value.convertToDouble ());
250
- nodeMap->insert (std::make_pair (castInst, node));
251
257
}
258
+ nodeMap->insert (std::make_pair (castInst, node));
252
259
return node;
253
260
}
254
261
You can’t perform that action at this time.
0 commit comments