PHI nodes not grouped at top of basic block
- Dominant language
- LLVM
- Stars
- 1.7k
- Forks
- 188
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 22
Description
https://tinyurl.com/24tvv237
```llvm
define double @outer(ptr %0) {
call void @loops(ptr %0, i1 false)
ret double 0.000000e+00
}
define void @leaf(i32 %0) {
store double 0.000000e+00, ptr null, align 8
ret void
}
define void @loops(ptr %0, i1 %1) {
%3 = load i32, ptr %0, align 4
br label %4
4: ; preds = %8, %2
%5 = phi i32 [ %10, %8 ], [ %3, %2 ]
%6 = phi i32 [ %5, %8 ], [ 0, %2 ]
%7 = phi i32 [ %9, %8 ], [ 0, %2 ]
br i1 %1, label %8, label %11
8: ; preds = %11, %4
%9 = phi i32 [ %3, %11 ], [ %7, %4 ]
%10 = add i32 %5, 1
br label %4
11: ; preds = %4
call void @leaf(i32 %7)
call void @leaf(i32 %6)
br label %8
}
define double @entry() {
%1 = tail call double (...) @__enzyme_autodiff(ptr @outer, ptr null, ptr null)
ret double %1
}
declare double @__enzyme_autodiff(...)
```
`opt input.ll -load-pass-plugin=enzyme.so -passes=enzyme -enzyme-loose-types=1 -enzyme-strict-aliasing=0`
@wsmoses another repetition of this error.
Contributor guide
Research direction
Save the shown LLVM IR as input.ll, reproduce the failure with the provided opt command, and capture the diagnostic. Then trace Enzyme's PHI and basic-block handling to determine why the PHI nodes are not grouped at the block start; done means this reproducer no longer emits the reported error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100