This is a phase 1 study of investigational drug CFI-400945 in patients with relapsed or refractory acute myeloid leukemia or myelodysplastic syndrome. The purpose of this phase 1 study is to see how safe and tolerable the study drug is and to determine the best dose (maximum tolerated dose or recommended phase 2 dose) that can be given in this patient population.