The main reason is to avoid making false assumptions in the code.
I don't know how that could be used, say, to introduce a security
bug, but I think validating untrusted input should be done by
default.
Conveniently this also acts as documentation for who needs to know
what fields we indeed expect to find in a well-known structure.
In the projected case, (1.2, 0.5) divided by 2.0 results in (0.6, 0.25) as
effective coordinates. The 0.25 y-coordinate is well within the second row of
texels; that's fine. On the other hand, the 0.6 x-coordinate falls right
between the third and fourth column of texels. The test expects the fourth
column to be selected, but that's very fragile: neither 1.2 nor 0.6 can be
exactly represented as a 32-bit floating-point value, and it only takes a
single ulp to push things to the other side of the edge.
Constant numeric local variables can be used in places were literals are
expected if they're initialized with a static expression.
Storing such constant in ctx->static_initializers allows copy-prop to
handle such cases properly.
Emission of code into individual block instruction arrays was done to
enable construction of a control flow graph. A graph is constructed from
the flat instruction array in a later pass, so blocks are not needed.
It is possible to emit instructions directly into the array in struct
vsir_program instead of from sm6_function_emit_instructions(), but since
the patch constant function occurs first in DXIL hull shaders, this would
reverse the current order of functions in the flat array. That may be
acceptable, but it is left for a later patch in case any issues arise.