[PATCH] D12975: [Polly] De-LICM (WIP)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 09:52:17 PDT 2015


Meinersbur updated this revision to Diff 35518.
Meinersbur added a comment.

WIP update:

Implemented CodeGeneration part and inter alia.

"De-LICM" tries to map emulated scalar to an array element that is not used because it will be overwritten unconditionally (no-use zone). BBs will read and write to this mapped location instead of space from a dedicated Alloca. Array element locations are represented using the StoreInst that writes to this. For this reason De-LICM of LoadInst-only zones are currently unsupported.

BBs are modeled s.t. the array elements are loaded into scalars before its instructions and written back after them if the value is modified. This is to avoid to track live values within basic blocks. Live values are tracked between BBs. Two scalars conflict (cannot be mapped to the same array element) if they would write different scalars at the end of the block. The algorithm is greedy, i.e. values that are first encountered to not conflict with any other previously mapped lifetimes are used.

Afterwards memory accesses are created unless they are identified to be redundant. Reads are created on-the-fly while mapped writes are added at the end. As a result, explicit LoadInst/StoreInst in the BB may have no corresponding MemoryAccess.

Dirty code-disclaimer: auto declarations, unused variables, outcommented or dead code, implementations in header file, incomplete merge with r247928 (Multi-dimensional accesses with bitcasts), ignored options, 64 failed unit tests (of which 3 are crashes), etc to be corrected.

Some changes could be committed separately:

- There is a map that stores whether there is already a MemoryAccess for a given scalar to avoid adding redundant accesses.
- Explicit MemoryAccess types (AccessOrigin in the code): Explicit (from LoadInst/StoreInst), Scalar (.s2a) and PHI (.phiops)
- Dedicated addMemoryAccess-equivalents for each of the types.

Intended but not yet implemented:

- Have separate lists of MemoryAccesses for leading reloads and trailing stores of scalars. Would restore the 1-to-1 relationship of instructions and explicit MemoryAccesses.
- Remove printing of former TempScopInfo's IRAccesses and change the test cases to check of output of scop->dump() instead.


http://reviews.llvm.org/D12975

Files:
  CMakeLists.txt
  include/polly/CodeGen/BlockGenerators.h
  include/polly/ScopInfo.h
  lib/Analysis/ScopInfo.cpp
  lib/CodeGen/BlockGenerators.cpp
  test/Isl/CodeGen/doubleacc.ll
  test/ScopInfo/licm_reduction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12975.35518.patch
Type: text/x-patch
Size: 77914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150923/e7da0a36/attachment.bin>


More information about the llvm-commits mailing list