This change extends the detection of base pointers for vector constructs to handle arbitrary phi and select nodes. The existing non-vector code already handles those, so this is basically just extending the vector special case to be less special cased. It still isn't generalized vector handling since we can't handle arbitrary vector instructions (e.g. shufflevectors), but it's a lot closer.
The general structure of the change is as follows:
- Extend the base defining value relation over a subset of vector instructions and vector typed phi & select instructions.
- Move scalarization from before base pointer rewriting to after base pointer rewriting. The extension of the BDV relation is sufficient to find vector base phis for vector inputs.
- Preserve the existing special case logic for when the base of a vector element is locally obvious. This general idea could be extended to the scalar case as well.