From what I understand, MSSA nodes are either MemoryPhis (which must only be associated with BasicBlocks), or MemoryUseOrDef (which must only be associated Instructions). Assuming that this invariant would not change in the future (which could easily not be the case if, for instance, there is desire for additional MSSA node types):
- getMemoryAccess could only ever return meaningful values when give a BasicBlock or Instruction,
- createMemoryAccessBefore/After could only ever return nodes for Instructions,
- Insertion of a new MemoryUseOrDef could only occur before another MemoryUseOrDef, since MemoryPhis must always come first in a BB's AccessList.
These type changes also have the pleasant side effect of reducing pointer casting verbiage.