Issue |
127996
|
Summary |
Scalarizer min-bits option crashes on intrinsics with multiple results
|
Labels |
crash-on-valid,
llvm:transforms
|
Assignees |
|
Reporter |
jayfoad
|
In some cases the scalarizer pass's `min-bits` option crashes when operating on intrinsic calls with multiple results like `llvm.frexp` or `llvm.uadd.with.overflow`. For example if I add `RUN` lines to these tests:
```diff
diff --git a/llvm/test/Transforms/Scalarizer/frexp.ll b/llvm/test/Transforms/Scalarizer/frexp.ll
index 6397832f6648..62cf54290ec2 100644
--- a/llvm/test/Transforms/Scalarizer/frexp.ll
+++ b/llvm/test/Transforms/Scalarizer/frexp.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt %s -passes='function(scalarizer)' -S | FileCheck %s
+; RUN: opt %s -passes='function(scalarizer<min-bits=64>)' -S | FileCheck %s
define void @test_vector_frexp_void(<2 x double> noundef %d) {
; CHECK-LABEL: define void @test_vector_frexp_void(
diff --git a/llvm/test/Transforms/Scalarizer/uadd_with_overflow.ll b/llvm/test/Transforms/Scalarizer/uadd_with_overflow.ll
index 1c4b6124b00b..62426ce9776b 100644
--- a/llvm/test/Transforms/Scalarizer/uadd_with_overflow.ll
+++ b/llvm/test/Transforms/Scalarizer/uadd_with_overflow.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt %s -passes="function(scalarizer)" -S | FileCheck %s
+; RUN: opt %s -passes="function(scalarizer<min-bits=32>)" -S | FileCheck %s
define <3 x i32> @test_(<3 x i32> %a, <3 x i32> %b) {
; CHECK-LABEL: define <3 x i32> @test_(
```
then they both fail with:
```
opt: include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = llvm::VectorType, From = llvm::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: bin/opt test/Transforms/Scalarizer/uadd_with_overflow.ll -passes=function(scalarizer<min-bits=32>) -S
1. Running pass "function(scalarizer)" on module "test/Transforms/Scalarizer/uadd_with_overflow.ll"
2. Running pass "scalarizer" on function "test_"
#0 0x000000000408b0c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (bin/opt+0x408b0c8)
#1 0x0000000004088bfe llvm::sys::RunSignalHandlers() (bin/opt+0x4088bfe)
#2 0x000000000408b8f1 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007efa3a845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007efa3a89eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007efa3a89eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x00007efa3a89eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x00007efa3a84527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007efa3a8288ff abort ./stdlib/abort.c:81:7
#9 0x00007efa3a82881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007efa3a83b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#11 0x00000000041a61ea (bin/opt+0x41a61ea)
#12 0x0000000004a0edc4 (anonymous namespace)::Scatterer::operator[](unsigned int) Scalarizer.cpp:0:0
#13 0x0000000004a0b112 (anonymous namespace)::ScalarizerVisitor::visit(llvm::Function&) Scalarizer.cpp:0:0
#14 0x0000000004a063e9 llvm::ScalarizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (bin/opt+0x4a063e9)
#15 0x0000000005ce9aad llvm::detail::PassModel<llvm::Function, llvm::ScalarizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilder.cpp:0:0
#16 0x000000000429c417 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (bin/opt+0x429c417)
#17 0x000000000549894d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
#18 0x00000000042a0e21 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (bin/opt+0x42a0e21)
#19 0x000000000548f17d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilderPipelines.cpp:0:0
#20 0x000000000429b1d7 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (bin/opt+0x429b1d7)
#21 0x00000000054338a7 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (bin/opt+0x54338a7)
#22 0x0000000004052e02 optMain (bin/opt+0x4052e02)
#23 0x00007efa3a82a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#24 0x00007efa3a82a28b call_init ./csu/../csu/libc-start.c:128:20
#25 0x00007efa3a82a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#26 0x000000000404cae5 _start (bin/opt+0x404cae5)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs