Skip to content

[SLPVectorizer] Instruction does not dominate all uses! LLVM ERROR: Broken module found, compilation aborted! #101213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TatyanaDoubts opened this issue Jul 30, 2024 · 2 comments

Comments

@TatyanaDoubts
Copy link

To reproduce run the following test with -passes slp-vectorizer -slp-threshold=-99999
Test.ll.tgz

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

Stack dump:

Instruction does not dominate all uses!
  %2 = shufflevector <2 x ptr addrspace(1)> %0, <2 x ptr addrspace(1)> poison, <2 x i32> <i32 1, i32 0>
  %1 = extractelement <2 x ptr addrspace(1)> %2, i32 0
LLVM ERROR: Broken module found, compilation aborted!
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 -slp-threshold=-99999 <source>
1.	Running pass "verify" on module "<source>"
 #0 0x0000000004eff778 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4eff778)
 #1 0x0000000004efceec SignalHandler(int) Signals.cpp:0:0
 #2 0x00007c0269e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007c0269e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007c0269e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007c0269e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00000000007b3ff7 llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
 #7 0x0000000004e396a8 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4e396a8)
 #8 0x0000000004d360f0 llvm::VerifierPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4d360f0)
 #9 0x00000000008d865e llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8d865e)
#10 0x0000000004cf9c90 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4cf9c90)
#11 0x00000000008e33d2 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+0x8e33d2)
#12 0x00000000008d62fc optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8d62fc)
#13 0x00007c0269e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#14 0x00007c0269e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#15 0x00000000008cd75e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8cd75e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
@nikic nikic changed the title Instruction does not dominate all uses! LLVM ERROR: Broken module found, compilation aborted! [SLPVectorizer] Instruction does not dominate all uses! LLVM ERROR: Broken module found, compilation aborted! Jul 30, 2024
@alexey-bataev alexey-bataev self-assigned this Jul 30, 2024
alexey-bataev added a commit that referenced this issue Jul 30, 2024
…omes before new vector value.

When trying to reuse extractelement instruction, need to check that it
is inserted into proper position. Its original vector operand should
come before new vector value, otherwise new extractelement instruction
must be generated.

Fixes #101213
giordano pushed a commit to JuliaLang/llvm-project that referenced this issue Nov 3, 2024
…omes before new vector value.

When trying to reuse extractelement instruction, need to check that it
is inserted into proper position. Its original vector operand should
come before new vector value, otherwise new extractelement instruction
must be generated.

Fixes llvm#101213

(cherry picked from commit f70f122)
@Zentrik
Copy link
Contributor

Zentrik commented Nov 16, 2024

@alexey-bataev Hi, is there a way to backport this fix for llvm 19, I tried just cherry picking f70f122 but I ended up getting assertion failures of the form /workspace/srcdir/llvm-project/llvm/lib/IR/Instruction.cpp:321: bool llvm::Instruction::comesBefore(const llvm::Instruction*) const: Assertion 'getParent() == Other->getParent() && "cross-BB instruction order comparison"' failed.'.
I can create an IR reproducer for that failure if need be.
Thank you.

EDIT: Would just adding a check that they're in the same basic block work?

@alexey-bataev
Copy link
Member

@alexey-bataev Hi, is there a way to backport this fix for llvm 19, I tried just cherry picking f70f122 but I ended up getting assertion failures of the form /workspace/srcdir/llvm-project/llvm/lib/IR/Instruction.cpp:321: bool llvm::Instruction::comesBefore(const llvm::Instruction*) const: Assertion 'getParent() == Other->getParent() && "cross-BB instruction order comparison"' failed.'. I can create an IR reproducer for that failure if need be. Thank you.

EDIT: Would just adding a check that they're in the same basic block work?

Yes, check for the same parent should fix it

giordano pushed a commit to JuliaLang/llvm-project that referenced this issue Nov 21, 2024
…omes before new vector value.

When trying to reuse extractelement instruction, need to check that it
is inserted into proper position. Its original vector operand should
come before new vector value, otherwise new extractelement instruction
must be generated.

Fixes llvm#101213

(cherry picked from commit f70f122)
yuyichao pushed a commit to yuyichao/llvm-project that referenced this issue Jan 15, 2025
…omes before new vector value.

When trying to reuse extractelement instruction, need to check that it
is inserted into proper position. Its original vector operand should
come before new vector value, otherwise new extractelement instruction
must be generated.

Fixes llvm#101213

(cherry picked from commit f70f122)
giordano pushed a commit to JuliaLang/llvm-project that referenced this issue Feb 7, 2025
…omes before new vector value.

When trying to reuse extractelement instruction, need to check that it
is inserted into proper position. Its original vector operand should
come before new vector value, otherwise new extractelement instruction
must be generated.

Fixes llvm#101213

(cherry picked from commit f70f122)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants