Open GoogleCodeExporter opened 9 years ago
questionable indeed.
Here we basically need to check *almost* the same conditions as the existing
compiler pass (in LLVM: load widening, which is part of GVN).
First of all, x should be 8-aligned.
But this means that if the conditions are true, such code should not survive
after GVN and tsan instrumentation should not see it.
And if GVN does not work we should fix it, not tsan.
Having said that, I can construct a test where GVN should not work,
but tsan could widen the instrumentation:
struct S {
double alignment;
int x, y;
};
int foo(S *s, int *a) {
int x = s->x;
*a = 0;
int y = s->y;
return x + y;
}
here, s->x and s->y can be widened by tsan but can not be widened by GVN due to
aliasing.
Leaving this bug open, but not planing to act on it in near term.
Original comment by konstant...@gmail.com
on 10 Apr 2012 at 10:54
One more data point: even when load widening may happen,
it is not necessary beneficial and may not actually happen.
But widening the tsan instrumentation is almost always good idea.
Original comment by konstant...@gmail.com
on 10 Apr 2012 at 10:58
From dvyukov:
I meant that it's questionable even for tsan. The problem is that all related
accesses (even not widened) will fall into "intersect" slow-path rather than
fast and expected "same size". Moreover it will trash shadow, now we have slot
for x, y and for x+y. At some point in time I had precise classification of
accesses size (same, larger, smaller, intersect, not intersect), but now we
have only same, intersect and not intersect, so, for example, access to x won't
be replaced with access to x+y; instead they will compete for shadow real
estate.
It's quite difficult to predict effects of such things, so it must be postponed
until after we have good representative benchmarks. Then such questions are
easily answered.
Original comment by konstant...@gmail.com
on 11 Apr 2012 at 3:19
Original issue reported on code.google.com by
dvyu...@google.com
on 2 Apr 2012 at 11:39