Page MenuHomePhabricator

D58080.diff
No OneTemporary

File Metadata

Created
Fri, Nov 15, 2:53 AM

D58080.diff

Index: lib/CodeGen/GlobalISel/LegalizerHelper.cpp
===================================================================
--- lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -1148,14 +1148,19 @@
bool LosesInfo;
switch (WideTy.getSizeInBits()) {
case 32:
- Val.convert(APFloat::IEEEsingle(), APFloat::rmTowardZero, &LosesInfo);
+ Val.convert(APFloat::IEEEsingle(), APFloat::rmNearestTiesToEven,
+ &LosesInfo);
break;
case 64:
- Val.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &LosesInfo);
+ Val.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven,
+ &LosesInfo);
break;
default:
- llvm_unreachable("Unhandled fp widen type");
+ return UnableToLegalize;
}
+
+ assert(!LosesInfo && "extend should always be lossless");
+
Observer.changingInstr(MI);
SrcMO.setFPImm(ConstantFP::get(Ctx, Val));

Event Timeline