Two write statements which write into the very same array slot generally are
conflicting. However, in case the value that is written is identical, this
does not cause any problem. Hence, allow such write pairs in this specific
situation.
Details
- Reviewers
Meinersbur bollu singam-sanjay
Diff Detail
- Build Status
Buildable 9100 Build 9100: arc lint + arc unit
Event Timeline
lib/CodeGen/PPCGCodeGeneration.cpp | ||
---|---|---|
199–200 | [Nit] unrelated? | |
228 | [Nit] unrelated? | |
237 | [Nit] unrelated? | |
lib/Transform/ZoneAlgo.cpp | ||
291 | [Suggestion] This will reject as soon as there is a third store that writes a different value somewhere unrelated. Maybe add a TODO comment and/or add a FAIL: * test case to improve this some day? | |
292–293 | [Suggestion] Does either isLatestArrayKind() or MA->isOriginalArrayKind() suffice? | |
test/ForwardOpTree/forward_load_double_write.ll | ||
3 |
|
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | Isn't this could be "canonicalized" by gvn? |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | or dead store elimination |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | Maybe then this is a non-optimal test case. In case there are other memory accesses between these two stores, gvn and dead store elimination is often not effective. Clearly, this is not very visible in this simple test case. |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | Ok |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | This covers a special situation occurring in Polybench's covariance/correlation (and typical in algorithms that cover symmetric matrices): for (int i = 0; i < n; i+=1) for (int j = 0; j <= i; j+=1) { double x = ...; C[i][j] = x; C[j][i] = x; } For i==j, the same value is written twice to the same element. Double writes to the same element are not allowed in DeLICM because its algorithm does not see which of the writes is effective. But if its the same value anyway, it doesn't matter. LLVM passes, however, cannot simplify this because the write is necessary for i != j (unless it would add a condition for one of the writes to occur only if i != j) |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | Maybe we could also add a reduced case from this, and put your comments to the reduced case? |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | Isn't forward_load_double_write.ll such a test case? |
test/ForwardOpTree/forward_load_double_write.ll | ||
---|---|---|
21–22 | I added the motivation for onlySameValueWrites() into its comment. |
[Nit] unrelated?