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

void llvm::LoadAndStorePromoter::run(const SmallVectorImpl<llvm::Instruction *> &): Assertion `NewVal && "not a replaced load?"' failed. #219

Closed
bababuck opened this issue Nov 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@bababuck
Copy link

Describe the bug

Compile fails with the following message:

clang -std=gnu11 -Wall -fopencilk -O3 -DNDEBUG -march=znver2  -o collision_world.o -c collision_world.c
clang: /home/neboat/opencilk2/opencilk/llvm/lib/Transforms/Utils/SSAUpdater.cpp:518: void llvm::LoadAndStorePromoter::run(const SmallVectorImpl<llvm::Instruction *> &): Assertion `NewVal && "not a replaced load?"' failed.
PLEASE submit a bug report to https://github.com/OpenCilk/opencilk-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.

I was able to work around by using cilk_for.

OpenCilk version

clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project fc90ded2b090672f84c58d12d8d85cd999eb6c1a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /software/OpenCilk/20.04/2.0.0//bin

Steps to reproduce (include relevant output)

  1. My repository is through github classroom so I am unable to directly share with you, I can download and send a zip if needed.
git clone ...
git checkout compiler-bug2
make
clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project fc90ded2b090672f84c58d12d8d85cd999eb6c1a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /software/OpenCilk/20.04/2.0.0//bin
Stack dump:
0.	Program arguments: clang -std=gnu11 -Wall -fopencilk -O3 -DNDEBUG -march=znver2 -o collision_world.o -c collision_world.c
1.	<eof> parser at end of file
2.	Optimizer
 #0 0x0000000003e230f3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3e230f3)
 #1 0x0000000003e20e2e llvm::sys::RunSignalHandlers() (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3e20e2e)
 #2 0x0000000003e2248d llvm::sys::CleanupOnSignal(unsigned long) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3e2248d)
 #3 0x0000000003d95813 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #4 0x0000000003d959be CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #5 0x000014c2dfef8420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #6 0x000014c2df98b00b raise /build/glibc-BHL3KM/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #7 0x000014c2df96a859 abort /build/glibc-BHL3KM/glibc-2.31/stdlib/abort.c:81:7
 #8 0x000014c2df96a729 get_sysdep_segment_value /build/glibc-BHL3KM/glibc-2.31/intl/loadmsgcat.c:509:8
 #9 0x000014c2df96a729 _nl_load_domain /build/glibc-BHL3KM/glibc-2.31/intl/loadmsgcat.c:970:34
#10 0x000014c2df97bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#11 0x0000000003fa94cd llvm::LoadAndStorePromoter::run(llvm::SmallVectorImpl<llvm::Instruction*> const&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3fa94cd)
#12 0x0000000003bddd73 llvm::promoteLoopAccessesToScalars(llvm::SmallSetVector<llvm::Value*, 8u> const&, llvm::SmallVectorImpl<llvm::BasicBlock*>&, llvm::SmallVectorImpl<llvm::Instruction*>&, llvm::SmallVectorImpl<llvm::MemoryAccess*>&, llvm::PredIteratorCache&, llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo const*, llvm::Loop*, llvm::MemorySSAUpdater*, llvm::ICFLoopSafetyInfo*, llvm::TaskInfo*, llvm::OptimizationRemarkEmitter*, bool) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3bddd73)
#13 0x0000000003bd260b (anonymous namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::BlockFrequencyInfo*, llvm::TargetLibraryInfo*, llvm::TargetTransformInfo*, llvm::ScalarEvolution*, llvm::MemorySSA*, llvm::TaskInfo*, llvm::OptimizationRemarkEmitter*, bool) LICM.cpp:0:0
#14 0x0000000003bd1364 llvm::LICMPass::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3bd1364)
#15 0x000000000519767d llvm::detail::PassModel<llvm::Loop, llvm::LICMPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) PassBuilder.cpp:0:0
#16 0x00000000051c24ff llvm::Optional<llvm::PreservedAnalyses> llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::runSinglePass<llvm::Loop, std::unique_ptr<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>, std::default_delete<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&> > > >(llvm::Loop&, std::unique_ptr<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>, std::default_delete<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&> > >&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&, llvm::PassInstrumentation&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x51c24ff)
#17 0x00000000051c20f6 llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::runWithoutLoopNestPasses(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x51c20f6)
#18 0x00000000051c17e8 llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x51c17e8)
#19 0x000000000517aded llvm::detail::PassModel<llvm::Loop, llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) PassBuilder.cpp:0:0
#20 0x00000000051c3887 llvm::FunctionToLoopPassAdaptor::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x51c3887)
#21 0x00000000051972bd llvm::detail::PassModel<llvm::Function, llvm::FunctionToLoopPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilder.cpp:0:0
#22 0x00000000035ceb11 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x35ceb11)
#23 0x000000000418cbed 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>&) BackendUtil.cpp:0:0
#24 0x0000000003656804 llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3656804)
#25 0x00000000051987ed llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::CGSCCToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) PassBuilder.cpp:0:0
#26 0x00000000036519a1 llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x36519a1)
#27 0x000000000375c54d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::PassManager<llvm::LazyCallGraph::SCC, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) Inliner.cpp:0:0
#28 0x0000000003654d7b llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3654d7b)
#29 0x000000000375cb4d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::DevirtSCCRepeatedPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) Inliner.cpp:0:0
#30 0x000000000365393c llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x365393c)
#31 0x000000000375c90d llvm::detail::PassModel<llvm::Module, llvm::ModuleToPostOrderCGSCCPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) Inliner.cpp:0:0
#32 0x00000000035cd674 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x35cd674)
#33 0x00000000037569e6 llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x37569e6)
#34 0x000000000518b8dd llvm::detail::PassModel<llvm::Module, llvm::ModuleInlinerWrapperPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilder.cpp:0:0
#35 0x00000000035cd674 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x35cd674)
#36 0x000000000418737b (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile> >&) BackendUtil.cpp:0:0
#37 0x000000000417afc5 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x417afc5)
#38 0x0000000004ad5f14 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#39 0x0000000005b01903 clang::ParseAST(clang::Sema&, bool, bool) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x5b01903)
#40 0x0000000004a14270 clang::FrontendAction::Execute() (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x4a14270)
#41 0x0000000004988fd8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x4988fd8)
#42 0x0000000004acf633 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x4acf633)
#43 0x000000000270119f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x270119f)
#44 0x00000000026fefc0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#45 0x00000000047ff7f2 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::$_1>(long) Job.cpp:0:0
#46 0x0000000003d95731 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x3d95731)
#47 0x00000000047ff200 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x47ff200)
#48 0x00000000047c4284 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x47c4284)
#49 0x00000000047c47c7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x47c47c7)
#50 0x00000000047dfcf8 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x47dfcf8)
#51 0x00000000026fe8e9 main (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x26fe8e9)
#52 0x000014c2df96c083 __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:342:3
#53 0x00000000026fbe6e _start (/share/software/OpenCilk/20.04/2.0.0/bin/clang-14+0x26fbe6e)
clang-14: error: clang frontend command failed with exit code 134 (use -v to see invocation)
@bababuck bababuck added the bug Something isn't working label Nov 20, 2023
@neboat
Copy link
Collaborator

neboat commented Nov 20, 2023

Thanks for a report.

Please send us a zip of the code, so we can try and replicate the issue on our end.

@bababuck
Copy link
Author

Sent you an email @neboat

@neboat
Copy link
Collaborator

neboat commented Nov 21, 2023

Thanks for sending the test case. I replicated the issue on that version of OpenCilk.

This bug seems to be fixed on the dev/16.x branch and the current release candidate for the next version of OpenCilk. (I think commit ae661d1 fixed this issue.)

As I understand it, you're not able to upgrade your copy of OpenCilk, but you do have a workaround for this issue. Let me know if there's anything else you need.

@neboat
Copy link
Collaborator

neboat commented Jan 13, 2024

I'm closing this issue, since the crash is fixed in the latest release.

@neboat neboat closed this as completed Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants