[llvm] [InferAddressSpaces] Fix null PHI operand when an incoming flat expression is not rewritten (PR #205749)

Pankaj Dwivedi via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 01:22:32 PDT 2026


PankajDwivedi-25 wrote:

> Thanks @PankajDwivedi-25 — I think you're right.
> 
> For phi_incoming_constant_expr / phi_incoming_global, we only have a flat address going into the cycle. Turning that into an addrspacecast to addrspace(1) and loading as global isn't really justified, and can make a previously fine flat load into poison/UB. So those CHECKs aren't just covering the crash; they're locking in the wrong rewrite.
> 
> #215525 looks like the better fix here: lower the stuck uninitialized values to flat so we don't incorrectly push the users into AS1 in the first place. The cast-on-failed-lookup path in this PR is more of a band-aid and still keeps that bad inference.
> 
> I'm fine closing this in favor of #215525. Happy to help with the tests there if useful.

@Peter9606  other pr has been merged, thanks for working on this, if this doesn't add anything else we can close this.

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


More information about the llvm-commits mailing list