[all-commits] [llvm/llvm-project] 07a5b8: SelectionDAG: Fix bug in ClusterNeighboringLoads

Nicolai Hähnle via All-commits all-commits at lists.llvm.org
Wed Feb 12 00:13:37 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 07a5b849f7bcd4b99080298e93d05651aaaf4dcb
      https://github.com/llvm/llvm-project/commit/07a5b849f7bcd4b99080298e93d05651aaaf4dcb
  Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
    A llvm/test/CodeGen/AMDGPU/bug-sdag-scheduler-cycle.ll

  Log Message:
  -----------
  SelectionDAG: Fix bug in ClusterNeighboringLoads

Summary:
The method attempts to find loads that can be legally clustered by
looking for loads consuming the same chain glue token.

However, the old code looks at _all_ users of values produced by the
chain node -- including uses of the loaded/returned value of volatile
loads or atomics. This could lead to circular dependencies which then
failed during scheduling.

With this change, we filter out users by getResNo, i.e. by which
SDValue value they use, to ensure that we only look at users of the
chain glue token.

This appears to be a rather old bug, which is perhaps surprising.
However, the test case is actually quite fragile (i.e., it is hidden
by fairly small changes), and the test _must_ use volatile loads for
the bug to manifest.

Reviewers: arsenm, bogner, craig.topper, foad

Subscribers: MatzeB, jvesely, wdng, hiraditya, javed.absar, jfb, kerbowa, llvm-commits

Tags: #llvm

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


  Commit: ab2f610f3855b388c46b78be452a49ee491a3951
      https://github.com/llvm/llvm-project/commit/ab2f610f3855b388c46b78be452a49ee491a3951
  Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
  Date:   2020-02-12 (Wed, 12 Feb 2020)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
    M llvm/test/Analysis/DivergenceAnalysis/AMDGPU/intrinsics.ll

  Log Message:
  -----------
  AMDGPU: llvm.amdgcn.writelane is a source of divergence

Summary:
Consider:

  %r = call i32 @llvm.amdgcn.writelane(i32 0, i32 1, i32 2)

This produces a value that is 0 on lane 1, and 2 everywhere else; i.e.,
it is divergent.

Reported-by: Marek Olsak <Marek.Olsak at amd.com>

Reviewers: arsenm, foad, mareko

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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


Compare: https://github.com/llvm/llvm-project/compare/572fc8974277...ab2f610f3855


More information about the All-commits mailing list