A while ago I implemented the functionality to lower Microsoft ptr32
and ptr64 pointers, which are basically stored as 32-bit and 64-bit
pointers and are extended/truncated to the appropriate pointer size when
dereferenced. Apparently I never implemented this extend/truncate when
dereferencing part, so that is what this patch attempts to do.
For 32-bit pointers in 64-bit builds I put the sign/zero extend in
matchAddress in X86ISelDAGToDAG, but loading from 64-bit pointers in
32-bit builds fails in the legalizer before that point, which is why
this code is in two different places. Not sure if this is a good way of doing
this.
This just shows the sign extension. I would add a check line for the actual load too, to make sure that's correct and also to make the test easier to understand. Same for the tests below.