[clang] Fix memcpy-operator= generation with restrict parameters. (PR #194906)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 29 11:56:10 PDT 2026
erichkeane wrote:
> I'm still trying to think through the ramifications of this. I think it's roughly correct, but there are a lot of other qualifiers (and type attributes, etc). I did notice we seem to be handling `volatile` incorrectly: https://godbolt.org/z/soGb7q1a1 (we lower to a memcpy but that fails to meet the requirement that we do the volatile loads and stores). You mention address spaces, and that's true for `__attribute__((address_space))` but what about things like `__constant` in OpenCL/CUDA/SYCL, etc; those have different rules despite also being address spaces.
So I would expect those address spaces to be 'consistent' at least? So it WOULD be copying 1 AS to the same one.
Though I can't say I understand address spaces enough to say whether the memcpy decay would work.
This DOES make me wonder WHY volatile doesn't hit this same branch (though we DO get it wrong during codegen seemingly, since we emit it in CG as a memcpy even though it is a loop in the AST). I think I want to poke at that and come up with a good reason we shouldn't be making the same decision.
https://github.com/llvm/llvm-project/pull/194906
More information about the cfe-commits
mailing list