offsetMemoryInMemBound :: RebaseMap -> MemBound u -> MemBound u
offsetMemoryInMemBound offsets (MemArray bt shape u (ArrayIn mem ixfun))
  | Just new_base <- lookupNewBase mem (IxFun.base ixfun) offsets =
      MemArray bt shape u $ ArrayIn mem $ IxFun.rebase new_base ixfun
offsetMemoryInMemBound :: RebaseMap -> MemBound u -> MemBound u
offsetMemoryInMemBound offsets (MemArray bt shape u (ArrayIn mem ixfun))
  | Just new_base <- lookupNewBase mem (IxFun.base ixfun) offsets =
      MemArray bt shape u $ ArrayIn mem $ IxFun.rebase new_base ixfun
offsetMemoryInMemBound offsets (MemArray bt shape u (ArrayIn mem ixfun))
  | Just new_base <- lookupNewBase mem (IxFun.base ixfun) offsets =
      MemArray bt shape u $ ArrayIn mem $ IxFun.rebase new_base ixfun