I've been sitting on this because I'm still not sure about 4/9 and 5/9, when we're going to be feeding this through a lower level IR that's better equipped to handle those kinds of transformations. I still feel like this is going in the wrong direction. I don't want to block implementing an important feature forever, but I also don't want that refactoring to never happen. I suppose I can accept this as long as we *are* committed to fixing this the right way eventually, and not putting it off forever just because it's hard.
I'm also bothered by 3/9. hlsl_deref_is_lowered() is used in two places:
* hlsl_deref_get_type(), which feels like it should just have "if (deref->data_type) return deref->data_type;"
* dump_deref(), which I'm not sure why it needs to call that function at all? Why isn't that just "else"?