Changes

Summary

  1. [Polly] Remove isConstCall. (details)
  2. [Polly] Use VirtualUse to determine references. (details)
  3. [Polly] Support for InlineAsm. (details)
Commit 1cea25eec90e355c9b072edc1b6e1e9903d7bca4 by llvm-project
[Polly] Remove isConstCall.

The function was intended to catch OpenMP functions such as
get_thread_id(). If matched, the call would be considered synthesizable.

There were a few problems with this:

* get_thread_id() is not 'const' in the sense of have the gcc manual
   defines it: "do not examine any values except their arguments".
   get_thread_id() reads OpenCL runtime libreary global state.
   What was inteded was probably 'speculable'.

* isConstCall was implemented using mayReadOrWriteMemory(). 'const' is
   stricter than that, mayReadOrWriteMemory is e.g. true for malloc(),
   since it may only read/write addresses that are considered
   inaccessible fro the application. However, malloc is certainly not
   speculable.

* Values that are isConstCall were not handled consistently throughout
   Polly. In particular, it was not considered for referenced values
   (OpenMP outlining and PollyACC).

Fix by removing special handling for isConstCall entirely.
The file was removedpolly/test/ScopInfo/constant_functions_multi_dim.ll
The file was removedpolly/test/ScopInfo/constant_functions_as_unknowns.ll
The file was modifiedpolly/lib/Analysis/ScopInfo.cpp
The file was modifiedpolly/lib/Support/SCEVValidator.cpp
The file was modifiedpolly/include/polly/Support/SCEVValidator.h
The file was modifiedpolly/lib/Analysis/ScopDetection.cpp
Commit d5c87162db7763c89160dc66894bebf3bd1e90d7 by llvm-project
[Polly] Use VirtualUse to determine references.

VirtualUse ensures consistency over different source of values with
Polly. In particular, this enables its use of instructions moved between
Statement. Before the patch, the code wrongly assumed that the BB's
instructions are also the ScopStmt's instructions. Reference are
determined for OpenMP outlining and GPGPU kernel extraction.

GPGPU CodeGen had some problems. For one, it generated GPU kernel
parameters for constants. Second, it emitted GPU-side invariant loads
which have already been loaded by the host. This has been partially
fixed, it still generates a store for the invariant load result, but
using the value that the host has already written.

WARNING: I did not test the generated PollyACC code on an actual GPU.

The improved consistency will be made use of in the next patch.
The file was modifiedpolly/test/GPGPU/invariant-load-of-scalar.ll
The file was modifiedpolly/lib/CodeGen/IslNodeBuilder.cpp
The file was modifiedpolly/include/polly/CodeGen/IslNodeBuilder.h
The file was modifiedpolly/test/GPGPU/phi-nodes-in-kernel.ll
The file was modifiedpolly/test/GPGPU/invariant-load-hoisting-read-in-kernel.ll
Commit 9820dd970c1b72c7f77fad647b762053e2f60e31 by llvm-project
[Polly] Support for InlineAsm.

Inline assembly was not handled at all and treated like a llvm::Value.
In particular, it tried to create a pointer it which is not allowed.

Fix by handling like a llvm::Constant such that it is just reused when
required, instead of trying to marshall it in memory.

Fixes llvm.org/PR51960
The file was addedpolly/test/CodeGen/OpenMP/inlineasm.ll
The file was modifiedpolly/lib/Support/VirtualInstruction.cpp