[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 13:18:13 PDT 2025


efriedma-quic wrote:

> We only perform this optimization in addrspace(0). 

I'd still prefer to get this right for all address-spaces, so we don't need to revisit later.

But really, I'm more concerned about the "happens to get folded" part: there isn't a stable set of values that get constant-folded, at the LLVM IR level, it's just whether IRBuilder happens to do today.  The only way to get a stable answer is to query the AST (Expr::isNullPointerConstant).

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


More information about the cfe-commits mailing list