[llvm] [HashRecognize] Fix compiler hang on dense use-def chain (PR #211711)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 24 03:08:12 PDT 2026
================
@@ -0,0 +1,171 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes='print<hash-recognize>' -disable-output %s 2>&1 | FileCheck %s
+
+; This loop hangs if digRecurrence doesn't keep track of previously visited
+; instructions since most instructions have multiple uses.
+define void @dense_use_def_chain() {
+; CHECK-LABEL: 'dense_use_def_chain'
+; CHECK-NEXT: Did not find a hash algorithm
+; CHECK-NEXT: Reason: Unable to find conditional recurrence
+;
+bbl:
+ %load = load i32, ptr null, align 4
+ %sitofp = sitofp i32 %load to float
+ br label %bbl1
+
+bbl1: ; preds = %bbl1, %bbl
+ %phi = phi i32 [ 0, %bbl ], [ %add, %bbl1 ]
+ %phi2 = phi float [ poison, %bbl ], [ %select144, %bbl1 ]
----------------
artagnon wrote:
```suggestion
%ind = phi float [ 0.0, %bbl ], [ %ind.next, %bbl1 ]
```
https://github.com/llvm/llvm-project/pull/211711
More information about the llvm-commits
mailing list