patch: remove PseudoSourceValue from Value.

Chris Lattner clattner at
Mon Mar 10 22:01:50 PDT 2014

On Mar 10, 2014, at 5:56 PM, Nick Lewycky <nlewycky at> wrote:

> My personal problem with PseudoSourceValue is that is perverts the Value hierarchy with things that are not IR values... originally so that the AA interfaces could take machine "pointers" and somehow do something sensible with them.
> This is a flawed design.  The only way this could work is if the "MachineAA" level interface successfully catches any (e.g.) stack address entries and avoids passing them do into the IR-level AA interfaces.
> Given that, we're getting no benefit from mashing them in as Value*'s and we're also getting no help from the C++ type system.  A better way to go would be to make PseudoSourceValue be a pointer-sized discriminated union that is *either* a Value*, a frame index, constant pool index, etc.  This would require clients to unwrap all the special cases (verifying they actually have a value*) before calling the IR level interfaces, and it would give us a place to put various query APIs (on PseudoSourceValue itself).
> While we're at it, it should be renamed to something that starts with "Machine". :-)
> This sounds very similar to what I've done in the patch I mailed out. PseudoSourceValue is changed to represent only frame index, constant pool index, etc., never a Value*. MachinePointerInfo stores a pointer union of Value* and PseudoSourceValue.
> Then you'd like me to merge PSV into MPI? There are methods on PSV which aren't defined on MPI, so I'm not sure what I would do about them -- make them assert the MPI isn't holding a Value*?

Which methods?  I haven't looked at the patch, but it sounds like MachinePointerInfo is the right thing.  Can you just nuke PSV from orbit? :-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the llvm-commits mailing list