[llvm] [SROA] Fix assertion failure when promoting self-referential load/store (PR #208826)

Yonah Goldberg via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 18:47:34 PDT 2026


https://github.com/YonahGoldberg commented:

This looks reasonable to me. The real shocker though is I had no idea LLVM will allow IR where a definition doesn't dominate all its uses, if the use is in an unreachable basic block. I guess if there is a use in an unreachable basic block and the definition is outside then this is fine, but I find this really unexpected that if both are in the same basic block we don't validate this. @nikic what do you think?

Other than that, the fix looks fine. Although TBH the `LoadAndStorePromoter` looks pretty brittle to me. I guess it has a precondition that it only takes in loads/stores/ an alloca and the loads and stores need to be to the same partition of that alloca? Maybe that should be stated somewhere, found it confusing to read without realizing that.

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


More information about the llvm-commits mailing list