[all-commits] [llvm/llvm-project] 5534d1: [CSE] Precommit an AMDGPU test case for D149348

Jay Foad via All-commits all-commits at lists.llvm.org
Fri Apr 28 06:57:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5534d1d834c25ec6a3755a44b46e2489b7d0ccf9
      https://github.com/llvm/llvm-project/commit/5534d1d834c25ec6a3755a44b46e2489b7d0ccf9
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2023-04-28 (Fri, 28 Apr 2023)

  Changed paths:
    A llvm/test/CodeGen/AMDGPU/cse-convergent.ll

  Log Message:
  -----------
  [CSE] Precommit an AMDGPU test case for D149348

Differential Revision: https://reviews.llvm.org/D149349


  Commit: 56af0e913ce7ec29690cc7295d75fc5573153bbf
      https://github.com/llvm/llvm-project/commit/56af0e913ce7ec29690cc7295d75fc5573153bbf
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2023-04-28 (Fri, 28 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/EarlyCSE.cpp
    M llvm/test/CodeGen/AMDGPU/cse-convergent.ll

  Log Message:
  -----------
  [EarlyCSE] Do not CSE convergent calls in different basic blocks

"convergent" is documented as meaning that the call cannot be made
control-dependent on more values, but in practice we also require that
it cannot be made control-dependent on fewer values, e.g. it cannot be
hoisted out of the body of an "if" statement.

In code like this, if we allow CSE to combine the two calls:

  x = convergent_call();
  if (cond) {
    y = convergent_call();
    use y;
  }

then we get this:

  x = convergent_call();
  if (cond) {
    use x;
  }

This is conceptually equivalent to moving the second call out of the
body of the "if", up to the location of the first call, so it should be
disallowed.

Differential Revision: https://reviews.llvm.org/D149348


Compare: https://github.com/llvm/llvm-project/compare/036371debe20...56af0e913ce7


More information about the All-commits mailing list