[clang] [Clang][CodeGen] Emit load of GEP after EmitMemberExpr (PR #110487)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 30 18:51:23 PDT 2024
bwendling wrote:
> > If I return the LValueToRValue cast and run EmitLValue on it
>
> I'm surprised EmitLValue didn't error out on that. The result of an LValueToRValue cast is an rvalue. Calling EmitPointerWithAlignment on it should work, I think.
>
> > I understand, but there are ~30 different types of implicit casts and it's hard to know which can be ignored and which shouldn't.
>
> The complexity here is, unfortunately, mostly unavoidable... maybe worth looking into some simplified classification of casts for common usage.
>
> > Convert a __builtin_dynamic_object_size with a FAM with __counted_by into the appropriate calculations in Sema.
>
> This might be reasonable.
>
> > because we lose the fact that the original expression was a __builtin_dynamic_object_size call
>
> If we went this route, probably we'd wrap the calculation in a dedicated node that contains both the original AST, and the lowered computation, or something like that.
I went ahead and used the `EmitPointerWithAlignment` for all (it worked without needing special casing). I'll look into doing this in Sema as a potential cleanup.
https://github.com/llvm/llvm-project/pull/110487
More information about the cfe-commits
mailing list