@@ -2072,7 +2072,14 @@ and GenConstant cenv cgbuf eenv (c,m,ty) sequel =
20722072| Const.SByte i-> CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( mkLdcInt32( int32 i))
20732073| Const.Int16 i-> CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( mkLdcInt32( int32 i))
20742074| Const.Int32 i-> CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( mkLdcInt32 i)
2075- | Const.Int64 i-> CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( iLdcInt64 i)
2075+ | Const.Int64 i->
2076+ // see https://github.com/Microsoft/visualfsharp/pull/3620
2077+ if i>= int64 System.Int32.MinValue&& i<= int64 System.Int32.MaxValuethen
2078+ CG.EmitInstrs cgbuf( pop0 ) ( Push[ ilTy]) [ mkLdcInt32( int32 i); AI_ conv DT_ I8]
2079+ elif i>= int64 System.UInt32.MinValue&& i<= int64 System.UInt32.MaxValuethen
2080+ CG.EmitInstrs cgbuf( pop0 ) ( Push[ ilTy]) [ mkLdcInt32( int32 i); AI_ conv DT_ U8]
2081+ else
2082+ CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( iLdcInt64 i)
20762083| Const.IntPtr i-> CG.EmitInstrs cgbuf( pop0 ) ( Push[ ilTy]) [ iLdcInt64 i; AI_ conv DT_ I]
20772084| Const.Byte i-> CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( mkLdcInt32( int32 i))
20782085| Const.UInt16 i-> CG.EmitInstr cgbuf( pop0 ) ( Push[ ilTy]) ( mkLdcInt32( int32 i))