Ocean bathymetry exerts a strong control on ice sheet-ocean interactions within Antarctic ice-shelf cavities, where it can limit the access of warm, dense water at depth to the underside of floating ice shelves. However, ocean bathymetry is challenging to measure within or close to ice-shelf cavities. It remains unclear how uncertainty in existing bathymetry datasets affect simulated sub-ice shelf melt rates. Here we infer linear sensitivities of ice shelf melt rates to bathymetric shape with grid-scale detail by means of the adjoint of an ocean general circulation model. Both idealised and realistic-geometry experiments of sub-ice shelf cavities in West Antarctica reveal that bathymetry has a strong impact on melt in localised regions such as topographic obstacles to flow. Moreover, response of melt to bathymetric perturbation is found to be non-monotonic, with deepening leading to either increased or decreased melt depending on location. Our computational approach provides a comprehensive way of identifying regions where refined knowledge of bathymetry is most impactful, and also where bathymetric errors have relatively little effect on modelled ice sheet-ocean interactions.