when reading the comments in CodeGenFunction::EmitAggregateCopy
there seem to be two problems:
1. "Aggregate assignment turns into llvm.memcpy. This is almost valid per
For me, "almost valid" means that it is valid for 99% of the cases but
be the possibility to switch it off
2. "FIXME: If we have a volatile struct, the optimizer can remove what might
appear to be `extra' memory ops"
This sounds like the current implementation can produce incorrect code for
volatile struct variables.
This is my alternative implementation based on element wise copy of all
I would suggest that it is used if isVolatile is true or if a flag in
indicates that it always should be used. This way the 99% of the cases
continue using memcpy.