Skip to content
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

opt -passes='dfa-jump-threading' crashing with Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"' failed. #64860

Closed
mikaelholmen opened this issue Aug 21, 2023 · 0 comments · Fixed by #70966
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:transforms

Comments

@mikaelholmen
Copy link
Collaborator

llvm commit: 3758aed
Reproduce with: opt -passes='dfa-jump-threading' bbi-85425.ll -o /dev/null
Result:

While deleting: i16 %div
Use still stuck around after Def is destroyed:  %e.addr.0 = phi i16 [ 0, %entry ], [ %div, %lor.end ], [ 0, %si.unfold.false ]
opt: ../lib/IR/Value.cpp:103: llvm::Value::~Value(): Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: build-all/bin/opt -passes=dfa-jump-threading /home/uabelho/bbi-85425.ll -o /dev/null
 #0 0x0000559fba6af4d7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x2e7f4d7)
 #1 0x0000559fba6ad02e llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x2e7d02e)
 #2 0x0000559fba6afb9f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f87f8a2e630 __restore_rt sigaction.c:0:0
 #4 0x00007f87f6175387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007f87f6176a78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00007f87f616e1a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #7 0x00007f87f616e252 (/lib64/libc.so.6+0x2f252)
 #8 0x0000559fba10944c llvm::Value::~Value() (build-all/bin/opt+0x28d944c)
 #9 0x0000559fba108f07 llvm::Value::deleteValue() (build-all/bin/opt+0x28d8f07)
#10 0x0000559fba074042 llvm::Instruction::eraseFromParent() (build-all/bin/opt+0x2844042)
#11 0x0000559fbb15efdb (anonymous namespace)::DFAJumpThreading::run(llvm::Function&) DFAJumpThreading.cpp:0:0
#12 0x0000559fbb15cb0e llvm::DFAJumpThreadingPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x392cb0e)
#13 0x0000559fba8bf68d llvm::detail::PassModel<llvm::Function, llvm::DFAJumpThreadingPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x308f68d)
#14 0x0000559fba0e7484 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x28b7484)
#15 0x0000559fb8531c6d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0xd01c6d)
#16 0x0000559fba0eb86e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x28bb86e)
#17 0x0000559fb8531a0d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0xd01a0d)
#18 0x0000559fba0e6614 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x28b6614)
#19 0x0000559fb81453b3 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (build-all/bin/opt+0x9153b3)
#20 0x0000559fb8152879 main (build-all/bin/opt+0x922879)
#21 0x00007f87f6161555 __libc_start_main (/lib64/libc.so.6+0x22555)
#22 0x0000559fb813f550 _start (build-all/bin/opt+0x90f550)
Abort (core dumped)

This is old, it happens ever since the introduction of the dfa-jump-threading pass in https://reviews.llvm.org/D99205 .

bbi-85425.ll.gz

@EugeneZelenko EugeneZelenko added llvm:optimizations crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Aug 21, 2023
@XChy XChy self-assigned this Nov 1, 2023
XChy added a commit that referenced this issue Nov 2, 2023
…s defined (#70966)

Fixes #64860.
When a select instruction comes in by PHINode, the phi's incoming block
for it can flow indirectly past other BasicBlock into it. In this case,
we cannot unfold select to the phi's BB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:transforms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants