[PATCH] D36425: [ZoneAlgo] Allow two writes that write identical values into same array slot

Hongbin Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 00:15:05 PDT 2017

etherzhhb added inline comments.

Comment at: test/ForwardOpTree/forward_load_double_write.ll:21-22
+      %A_idx = getelementptr inbounds double, double* %A, i32 %j
+      store double %val, double* %A_idx
+      store double %val, double* %A_idx
+      br label %inc
Meinersbur wrote:
> etherzhhb wrote:
> > grosser wrote:
> > > etherzhhb wrote:
> > > > etherzhhb wrote:
> > > > > Isn't this could be "canonicalized" by gvn?
> > > > or dead store elimination
> > > 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.
> > Ok
> 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`)
Maybe we could also add a reduced case from this, and put your comments to the reduced case?


More information about the llvm-commits mailing list