Issue |
150479
|
Summary |
[SLPVectorizer] Assertion `valid() && "InstructionsState is invalid."' failed.
|
Labels |
llvm:SLPVectorizer,
crash-on-valid,
generated by fuzzer
|
Assignees |
|
Reporter |
dtcxzyw
|
Reproducer: https://godbolt.org/z/Pj96ao9TK
```
; bin/opt -passes=slp-vectorizer test.ll -S
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@g = global [128 x i8] zeroinitializer, align 16
define i64 @main() {
entry:
%0 = load i64, ptr @g, align 8
br label %func_154.exit.func_146.exit_crit_edge.i
func_154.exit.func_146.exit_crit_edge.i: ; preds = %entry
%1 = load i64, ptr getelementptr inbounds nuw (i8, ptr @g, i64 80), align 16
%2 = load i64, ptr getelementptr inbounds nuw (i8, ptr @g, i64 88), align 8
%3 = load i64, ptr getelementptr inbounds nuw (i8, ptr @g, i64 32), align 16
%4 = load i64, ptr @g, align 16
%5 = load i64, ptr getelementptr inbounds nuw (i8, ptr @g, i64 8), align 8
%6 = load i64, ptr @g, align 16
%7 = load i64, ptr getelementptr inbounds nuw (i8, ptr @g, i64 24), align 8
%8 = xor i64 %1, %2
%9 = xor i64 %8, %3
%10 = xor i64 %9, %4
%11 = xor i64 %10, %5
%12 = xor i64 %11, %6
%13 = xor i64 %12, %7
%14 = xor i64 %13, %0
ret i64 %14
}
```
```
opt: /root/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1204: llvm::Instruction* {anonymous}::InstructionsState::getMainOp() const: Assertion `valid() && "InstructionsState is invalid."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer <source>
1. Running pass "function(slp-vectorizer)" on module "<source>"
2. Running pass "slp-vectorizer" on function "main"
#0 0x0000000005664458 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5664458)
#1 0x0000000005661304 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000075a3c1242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000075a3c12969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000075a3c1242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000075a3c12287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000075a3c122871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000075a3c1239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000034a0043 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x34a0043)
#9 0x0000000003513355 llvm::slpvectorizer::BoUpSLP::getLastInstructionInBundle(llvm::slpvectorizer::BoUpSLP::TreeEntry const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3513355)
#10 0x000000000355424e llvm::slpvectorizer::BoUpSLP::isGatherShuffledSingleRegisterEntry(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::MutableArrayRef<int>, llvm::SmallVectorImpl<llvm::slpvectorizer::BoUpSLP::TreeEntry const*>&, unsigned int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x355424e)
#11 0x0000000003558408 llvm::slpvectorizer::BoUpSLP::isGatherShuffledEntry(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallVectorImpl<int>&, llvm::SmallVectorImpl<llvm::SmallVector<llvm::slpvectorizer::BoUpSLP::TreeEntry const*, 6u>>&, unsigned int, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3558408)
#12 0x000000000355a2de llvm::InstructionCost llvm::slpvectorizer::BoUpSLP::processBuildVector<llvm::slpvectorizer::BoUpSLP::ShuffleCostEstimator, llvm::InstructionCost, llvm::TargetTransformInfo, llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP, llvm::SmallPtrSetImpl<llvm::Value*>>(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::Type*, llvm::TargetTransformInfo&, llvm::ArrayRef<llvm::Value*>&, llvm::slpvectorizer::BoUpSLP&, llvm::SmallPtrSetImpl<llvm::Value*>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x355a2de)
#13 0x000000000355c98f llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x355c98f)
#14 0x000000000359597f llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>, llvm::InstructionCost) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x359597f)
#15 0x000000000359ba1b (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::DataLayout const&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&, llvm::AssumptionCache*) SLPVectorizer.cpp:0:0
#16 0x000000000359ef90 llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x359ef90)
#17 0x00000000035a430b llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (.constprop.0) SLPVectorizer.cpp:0:0
#18 0x00000000035a8c0f llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x35a8c0f)
#19 0x00000000035aef06 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0
#20 0x00000000035af9eb llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x35af9eb)
#21 0x0000000002dab8ce llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2dab8ce)
#22 0x0000000005456241 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5456241)
#23 0x0000000000eb675e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xeb675e)
#24 0x0000000005456714 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5456714)
#25 0x0000000000eb6a2e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xeb6a2e)
#26 0x00000000054542e1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x54542e1)
#27 0x0000000000964bfa 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) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x964bfa)
#28 0x0000000000958c79 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x958c79)
#29 0x000075a3c1229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x000075a3c1229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x000000000094fd45 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x94fd45)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
I found this crash when fuzzing the code in https://github.com/llvm/llvm-project/pull/137297.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs