[PATCH] D158014: [LLVM][Uniformity] Remove assert thrown on some irreducible control flow
Sameer Sahasrabuddhe via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 16 02:59:32 PDT 2023
sameerds requested changes to this revision.
sameerds added inline comments.
This revision now requires changes to proceed.
================
Comment at: llvm/include/llvm/ADT/GenericUniformityImpl.h:950
if (Cycle->isReducible()) {
- assert(Cycle->getHeader() == JoinBlock);
return nullptr;
----------------
We shouldn't remove the assert. Instead, this whole "if block" should be moved after the while loop below.
The reasoning is like this: When divergent paths enter an irreducible cycle, we assume that everything inside the cycle is divergent. But the way ModifiedPO works, every block inside the cycle gets marked as a join block. This is okay, because the exits get labelled as themselves which allows the traversal to find actual joins outside (or beyond) the cycle.
So when we want to check a join block inside a cycle C relative to a divergent branch outside of C, we should first check if there is an irreducible parent of C that does not contain the branch. If there is such a parent, then whether C is reducible is not relevant. If there is no irreducible parent, then we can check if C is reducible.
Returning early like the current code, by just checking the parent cycle looks like a bug because it fails to return the irreducible parent as the "cycle made divergent". But other join blocks in the irreducible parent will cause it to be eventually reported, so it's okay.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158014/new/
https://reviews.llvm.org/D158014
More information about the llvm-commits
mailing list