Closed PHHargrove closed 10 years ago
I have determined that with "extra" casts it is possible to generate the following 4 cases:
1) upcr_shared_to_pshared(upcr_pshared_to_shared(p))
vs. p
2) upcr_shared_to_pshared(upcr_shared_resetphase(p))
vs. upcr_shared_to_pshared(p)
3) upcr_pshared_to_shared(upcr_shared_to_pshared(p))
vs. upcr_shared_resetphase(p)
4) upcr_shared_resetphase(upcr_shared_resetphase(p))
vs. upcr_shared_resetphase(p)
One can generate these four cases (in order) with the four assignments below:
shared [0] int *a;
shared [1] int *b;
shared [2] int *c;
shared [3] int *d;
void foo(void) {
a = (shared void *)b;
b = (shared [1] int *)(shared [4] int *)d;
c = (shared [2] int *)(shared [1] int *)d;
c = (shared [2] int *)(shared [4] int *)d;
}
I have code to fold the 4 combinations listed above and am testing now...
Code at https://github.com/Intrepid/upc2c/compare/issue-85 has passed my testing. I would appreciate a review before merging to master.
AMDG
On 03/19/2014 09:51 PM, Paul H. Hargrove wrote:
Code at https://github.com/Intrepid/upc2c/compare/issue-85 has passed my testing. I would appreciate a review before merging to master.
I don't see any problems. Please go ahead.
In Christ, Steven Watanabe
Based on the generic nature of
shared void *
it is possible for a programmer to write something likep = (shared void *)q
wherep
andq
are both phase-less (cyclic or indefinite) pointers. This occurs, for instance, benchmarks/stream.c of the test suite.For this case the resulting code is
p = upcr_shared_to_pshared(upcr_pshared_to_shared(q))
, whilep = q
would be sufficient.I am going to look quickly at folding this and possibly the shared->pshared->shared conversion (which must become a call to upcr_shared_resetphase) if I can determine if/how this case would occur in practice.