[clang] [clang] Generate nuw GEPs for struct member accesses (PR #99538)

Hari Limaye via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 13:18:55 PDT 2024


hazzlim wrote:

> `CGBuilder` is just aiming to provide an `Address` overload of LLVM's `CreateStructGEP`. It seems wrong for two overloads to have subtly different behavior.
> 
> Is there a reason why LLVM's `CreateStructGEP` doesn't add `nuw` itself?

Good point - I can see that it makes more sense to add the flag there.

I can rework this patch to do this. Before doing so - do people think it still makes sense to do add the flag in ‘llvm::CreateStructGEP’, given that as @nikic points out we can infer the flag at the IR level?

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


More information about the cfe-commits mailing list