During a recent visual review of the x86 memory folding code I noticed that X86InstrInfo::canFoldMemoryOperand had bit-rotted somewhat compared to the actual foldMemoryOperand/foldMemoryOperandImpl implementation. I began investigating a fix when I realised that canFoldMemoryOperand is not actually used anywhere in the codebase.... All existing users instead call foldMemoryOperand directly when they wish to fold and can correctly deduce what they need from the return value. I don't see this state of affairs changing - do you?
This patch removes the canFoldMemoryOperand base function and the target implementations; only x86 had a real implementation, although AMDGPU had a preparatory stub that had never needed to be completed.