[llvm] [DAG] Enable bitcast STLF for Constant/Undef (PR #172523)

via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 27 06:20:44 PST 2025


Michael-Chen-NJU wrote:

Hi @RKSimon, @arsenm,

I’d like to get your thoughts on the general direction of this STLF expansion. I've categorized the **remaining scenarios into three cases to keep the implementation manageable and avoid edge-case regressions**:

1. **Size Match (LdSize == StSize)**: Handled via a simple bitcast. This covers cases like i32 store to float load. (Already implemented).

2. **Size Mismatch - Vector Load (Branch B1)**: Handled via `bitcast -> EXTRACT_SUBVECTOR`. This is the primary focus of my current patch. It's gated by `isOperationLegalOrCustom` and has passed all local regression tests.

3. **Size Mismatch - Scalar Load (Branch B2)**: Handled via `bitcast -> EXTRACT_VECTOR_ELT`. This is planned for a follow-up patch. During local testing, I noticed that simple forwarding here can trigger infinite loops in the DAGCombiner for certain cases (specifically when the load's user requires scalarization). I am currently refining a safety check on the "User" node's legality to break these cycles.

**Does this classification seem like the right way forward? Any feedback on the potential pitfalls for Branch B2 would be much appreciated!**

https://github.com/llvm/llvm-project/pull/172523


More information about the llvm-commits mailing list