[all-commits] [llvm/llvm-project] 1cea25: [Polly] Remove isConstCall.

Michael Kruse via All-commits all-commits at lists.llvm.org
Sun Sep 26 01:32:21 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1cea25eec90e355c9b072edc1b6e1e9903d7bca4
      https://github.com/llvm/llvm-project/commit/1cea25eec90e355c9b072edc1b6e1e9903d7bca4
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2021-09-26 (Sun, 26 Sep 2021)

  Changed paths:
    M polly/include/polly/Support/SCEVValidator.h
    M polly/lib/Analysis/ScopDetection.cpp
    M polly/lib/Analysis/ScopInfo.cpp
    M polly/lib/Support/SCEVValidator.cpp
    R polly/test/ScopInfo/constant_functions_as_unknowns.ll
    R polly/test/ScopInfo/constant_functions_multi_dim.ll

  Log Message:
  -----------
  [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.


  Commit: d5c87162db7763c89160dc66894bebf3bd1e90d7
      https://github.com/llvm/llvm-project/commit/d5c87162db7763c89160dc66894bebf3bd1e90d7
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2021-09-26 (Sun, 26 Sep 2021)

  Changed paths:
    M polly/include/polly/CodeGen/IslNodeBuilder.h
    M polly/lib/CodeGen/IslNodeBuilder.cpp
    M polly/test/GPGPU/invariant-load-hoisting-read-in-kernel.ll
    M polly/test/GPGPU/invariant-load-of-scalar.ll
    M polly/test/GPGPU/phi-nodes-in-kernel.ll

  Log Message:
  -----------
  [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.


  Commit: 9820dd970c1b72c7f77fad647b762053e2f60e31
      https://github.com/llvm/llvm-project/commit/9820dd970c1b72c7f77fad647b762053e2f60e31
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2021-09-26 (Sun, 26 Sep 2021)

  Changed paths:
    M polly/lib/Support/VirtualInstruction.cpp
    A polly/test/CodeGen/OpenMP/inlineasm.ll

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/e21b0ba8c937...9820dd970c1b


More information about the All-commits mailing list