This is an archive of the discontinued LLVM Phabricator instance.

[Polly][Simplify] Rewrite redundant write detection algorithm.
ClosedPublic

Authored by Meinersbur on Aug 1 2017, 4:12 AM.

Details

Summary

The previous algorithm was to search a writes and the sours of its value operand, and see whether the write just stores the same read value back, which includes a search whether there is another write access between them. This is O(n^2) in the max number of accesses in a statement (+ the complexity of isl comparing the access functions).

The new algorithm is more similar to the one used for searching for overwrites and coalescable writes. It scans over all accesses in order of execution while tracking which array elements still have the same value since it was read. This is O(n), not counting the complexity within isl. It should be more reliable than trying to catch all non-conforming cases in the previous approach. It is also less code.

We now also support if the write is a partial write of the read's subset, and to some extent non-affine subregions.

Diff Detail

Repository
rL LLVM

Event Timeline

Meinersbur created this revision.Aug 1 2017, 4:12 AM
grosser accepted this revision.Aug 1 2017, 4:17 AM

LGTM.

test/Simplify/notredundant_region_loop.ll
3 ↗(On Diff #109072)

THE store

This revision is now accepted and ready to land.Aug 1 2017, 4:17 AM
Meinersbur updated this revision to Diff 109080.Aug 1 2017, 4:25 AM
  • Rename GuaranteedReads to Known
  • Remove whitespace at end of lines
Meinersbur edited the summary of this revision. (Show Details)Aug 1 2017, 4:29 AM
This revision was automatically updated to reflect the committed changes.