[llvm-bugs] [Bug 49856] New: SCEV: Assertion `L && L->getHeader() == P->getParent()' failed in getRangeForUnknownRecurrence

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 6 00:13:16 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49856

            Bug ID: 49856
           Summary: SCEV: Assertion `L && L->getHeader() ==
                    P->getParent()' failed in getRangeForUnknownRecurrence
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: max.kazantsev at azul.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

The following test fails with opt -analyze -scalar-evolution:

target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"

define void @test() {
bb:
  br label %bb1

bb1:                                              ; preds = %bb
  br label %bb5

bb2:                                              ; preds = %bb2
  br label %bb2

bb3:                                              ; preds = %bb3
  br label %bb3

bb4:                                              ; preds = %bb4
  br label %bb4

bb5:                                              ; preds = %bb9, %bb1
  %tmp = phi i32 [ 2, %bb1 ], [ %tmp6, %bb9 ]
  %tmp6 = add nuw nsw i32 %tmp, 1
  %tmp7 = icmp ult i32 %tmp6, undef
  br i1 %tmp7, label %bb13, label %bb18

bb8:                                              ; preds = %bb8
  br label %bb8

bb9:                                              ; No predecessors!
  br label %bb5

bb10:                                             ; preds = %bb10
  br label %bb10

bb11:                                             ; preds = %bb11
  br label %bb11

bb12:                                             ; preds = %bb12
  br label %bb12

bb13:                                             ; preds = %bb5
  br label %bb14

bb14:                                             ; preds = %bb14, %bb13
  %tmp15 = phi i32 [ %tmp16, %bb14 ], [ undef, %bb13 ]
  %tmp16 = add nsw i32 %tmp15, 1
  %tmp17 = icmp sgt i32 %tmp16, 25
  br i1 %tmp17, label %bb19, label %bb14

bb18:                                             ; preds = %bb5
  unreachable

bb19:                                             ; preds = %bb14
  ret void
}

Offending patch:

commit ae7b1e8823a51068cfa64875fc5222e5b1d16760
Author: Philip Reames <listmail at philipreames.com>
Date:   Wed Mar 31 10:29:21 2021 -0700

    [SCEV] Handle unreachable binop when matching shift recurrence

    This fixes an issue introduced with my change d4648e, and reported in
pr49768.

    The root problem is that dominance collapses in unreachable code, and that
LoopInfo explicitly only models reachable code.  Since the recurrence matcher
doesn't filter by reachability (and can't easily because not all consumers have
domtree), we need to bailout before assuming that finding a recurrence implies
we found a loop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210406/acbaffe4/attachment.html>


More information about the llvm-bugs mailing list