[llvm] Prevent GlobalOpt from folding away addrspacecasts which may be runtime operations. (PR #153753)

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 00:15:20 PDT 2025


resistor wrote:

> Isn't this only relevant to hybrid CHERI?

Yes, I believe it only creates a practical problem for hybrid CHERI.

The existing transformation is still incorrect per LangRef, and the test does not depend on anything CHERI-specific. The condition for blocking the transformation could be tightened when both address spaces are integral pointers (guaranteeing the casts are reversible), but that seems to be in flux per https://github.com/llvm/llvm-project/pull/105735 If that's an issue, I'm happy to wait on this change until that PR is sorted out, and then implement the tighter condition.

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


More information about the llvm-commits mailing list