Note also that what makes this work is not so much that the load src is uniform (and hence "real") but that it's constant. In fact, more broadly, we can safely copy-prop an object load *if* the load var doesn't change between the prior load and this resource instruction. We don't have the infrastructure right now to do that with all variables (we could if we wanted to, but it's probably not worthwhile—doing it with uniforms alone should probably be enough?)
I think I agree, but this feels more subtle (for example, you have to be sure of what happens when you have a constant object initialized to a mutable one, which is later mutated, and be sure that the right thing happens). So I would avoid it until we have an indication that is required for feature parity with native.
I think we can probably assume that variables act like variables and not pointers ;-)
OTOH, I think that the current implementation is still somewhat problematic. I couldn't write an actual failing example, but I am concerned by something like:
Normal variables work fine, because what we're propagating is not the hlsl_deref but the hlsl_ir_load instruction pointer. That is, we're propagating an SSA pointer to a load that happened at a previous point in time.
Object loads in resource instructions are special and require this patch, because they shortcut the hlsl_ir_load instruction and use the hlsl_deref directly.