[PATCH] [OPENMP] Do not emit references to original variables in 'private' clause.
rjmccall at gmail.com
Tue May 19 11:21:24 PDT 2015
Okay, thank you. What you're saying is that the shareds structure contains a pointer to every captured variable, and those pointers are normally initialized by taking the address of the original variable, but since private captures are allocated separately their address must be initialized separately. That all makes sense to me.
What I'm not clear on is why the shareds structure needs to contain pointers to the private captures at all. It looks to me like that's purely an artifact of our CapturedStmt code generation, where it only expects to receive a pointer to the shareds structure. The actual task function passed to kmp_omp_task_alloc takes a pointer to the task structure, which is where the private variables are actually allocated, and we currently just make that a proxy function that drills down to the shareds structure so that we can satisfy CapturedStmt.
It seems to me that, if we can recognize that private captures need different initialization, we should also be able to recognize that they don't need an actual field in the shareds structure, and code-generation can just directly use their address in the task. Does that not work? Is the current formulation necessary for consistency in some way?
More information about the cfe-commits