[PATCH] D30796: Only unswitch loops with uniform conditions

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 15:33:47 PST 2017


rampitec created this revision.
Herald added subscribers: nhaehnle, wdng, mzolotukhin, mehdi_amini, aemerson.

Loop unswitching can be extremely harmful for a SIMT target. In case
if hoisted condition is not uniform a SIMT machine will execute both
clones of a loop sequentially. Therefor LoopUnswitch checks if the
condition is non-divergent.

Since DivergenceAnalysis adds an expensive PostDominatorTree analysis
not needed for non-SIMT targets a new option is added to avoid unneded
analysis initialization. The method getAnalysisUsage is called when
TargetTransformInfo is not yet available and we cannot use it here.
For that reason a new field DivergentTarget is added to PassManagerBuilder
to control the behavior and set this field from a target.


Repository:
  rL LLVM

https://reviews.llvm.org/D30796

Files:
  include/llvm/Transforms/IPO/PassManagerBuilder.h
  include/llvm/Transforms/Scalar.h
  lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/LoopUnswitch.cpp
  test/Transforms/LoopUnswitch/AMDGPU/divergent-unswitch.ll
  test/Transforms/LoopUnswitch/AMDGPU/lit.local.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30796.91226.patch
Type: text/x-patch
Size: 9356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170309/0327ba5f/attachment.bin>


More information about the llvm-commits mailing list