Skip to content

PHI nodes not grouped at top of basic block #3029

Description

@ZuseZ4

https://tinyurl.com/24tvv237

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions