[PATCH] D32667: [Polly] Introduce VirtualUse. NFC.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 17:21:51 PDT 2017


Meinersbur created this revision.
Meinersbur added a project: Polly.
Herald added subscribers: mgorny, sanjoy.

If a ScopStmt references a (scalar) value, there are multiple possibilities where this value can come. The decision about what kind of use it is must be handled consistently at different places, which can be error-prone. VirtualUse is meant to centralize the handling of the different types of value uses.

This patch makes ScopBuilder and CodeGeneration use VirtualUse. This already helps to show inconsistencies with the value handling. In order to keep this patch NFC, exceptions to the general rules are added. These might be fixed later if they turn to problems. Overall, this should result in fewer post-codegen IR-verification errors, but instead assertion failures in `getNewValue` that are closer to the actual error.

The "virtual" in VirtualUse/VirtualInstructions.h might be a misnomer as it currently has little to do with virtualizing instructions. I am open for other naming suggestions. The `Virtual` argument of `VirtualUse::create` is used to check the consistency of created `MemoryAccess`es, by the `verifyUses` function. The original intent to have `Virtual` in the name was that SCoP postprocessing-passes modify the accesses such that instructions are moved between `ScopStmt`s. In order this to work, the BB an instruction resides in is less important.

For improving compile-time, caching the result of `VirtualUse::create` could be a possibility.

I started with using `VirtualUse` only for assertions. This unfortunately proved to be difficult as `getNewValue` as multiple returns and complete coverage.

Even if this is not committed, the study of inconsistencies of `getNewValue` could be useful.


https://reviews.llvm.org/D32667

Files:
  include/polly/Support/VirtualInstruction.h
  lib/Analysis/ScopBuilder.cpp
  lib/CMakeLists.txt
  lib/CodeGen/BlockGenerators.cpp
  lib/Support/VirtualInstruction.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32667.97175.patch
Type: text/x-patch
Size: 23673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170429/543b55c1/attachment.bin>


More information about the llvm-commits mailing list