[LLVM][Uniformity] Propagate temporal divergence explicitly
authorSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>
Mon, 15 May 2023 11:36:06 +0000 (17:06 +0530)
committerSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>
Mon, 15 May 2023 14:47:43 +0000 (20:17 +0530)
commitb0f0dd2554c726e5192ad8c98fb7a2f08c37994c
tree1806fd3fce3fab489729d763bc1c3ec8f00f175a
parent8c3a8d17c8a154894895c48a304a04df9ece4328
[LLVM][Uniformity] Propagate temporal divergence explicitly

At a cycle C with divergent exits, UA was using a naive traversal of the exiting
edges to locate blocks that may use values defined inside C. But this traversal
fails when it encounters a cycle. This is now replaced with a much simpler
propagation that iterates over every instruction in C and checks any uses that
are outside C. But such an iteration can be expensive when C is very large; the
original strategy may need to be reconsidered if there is a regression in
compilation times.

Also fixed lit tests that should have originally caught the missed propagation
of temporal divergence.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D149646
llvm/include/llvm/ADT/GenericUniformityImpl.h
llvm/lib/Analysis/UniformityAnalysis.cpp
llvm/lib/CodeGen/MachineUniformityAnalysis.cpp
llvm/test/Analysis/UniformityAnalysis/AMDGPU/temporal_diverge.ll