Skip to content

opt crashes on ghc-generated IR #57393

@matoro

Description

@matoro

Compiling the following Haskell from the Happy test suite using GHC 9.0.2: issue93.a.hs.gz

using the command line: ghc -fllvm -Wall -Werror -fforce-recomp issue93.a.hs -o issue93.a.bin

generates the following IR: ghc_4.ll.gz

GHC then invokes opt, with the following command line: opt -mem2reg -globalopt -lower-expect -enable-tbaa -tbaa -relocation-model=pic ghc_4.ll -o ghc_6.bc

which crashes when processing the IR with the following traceback: 3TTJHXQYK.txt

Tested using opt from LLVM 13.0.1, 14.0.6, and git master, on amd64, arm64, and ppc64le. Same traceback on all versions and arches. The specific traceback above is from git master. Fully reproducible from what I can tell.

I tried to minimize the IR, first using bugpoint. Unfortunately bugpoint itself segfaults, with the exact same traceback as opt. I then tried using llvm-reduce, but it also segfaults after three passes, and the slightly reduced IR it leaves behind is not valid, and can't be processed by opt.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions