[PATCH] D158014: [LLVM][Uniformity] Remove assert thrown on some irreducible control flow

Alex MacLean via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 12:40:37 PDT 2023


AlexM created this revision.
Herald added subscribers: mattd, gchakrabarti, asavonic.
Herald added a project: All.
AlexM updated this revision to Diff 550435.
AlexM added a comment.
AlexM added a reviewer: sameerds.
AlexM published this revision for review.
Herald added subscribers: llvm-commits, jholewinski.
Herald added a project: LLVM.

cleanup test case


As the test case demonstrates, it is possible for a block to be identified
as a join point while not being the header of a reducible cycle. Removing the
assert seems to be fine since in this case the analysis performs well even when
it is false, but perhaps the algorithm to identify join blocks must be updated.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158014

Files:
  llvm/include/llvm/ADT/GenericUniformityImpl.h
  llvm/test/Analysis/UniformityAnalysis/NVPTX/non-header-join.ll


Index: llvm/test/Analysis/UniformityAnalysis/NVPTX/non-header-join.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/UniformityAnalysis/NVPTX/non-header-join.ll
@@ -0,0 +1,24 @@
+; RUN: opt %s -passes='print<uniformity>' -disable-output 2>&1 | FileCheck %s
+
+target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
+target triple = "nvptx64-nvidia-cuda"
+
+; CHECK: CYCLES ASSSUMED DIVERGENT:
+; CHECK-NEXT: depth=1: entries(if.end16 for.cond1) for.body4
+
+define void @foo(i1 %b) {
+entry:
+  br i1 %b, label %if.then, label %if.end16
+
+if.then:                                          ; preds = %entry
+  br label %for.cond1
+
+for.cond1:                                        ; preds = %if.end16, %for.body4, %if.then
+  br i1 false, label %for.body4, label %if.end16
+
+for.body4:                                        ; preds = %for.cond1
+  br label %for.cond1
+
+if.end16:                                         ; preds = %for.cond1, %entry
+  br label %for.cond1
+}
Index: llvm/include/llvm/ADT/GenericUniformityImpl.h
===================================================================
--- llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -947,7 +947,6 @@
     return nullptr;
 
   if (Cycle->isReducible()) {
-    assert(Cycle->getHeader() == JoinBlock);
     return nullptr;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158014.550435.patch
Type: text/x-patch
Size: 1407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230815/82bded43/attachment.bin>


More information about the llvm-commits mailing list