llvm / llvm/llvm-project

[opt] -passes=rewrite-statepoints-for-gc causes Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"'

Open
#179,878 2 comments 0 reactions 1 assignee Claimed by @SakshamSinghal20 View on GitHub
backend:X86 crash
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Reproducer: https://godbolt.org/z/hT5ev9d7a

```
opt: /root/llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From*) [with To = llvm::InvokeInst; From = llvm::CallBase]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S --passes=module(rewrite-statepoints-for-gc)
1. Running pass "rewrite-statepoints-for-gc" on module ""
#0 0x0000000005aefe98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5aefe98)
#1 0x0000000005aecd74 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000078b184e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000078b184e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000078b184e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000078b184e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000078b184e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000078b184e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x000000000490ac5c makeStatepointExplicitImpl(llvm::CallBase*, llvm::SmallVectorImpl const&, llvm::SmallVectorImpl const&, (anonymous namespace)::PartiallyConstructedSafepointRecord&, std::vector<(anonymous namespace)::DeferredReplacement, std::allocator<(anonymous namespace)::DeferredReplacement>>&, llvm::MapVector, llvm::detail::DenseMapPair>, llvm::SmallVector, 0u>> const&, llvm::GCStrategy*) (.isra.0) RewriteStatepointsForGC.cpp:0:0
#9 0x000000000491a3a4 insertParsePoints(llvm::Function&, llvm::DominatorTree&, llvm::TargetTransformInfo&, llvm::SmallVectorImpl&, llvm::MapVector, llvm::detail::DenseMapPair>, llvm::SmallVector, 0u>>&, llvm::MapVector, llvm::detail::DenseMapPair>, llvm::SmallVector, 0u>>&) RewriteStatepointsForGC.cpp:0:0
#10 0x000000000491b953 llvm::RewriteStatepointsForGC::runOnFunction(llvm::Function&, llvm::DominatorTree&, llvm::TargetTransformInfo&, llvm::TargetLibraryInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x491b953)
#11 0x000000000491c952 llvm::RewriteStatepointsForGC::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x491c952)
#12 0x00000000030585de llvm::detail::PassModel>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x30585de)
#13 0x000000000585e411 llvm::PassManager>::run(llvm::Module&, llvm::AnalysisManager&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x585e411)
#14 0x0000000000971fba llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef, llvm::ArrayRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x971fba)
#15 0x0000000000966068 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x966068)
#16 0x000078b184e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#17 0x000078b184e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#18 0x000000000095cce5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x95cce5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.