[PATCH] D96754: [NewPM] Use stale divergence analysis with SimpleLoopUnswitch

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 15 23:57:36 PST 2021


sameerds created this revision.
Herald added subscribers: dexonsmith, kerbowa, hiraditya, kristof.beyls, nhaehnle, jvesely.
sameerds requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This fixes bug 48819.

Loop unswitching on divergent conditions is harmful for
performance. The LoopUnswitch pass depends on LegacyDivergenceAnalysis
to avoid this, but the state of divergence analysis may be
stale (neither preserved nor invalidated) due to previous loop passes.

The new pass manager provides SimpleLoopUnswitch which currently does
not skip divergent branches. Loop passes can request function analysis
results from an "outer proxy" analysis manager, but only if such
results are never invalidated. This change introduces another method
to request an analysis from the outer proxy even if it is stale. This
is sufficient for the current use-case, where it is not necessary to
update the divergence analysis after every loop pass, and the existing
stale result is still safely useable. The effect is equivalent to the
use of divergence analysis by LoopUnswitch in the legacy pass manager.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96754

Files:
  llvm/include/llvm/IR/PassManager.h
  llvm/lib/Transforms/Scalar/LoopPassManager.cpp
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/test/Transforms/LoopUnswitch/AMDGPU/divergent-unswitch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96754.323895.patch
Type: text/x-patch
Size: 7404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210216/fb9c6edf/attachment.bin>


More information about the llvm-commits mailing list