[llvm-bugs] [Bug 49606] New: opt crashes with "opt -O1 -attributor-enable=cgscc": Assertion `Header.isValid()' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 16 10:41:19 PDT 2021


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

            Bug ID: 49606
           Summary: opt crashes with "opt -O1 -attributor-enable=cgscc":
                    Assertion `Header.isValid()' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: zequanwu at google.com
                CC: llvm-bugs at lists.llvm.org

reduced.ll:
source_filename = "reduced.ll"
target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%0 = type { i32, %1, %2* }
%1 = type { i32 }
%2 = type opaque

define hidden %0* @f1(i64 %0, i64 %1) {
  %3 = call { %0*, i64 } @f3(i64 %0)
  ret %0* undef
}

define linkonce_odr hidden { %0*, i64 } @f3(i64 %0) align 2 {
  %2 = call i32 @f4()
  %3 = zext i32 %2 to i64
  call void @f5(i64 %3, i64 %0)
  ret { %0*, i64 } undef
}

define linkonce_odr hidden i32 @f4() align 2 {
  ret i32 16
}

define internal void @f5(i64 %0, i64 %1) {
  br label %3

3:                                                ; preds = %6, %2
  call void @f6(i64 %0)
  %4 = icmp sgt i64 %1, %0
  br i1 %4, label %5, label %6

5:                                                ; preds = %3
  ret void

6:                                                ; preds = %3
  call void @f5(i64 %0, i64 %1)
  br label %3
}

define internal void @f6(i64 %0) {
  %2 = icmp sgt i64 %0, 0
  br i1 %2, label %3, label %4

3:                                                ; preds = %1
  call void @llvm.trap()
  ret void

4:                                                ; preds = %1
  ret void
}

; Function Attrs: cold noreturn nounwind
declare void @llvm.trap() #0

attributes #0 = { cold noreturn nounwind }

The crash shows up on release build with assertion, but not on debug build.

-- 
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/20210316/1b843943/attachment.html>


More information about the llvm-bugs mailing list