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

[Clang][Polly] Crash in Polly during code generation for libjpeg-turbo's jtransform_adjust_parameters #117877

Open
ms178 opened this issue Nov 27, 2024 · 6 comments · May be fixed by #120413
Open
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] polly

Comments

@ms178
Copy link

ms178 commented Nov 27, 2024

I encountered a crash in Clang 20.0git 0cb5846 while compiling the libjpeg-turbo-git (3.0.90.r10.g9758c8a7) library with aggressive optimizations, including Polly, OpenMP, and LTO. The crash occurs during the compilation of src/transupp.c, specifically within the function jtransform_adjust_parameters.

1. Crash Information:

  • Compiler Version: Clang 20.0git 0cb5846
  • Operating System: CachyOS
  • Architecture: x86_64
  • Source File: src/transupp.c (from libjpeg-turbo)
  • Function: jtransform_adjust_parameters
  • Optimization Flags:
    -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/_build
    -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src
    -D_FORTIFY_SOURCE=0
    -O3
    -march=native
    -mtune=native
    -mllvm -inline-threshold=1500
    -mllvm -polly
    -mllvm -polly-position=early
    -mllvm -polly-dependences-computeout=6000000
    -mllvm -polly-detect-profitability-min-per-loop-insts=40
    -mllvm -polly-tiling=true
    -mllvm -polly-prevect-width=256
    -mllvm -polly-vectorizer=stripmine
    -mllvm -polly-invariant-load-hoisting
    -mllvm -polly-loopfusion-greedy
    -mllvm -polly-run-inliner
    -mllvm -polly-run-dce
    -mllvm -polly-enable-delicm=true
    -mllvm -polly
    -fmerge-all-constants
    -mllvm -polly-parallel
    -fopenmp
    -fopenmp-version=52
    -mllvm -polly-omp-backend=LLVM
    -mllvm -polly-num-threads=28
    -mllvm -polly-scheduling=dynamic
    -mllvm -polly-scheduling-chunksize=1
    -mllvm -extra-vectorizer-passes
    -mllvm -enable-cond-stores-vec
    -mllvm -slp-vectorize-hor-store
    -mllvm -enable-loopinterchange
    -mllvm -enable-loop-distribute
    -mllvm -enable-unroll-and-jam
    -mllvm -enable-loop-flatten
    -mllvm -unroll-runtime-multi-exit
    -mllvm -aggressive-ext-opt
    -mllvm -enable-interleaved-mem-accesses
    -mllvm -enable-masked-interleaved-mem-accesses
    -fno-math-errno
    -fno-trapping-math
    -falign-functions=32
    -funroll-loops
    -fno-semantic-interposition
    -fcf-protection=none
    -mharden-sls=none
    -fomit-frame-pointer
    -mprefer-vector-width=256
    -flto=thin
    -fsplit-lto-unit
    -mllvm -adce-remove-loops
    -mllvm -enable-ext-tsp-block-placement=1
    -mllvm -enable-gvn-hoist=1
    -mllvm -enable-dfa-jump-thread=1
    -Wno-error
    -fprofile-use=/home/marcus/Downloads/libjpg.profdata
    -fdata-sections
    -ffunction-sections
    -fno-unique-section-names
    -fsplit-machine-functions
    -mtls-dialect=gnu2
    -fgnuc-version=14.2.0
    -w
    -O3
    -DNDEBUG
    -std=gnu23
    -DBMP_SUPPORTED
    -DPPM_SUPPORTED
    -MD -MT CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -MF CMakeFiles/turbojpeg-static.dir/src/transupp.c.o.d -o CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -c
  • Build System: CMake

Crash Output/Stack Trace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/_build -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src -D_FORTIFY_SOURCE=0 -O3 -march=native -mtune=native -mllvm -inline-threshold=1500 -mllvm -polly -mllvm -polly-position=early -mllvm -polly-dependences-computeout=6000000 -mllvm -polly-detect-profitability-min-per-loop-insts=40 -mllvm -polly-tiling=true -mllvm -polly-prevect-width=256 -mllvm -polly-vectorizer=stripmine -mllvm -polly-invariant-load-hoisting -mllvm -polly-loopfusion-greedy -mllvm -polly-run-inliner -mllvm -polly-run-dce -mllvm -polly-enable-delicm=true -mllvm -polly -fmerge-all-constants -mllvm -polly-parallel -fopenmp -fopenmp-version=52 -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=28 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -fno-math-errno -fno-trapping-math -falign-functions=32 -funroll-loops -fno-semantic-interposition -fcf-protection=none -mharden-sls=none -fomit-frame-pointer -mprefer-vector-width=256 -flto=thin -fsplit-lto-unit -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist=1 -mllvm -enable-dfa-jump-thread=1 -Wno-error -fprofile-use=/home/marcus/Downloads/libjpg.profdata -fdata-sections -ffunction-sections -fno-unique-section-names -fsplit-machine-functions -mtls-dialect=gnu2 -fgnuc-version=14.2.0 -w -O3 -DNDEBUG -std=gnu23 -DBMP_SUPPORTED -DPPM_SUPPORTED -MD -MT CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -MF CMakeFiles/turbojpeg-static.dir/src/transupp.c.o.d -o CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -c /tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c
1.      <eof> parser at end of file
2.      Optimizer
3.      Running pass "function(mem2reg,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,instcombine<max-iterations=1;no-verify-fixpoint>,loop(indvars),polly::CodePreparationPass,polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>>,sroa<modify-cfg>,early-cse<memssa>,gvn-hoist,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>,loop-flatten),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-interchange,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-verify-fixpoint>,dfa-jump-threading,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>)" on module "/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c"
4.      Running pass "polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>>" on function "jtransform_adjust_parameters"
 #0 0x00007dd2646ef8e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef8e8)
 #1 0x00007dd2646ef072 llvm::sys::CleanupOnSignal(unsigned long) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef072)
 #2 0x00007dd26464cbb3 (/usr/bin/../lib/libLLVM.so.20.0git+0x304cbb3)
 #3 0x00007dd2613fb530 (/usr/bin/../lib/libc.so.6+0x47530)
 #4 0x00007dd26402e8d4 llvm::DominatorTreeBase<llvm::BasicBlock, false>::dominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x2a2e8d4)
 #5 0x00007dd26613474d llvm::RegionBase<llvm::RegionTraits<llvm::Function>>::contains(llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x4b3474d)
 #6 0x00007dd2679d128b polly::VirtualUse::create(polly::Scop*, polly::ScopStmt*, llvm::Loop*, llvm::Value*, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x63d128b)
 #7 0x00007dd26799cd23 polly::BlockGenerator::getNewValue(polly::ScopStmt&, llvm::Value*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value>, void>, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>>>&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&, llvm::Loop*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x639cd23)
 #8 0x00007dd26799e742 polly::BlockGenerator::copyInstScalar(polly::ScopStmt&, llvm::Instruction*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value>, void>, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>>>&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x639e742)
 #9 0x00007dd2679a527a polly::RegionGenerator::copyStmt(polly::ScopStmt&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&, isl_id_to_ast_expr*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63a527a)
#10 0x00007dd26799572f polly::IslNodeBuilder::createUser(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x639572f)
#11 0x00007dd26798fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#12 0x00007dd26798f0ed polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f0ed)
#13 0x00007dd26798fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#14 0x00007dd267993877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#15 0x00007dd26798f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#16 0x00007dd26798fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#17 0x00007dd267993877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#18 0x00007dd2679923d3 polly::IslNodeBuilder::createForParallel(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63923d3)
#19 0x00007dd2679958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#20 0x00007dd26798f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#21 0x00007dd2679958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#22 0x00007dd2678f6060 (/usr/bin/../lib/libLLVM.so.20.0git+0x62f6060)
#23 0x00007dd2678f50aa polly::CodeGenerationPass::run(polly::Scop&, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) (/usr/bin/../lib/libLLVM.so.20.0git+0x62f50aa)
#24 0x00007dd2678e1a89 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e1a89)
#25 0x00007dd26795cfb2 llvm::PassManager<polly::Scop, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&>::run(polly::Scop&, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) (/usr/bin/../lib/libLLVM.so.20.0git+0x635cfb2)
#26 0x00007dd2678e9799 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e9799)
#27 0x00007dd263e212d8 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x28212d8)
#28 0x00007dd263e20f0d (/usr/bin/../lib/libLLVM.so.20.0git+0x2820f0d)
#29 0x00007dd263e76e05 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2876e05)
#30 0x00007dd263e76bed (/usr/bin/../lib/libLLVM.so.20.0git+0x2876bed)
#31 0x00007dd26414efc5 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2b4efc5)
#32 0x00007dd26b48e523 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x308e523)
#33 0x00007dd269921db2 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x1521db2)
#34 0x00007dd26991f1f1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x151f1f1)
#35 0x00007dd2696e4590 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x12e4590)
#36 0x00007dd26c62c770 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.20.0git+0x422c770)
#37 0x00007dd26c56c25f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x416c25f)
#38 0x00007dd26c6ae777 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x42ae777)
#39 0x000000000041069e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x41069e)
#40 0x000000000040c903 (/usr/bin/clang+0x40c903)
#41 0x00007dd26c0e0899 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3ce0899)
#42 0x00007dd26464cd9e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/bin/../lib/libLLVM.so.20.0git+0x304cd9e)
#43 0x00007dd26998e240 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x158e240)
#44 0x00007dd26984bb05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x144bb05)
#45 0x00007dd26c0dbd0c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3cdbd0c)
#46 0x000000000040b31a clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+0x40b31a)
#47 0x0000000000409635 main (/usr/bin/clang+0x409635)
#48 0x00007dd2613da127 (/usr/bin/../lib/libc.so.6+0x26127)
#49 0x00007dd2613da1e4 __libc_start_main (/usr/bin/../lib/libc.so.6+0x261e4)
#50 0x000000000040c441 _start (/usr/bin/clang+0x40c441)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 20.0.0git (/home/marcus/Downloads/llvm-git/llvm-project 0cb5846a68cc5c5e519b2c80ab106e7e4fc6eedb)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/transupp-2fe439.c
clang: note: diagnostic msg: /tmp/transupp-2fe439.sh 

transupp-2fe439.c.txt
transupp-2fe439.sh.txt
transupp-f787bc.c.txt
transupp-f787bc.sh.txt

Additional Notes:

  • The crash seems to be related to Polly's interaction with dominance analysis and virtual use creation during code generation.
  • The large number of optimization flags and the use of OpenMP and LTO might be contributing factors.
@github-actions github-actions bot added the clang Clang issues not falling into any other category label Nov 27, 2024
@ms178
Copy link
Author

ms178 commented Nov 27, 2024

I've isolated the crash due to using these flags for the Polly-Parallelizer: -mllvm -polly-parallel -fopenmp -fopenmp-version=52 -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=28 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1

Without these, the build compiles successfully.

@AaronBallman AaronBallman added polly crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Nov 27, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 27, 2024

@llvm/issue-subscribers-polly

Author: None (ms178)

I encountered a crash in Clang 20.0git 0cb5846 while compiling the libjpeg-turbo-git (3.0.90.r10.g9758c8a7) library with aggressive optimizations, including Polly, OpenMP, and LTO. The crash occurs during the compilation of `src/transupp.c`, specifically within the function `jtransform_adjust_parameters`.

1. Crash Information:

  • Compiler Version: Clang 20.0git 0cb5846
  • Operating System: CachyOS
  • Architecture: x86_64
  • Source File: src/transupp.c (from libjpeg-turbo)
  • Function: jtransform_adjust_parameters
  • Optimization Flags:
    -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/_build
    -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src
    -D_FORTIFY_SOURCE=0
    -O3
    -march=native
    -mtune=native
    -mllvm -inline-threshold=1500
    -mllvm -polly
    -mllvm -polly-position=early
    -mllvm -polly-dependences-computeout=6000000
    -mllvm -polly-detect-profitability-min-per-loop-insts=40
    -mllvm -polly-tiling=true
    -mllvm -polly-prevect-width=256
    -mllvm -polly-vectorizer=stripmine
    -mllvm -polly-invariant-load-hoisting
    -mllvm -polly-loopfusion-greedy
    -mllvm -polly-run-inliner
    -mllvm -polly-run-dce
    -mllvm -polly-enable-delicm=true
    -mllvm -polly
    -fmerge-all-constants
    -mllvm -polly-parallel
    -fopenmp
    -fopenmp-version=52
    -mllvm -polly-omp-backend=LLVM
    -mllvm -polly-num-threads=28
    -mllvm -polly-scheduling=dynamic
    -mllvm -polly-scheduling-chunksize=1
    -mllvm -extra-vectorizer-passes
    -mllvm -enable-cond-stores-vec
    -mllvm -slp-vectorize-hor-store
    -mllvm -enable-loopinterchange
    -mllvm -enable-loop-distribute
    -mllvm -enable-unroll-and-jam
    -mllvm -enable-loop-flatten
    -mllvm -unroll-runtime-multi-exit
    -mllvm -aggressive-ext-opt
    -mllvm -enable-interleaved-mem-accesses
    -mllvm -enable-masked-interleaved-mem-accesses
    -fno-math-errno
    -fno-trapping-math
    -falign-functions=32
    -funroll-loops
    -fno-semantic-interposition
    -fcf-protection=none
    -mharden-sls=none
    -fomit-frame-pointer
    -mprefer-vector-width=256
    -flto=thin
    -fsplit-lto-unit
    -mllvm -adce-remove-loops
    -mllvm -enable-ext-tsp-block-placement=1
    -mllvm -enable-gvn-hoist=1
    -mllvm -enable-dfa-jump-thread=1
    -Wno-error
    -fprofile-use=/home/marcus/Downloads/libjpg.profdata
    -fdata-sections
    -ffunction-sections
    -fno-unique-section-names
    -fsplit-machine-functions
    -mtls-dialect=gnu2
    -fgnuc-version=14.2.0
    -w
    -O3
    -DNDEBUG
    -std=gnu23
    -DBMP_SUPPORTED
    -DPPM_SUPPORTED
    -MD -MT CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -MF CMakeFiles/turbojpeg-static.dir/src/transupp.c.o.d -o CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -c
  • Build System: CMake

Crash Output/Stack Trace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/_build -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src -D_FORTIFY_SOURCE=0 -O3 -march=native -mtune=native -mllvm -inline-threshold=1500 -mllvm -polly -mllvm -polly-position=early -mllvm -polly-dependences-computeout=6000000 -mllvm -polly-detect-profitability-min-per-loop-insts=40 -mllvm -polly-tiling=true -mllvm -polly-prevect-width=256 -mllvm -polly-vectorizer=stripmine -mllvm -polly-invariant-load-hoisting -mllvm -polly-loopfusion-greedy -mllvm -polly-run-inliner -mllvm -polly-run-dce -mllvm -polly-enable-delicm=true -mllvm -polly -fmerge-all-constants -mllvm -polly-parallel -fopenmp -fopenmp-version=52 -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=28 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -fno-math-errno -fno-trapping-math -falign-functions=32 -funroll-loops -fno-semantic-interposition -fcf-protection=none -mharden-sls=none -fomit-frame-pointer -mprefer-vector-width=256 -flto=thin -fsplit-lto-unit -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist=1 -mllvm -enable-dfa-jump-thread=1 -Wno-error -fprofile-use=/home/marcus/Downloads/libjpg.profdata -fdata-sections -ffunction-sections -fno-unique-section-names -fsplit-machine-functions -mtls-dialect=gnu2 -fgnuc-version=14.2.0 -w -O3 -DNDEBUG -std=gnu23 -DBMP_SUPPORTED -DPPM_SUPPORTED -MD -MT CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -MF CMakeFiles/turbojpeg-static.dir/src/transupp.c.o.d -o CMakeFiles/turbojpeg-static.dir/src/transupp.c.o -c /tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c
1.      &lt;eof&gt; parser at end of file
2.      Optimizer
3.      Running pass "function(mem2reg,simplifycfg&lt;bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables&gt;,instcombine&lt;max-iterations=1;no-verify-fixpoint&gt;,instcombine&lt;max-iterations=1;no-verify-fixpoint&gt;,loop(indvars),polly::CodePreparationPass,polly::FunctionToScopPassAdaptor&lt;llvm::PassManager&lt;Scop, ScopAnalysisManager, ScopStandardAnalysisResults &amp;, SPMUpdater &amp;&gt;&gt;,sroa&lt;modify-cfg&gt;,early-cse&lt;memssa&gt;,gvn-hoist,speculative-execution&lt;only-if-divergent-target&gt;,jump-threading,correlated-propagation,simplifycfg&lt;bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables&gt;,instcombine&lt;max-iterations=1;no-verify-fixpoint&gt;,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg&lt;bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables&gt;,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm&lt;no-allowspeculation&gt;,loop-rotate&lt;header-duplication;no-prepare-for-lto&gt;,licm&lt;allowspeculation&gt;,simple-loop-unswitch&lt;nontrivial;trivial&gt;,loop-flatten),simplifycfg&lt;bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables&gt;,instcombine&lt;max-iterations=1;no-verify-fixpoint&gt;,loop(loop-idiom,indvars,simple-loop-unswitch&lt;nontrivial;trivial&gt;,loop-deletion,loop-interchange,loop-unroll-full),sroa&lt;modify-cfg&gt;,vector-combine,mldst-motion&lt;no-split-footer-bb&gt;,gvn&lt;&gt;,sccp,bdce,instcombine&lt;max-iterations=1;no-verify-fixpoint&gt;,dfa-jump-threading,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm&lt;allowspeculation&gt;),coro-elide,simplifycfg&lt;bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables&gt;,instcombine&lt;max-iterations=1;no-verify-fixpoint&gt;)" on module "/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c"
4.      Running pass "polly::FunctionToScopPassAdaptor&lt;llvm::PassManager&lt;Scop, ScopAnalysisManager, ScopStandardAnalysisResults &amp;, SPMUpdater &amp;&gt;&gt;" on function "jtransform_adjust_parameters"
 #<!-- -->0 0x00007dd2646ef8e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef8e8)
 #<!-- -->1 0x00007dd2646ef072 llvm::sys::CleanupOnSignal(unsigned long) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef072)
 #<!-- -->2 0x00007dd26464cbb3 (/usr/bin/../lib/libLLVM.so.20.0git+0x304cbb3)
 #<!-- -->3 0x00007dd2613fb530 (/usr/bin/../lib/libc.so.6+0x47530)
 #<!-- -->4 0x00007dd26402e8d4 llvm::DominatorTreeBase&lt;llvm::BasicBlock, false&gt;::dominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x2a2e8d4)
 #<!-- -->5 0x00007dd26613474d llvm::RegionBase&lt;llvm::RegionTraits&lt;llvm::Function&gt;&gt;::contains(llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x4b3474d)
 #<!-- -->6 0x00007dd2679d128b polly::VirtualUse::create(polly::Scop*, polly::ScopStmt*, llvm::Loop*, llvm::Value*, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x63d128b)
 #<!-- -->7 0x00007dd26799cd23 polly::BlockGenerator::getNewValue(polly::ScopStmt&amp;, llvm::Value*, llvm::DenseMap&lt;llvm::AssertingVH&lt;llvm::Value&gt;, llvm::AssertingVH&lt;llvm::Value&gt;, llvm::DenseMapInfo&lt;llvm::AssertingVH&lt;llvm::Value&gt;, void&gt;, llvm::detail::DenseMapPair&lt;llvm::AssertingVH&lt;llvm::Value&gt;, llvm::AssertingVH&lt;llvm::Value&gt;&gt;&gt;&amp;, llvm::DenseMap&lt;llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo&lt;llvm::Loop const*, void&gt;, llvm::detail::DenseMapPair&lt;llvm::Loop const*, llvm::SCEV const*&gt;&gt;&amp;, llvm::Loop*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x639cd23)
 #<!-- -->8 0x00007dd26799e742 polly::BlockGenerator::copyInstScalar(polly::ScopStmt&amp;, llvm::Instruction*, llvm::DenseMap&lt;llvm::AssertingVH&lt;llvm::Value&gt;, llvm::AssertingVH&lt;llvm::Value&gt;, llvm::DenseMapInfo&lt;llvm::AssertingVH&lt;llvm::Value&gt;, void&gt;, llvm::detail::DenseMapPair&lt;llvm::AssertingVH&lt;llvm::Value&gt;, llvm::AssertingVH&lt;llvm::Value&gt;&gt;&gt;&amp;, llvm::DenseMap&lt;llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo&lt;llvm::Loop const*, void&gt;, llvm::detail::DenseMapPair&lt;llvm::Loop const*, llvm::SCEV const*&gt;&gt;&amp;) (/usr/bin/../lib/libLLVM.so.20.0git+0x639e742)
 #<!-- -->9 0x00007dd2679a527a polly::RegionGenerator::copyStmt(polly::ScopStmt&amp;, llvm::DenseMap&lt;llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo&lt;llvm::Loop const*, void&gt;, llvm::detail::DenseMapPair&lt;llvm::Loop const*, llvm::SCEV const*&gt;&gt;&amp;, isl_id_to_ast_expr*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63a527a)
#<!-- -->10 0x00007dd26799572f polly::IslNodeBuilder::createUser(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x639572f)
#<!-- -->11 0x00007dd26798fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#<!-- -->12 0x00007dd26798f0ed polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f0ed)
#<!-- -->13 0x00007dd26798fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#<!-- -->14 0x00007dd267993877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#<!-- -->15 0x00007dd26798f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#<!-- -->16 0x00007dd26798fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#<!-- -->17 0x00007dd267993877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#<!-- -->18 0x00007dd2679923d3 polly::IslNodeBuilder::createForParallel(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63923d3)
#<!-- -->19 0x00007dd2679958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#<!-- -->20 0x00007dd26798f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#<!-- -->21 0x00007dd2679958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#<!-- -->22 0x00007dd2678f6060 (/usr/bin/../lib/libLLVM.so.20.0git+0x62f6060)
#<!-- -->23 0x00007dd2678f50aa polly::CodeGenerationPass::run(polly::Scop&amp;, llvm::AnalysisManager&lt;polly::Scop, polly::ScopStandardAnalysisResults&amp;&gt;&amp;, polly::ScopStandardAnalysisResults&amp;, polly::SPMUpdater&amp;) (/usr/bin/../lib/libLLVM.so.20.0git+0x62f50aa)
#<!-- -->24 0x00007dd2678e1a89 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e1a89)
#<!-- -->25 0x00007dd26795cfb2 llvm::PassManager&lt;polly::Scop, llvm::AnalysisManager&lt;polly::Scop, polly::ScopStandardAnalysisResults&amp;&gt;, polly::ScopStandardAnalysisResults&amp;, polly::SPMUpdater&amp;&gt;::run(polly::Scop&amp;, llvm::AnalysisManager&lt;polly::Scop, polly::ScopStandardAnalysisResults&amp;&gt;&amp;, polly::ScopStandardAnalysisResults&amp;, polly::SPMUpdater&amp;) (/usr/bin/../lib/libLLVM.so.20.0git+0x635cfb2)
#<!-- -->26 0x00007dd2678e9799 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e9799)
#<!-- -->27 0x00007dd263e212d8 llvm::PassManager&lt;llvm::Function, llvm::AnalysisManager&lt;llvm::Function&gt;&gt;::run(llvm::Function&amp;, llvm::AnalysisManager&lt;llvm::Function&gt;&amp;) (/usr/bin/../lib/libLLVM.so.20.0git+0x28212d8)
#<!-- -->28 0x00007dd263e20f0d (/usr/bin/../lib/libLLVM.so.20.0git+0x2820f0d)
#<!-- -->29 0x00007dd263e76e05 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/usr/bin/../lib/libLLVM.so.20.0git+0x2876e05)
#<!-- -->30 0x00007dd263e76bed (/usr/bin/../lib/libLLVM.so.20.0git+0x2876bed)
#<!-- -->31 0x00007dd26414efc5 llvm::PassManager&lt;llvm::Module, llvm::AnalysisManager&lt;llvm::Module&gt;&gt;::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/usr/bin/../lib/libLLVM.so.20.0git+0x2b4efc5)
#<!-- -->32 0x00007dd26b48e523 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x308e523)
#<!-- -->33 0x00007dd269921db2 clang::EmitBackendOutput(clang::DiagnosticsEngine&amp;, clang::HeaderSearchOptions const&amp;, clang::CodeGenOptions const&amp;, clang::TargetOptions const&amp;, clang::LangOptions const&amp;, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;, std::unique_ptr&lt;llvm::raw_pwrite_stream, std::default_delete&lt;llvm::raw_pwrite_stream&gt;&gt;, clang::BackendConsumer*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x1521db2)
#<!-- -->34 0x00007dd26991f1f1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&amp;) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x151f1f1)
#<!-- -->35 0x00007dd2696e4590 clang::ParseAST(clang::Sema&amp;, bool, bool) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x12e4590)
#<!-- -->36 0x00007dd26c62c770 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.20.0git+0x422c770)
#<!-- -->37 0x00007dd26c56c25f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x416c25f)
#<!-- -->38 0x00007dd26c6ae777 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x42ae777)
#<!-- -->39 0x000000000041069e cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/usr/bin/clang+0x41069e)
#<!-- -->40 0x000000000040c903 (/usr/bin/clang+0x40c903)
#<!-- -->41 0x00007dd26c0e0899 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3ce0899)
#<!-- -->42 0x00007dd26464cd9e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/usr/bin/../lib/libLLVM.so.20.0git+0x304cd9e)
#<!-- -->43 0x00007dd26998e240 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x158e240)
#<!-- -->44 0x00007dd26984bb05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x144bb05)
#<!-- -->45 0x00007dd26c0dbd0c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3cdbd0c)
#<!-- -->46 0x000000000040b31a clang_main(int, char**, llvm::ToolContext const&amp;) (/usr/bin/clang+0x40b31a)
#<!-- -->47 0x0000000000409635 main (/usr/bin/clang+0x409635)
#<!-- -->48 0x00007dd2613da127 (/usr/bin/../lib/libc.so.6+0x26127)
#<!-- -->49 0x00007dd2613da1e4 __libc_start_main (/usr/bin/../lib/libc.so.6+0x261e4)
#<!-- -->50 0x000000000040c441 _start (/usr/bin/clang+0x40c441)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 20.0.0git (/home/marcus/Downloads/llvm-git/llvm-project 0cb5846a68cc5c5e519b2c80ab106e7e4fc6eedb)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/transupp-2fe439.c
clang: note: diagnostic msg: /tmp/transupp-2fe439.sh 

transupp-2fe439.c.txt
transupp-2fe439.sh.txt
transupp-f787bc.c.txt
transupp-f787bc.sh.txt

Additional Notes:

  • The crash seems to be related to Polly's interaction with dominance analysis and virtual use creation during code generation.
  • The large number of optimization flags and the use of OpenMP and LTO might be contributing factors.

@ms178
Copy link
Author

ms178 commented Nov 27, 2024

As I was asked to post the output with -mllvm -print-on-crash -mllvm -print-module-scope , this is what I get here:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -Dturbojpeg_EXPORTS -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/_build -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src -D_FORTIFY_SOURCE=0 -O3 -march=native -mtune=native -mllvm -inline-threshold=1500 -mllvm -polly -mllvm -polly-position=early -mllvm -polly-dependences-computeout=6000000 -mllvm -polly-detect-profitability-min-per-loop-insts=40 -mllvm -polly-tiling=true -mllvm -polly-prevect-width=256 -mllvm -polly-vectorizer=stripmine -mllvm -polly-invariant-load-hoisting -mllvm -polly-loopfusion-greedy -mllvm -polly-run-inliner -mllvm -polly-run-dce -mllvm -polly-enable-delicm=true -mllvm -polly -fmerge-all-constants -mllvm -polly-parallel -fopenmp -fopenmp-version=52 -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=28 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -fno-math-errno -fno-trapping-math -falign-functions=32 -funroll-loops -fno-semantic-interposition -fcf-protection=none -mharden-sls=none -fomit-frame-pointer -mprefer-vector-width=256 -flto -fsplit-lto-unit -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist=1 -mllvm -enable-dfa-jump-thread=1 -Wno-error -fprofile-use=/home/marcus/Downloads/libjpg.profdata -fdata-sections -ffunction-sections -fno-unique-section-names -fsplit-machine-functions -mtls-dialect=gnu2 -mllvm -print-on-crash -mllvm -print-module-scope -w -O3 -DNDEBUG -std=gnu23 -fPIC -DBMP_SUPPORTED -DPPM_SUPPORTED -MD -MT CMakeFiles/turbojpeg.dir/src/transupp.c.o -MF CMakeFiles/turbojpeg.dir/src/transupp.c.o.d -o CMakeFiles/turbojpeg.dir/src/transupp.c.o -c /tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c
1.      <eof> parser at end of file
2.      Optimizer
3.      Running pass "function(mem2reg,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,instcombine<max-iterations=1;no-verify-fixpoint>,loop(indvars),polly::CodePreparationPass,polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>>,sroa<modify-cfg>,early-cse<memssa>,gvn-hoist,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>,loop-flatten),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-interchange,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-verify-fixpoint>,dfa-jump-threading,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>)" on module "/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c"
4.      Running pass "polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>>" on function "jtransform_adjust_parameters"
 #0 0x0000707a14eef8e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef8e8)
 #1 0x0000707a14eef072 llvm::sys::CleanupOnSignal(unsigned long) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef072)
 #2 0x0000707a14e4cbb3 (/usr/bin/../lib/libLLVM.so.20.0git+0x304cbb3)
 #3 0x0000707a11bfb530 (/usr/bin/../lib/libc.so.6+0x47530)
 #4 0x0000707a1482e8d4 llvm::DominatorTreeBase<llvm::BasicBlock, false>::dominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x2a2e8d4)
 #5 0x0000707a1693474d llvm::RegionBase<llvm::RegionTraits<llvm::Function>>::contains(llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x4b3474d)
 #6 0x0000707a181229dd (/usr/bin/../lib/libLLVM.so.20.0git+0x63229dd)
 #7 0x0000707a18122751 polly::hasScalarDepsInsideRegion(llvm::SCEV const*, llvm::Region const*, llvm::Loop*, bool, llvm::SetVector<llvm::AssertingVH<llvm::LoadInst>, llvm::SmallVector<llvm::AssertingVH<llvm::LoadInst>, 0u>, llvm::DenseSet<llvm::AssertingVH<llvm::LoadInst>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::LoadInst>, void>>, 0u> const&) (/usr/bin/../lib/libLLVM.so.20.0git+0x6322751)
 #8 0x0000707a181d10ce polly::VirtualUse::create(polly::Scop*, polly::ScopStmt*, llvm::Loop*, llvm::Value*, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x63d10ce)
 #9 0x0000707a1819cd23 polly::BlockGenerator::getNewValue(polly::ScopStmt&, llvm::Value*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value>, void>, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>>>&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&, llvm::Loop*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x639cd23)
#10 0x0000707a1819e742 polly::BlockGenerator::copyInstScalar(polly::ScopStmt&, llvm::Instruction*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value>, void>, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>>>&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x639e742)
#11 0x0000707a181a52f7 polly::RegionGenerator::copyStmt(polly::ScopStmt&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&, isl_id_to_ast_expr*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63a52f7)
#12 0x0000707a1819572f polly::IslNodeBuilder::createUser(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x639572f)
#13 0x0000707a1818fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#14 0x0000707a1818f0ed polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f0ed)
#15 0x0000707a1818fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#16 0x0000707a18193877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#17 0x0000707a1818f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#18 0x0000707a1818fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#19 0x0000707a18193877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#20 0x0000707a181923d3 polly::IslNodeBuilder::createForParallel(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63923d3)
#21 0x0000707a181958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#22 0x0000707a1818f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#23 0x0000707a181958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#24 0x0000707a180f6060 (/usr/bin/../lib/libLLVM.so.20.0git+0x62f6060)
#25 0x0000707a180f50aa polly::CodeGenerationPass::run(polly::Scop&, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) (/usr/bin/../lib/libLLVM.so.20.0git+0x62f50aa)
#26 0x0000707a180e1a89 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e1a89)
#27 0x0000707a1815cfb2 llvm::PassManager<polly::Scop, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&>::run(polly::Scop&, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) (/usr/bin/../lib/libLLVM.so.20.0git+0x635cfb2)
#28 0x0000707a180e9799 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e9799)
#29 0x0000707a146212d8 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x28212d8)
#30 0x0000707a14620f0d (/usr/bin/../lib/libLLVM.so.20.0git+0x2820f0d)
#31 0x0000707a14676e05 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2876e05)
#32 0x0000707a14676bed (/usr/bin/../lib/libLLVM.so.20.0git+0x2876bed)
#33 0x0000707a1494efc5 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2b4efc5)
#34 0x0000707a1bc8e523 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x308e523)
#35 0x0000707a1a121db2 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x1521db2)
#36 0x0000707a1a11f1f1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x151f1f1)
#37 0x0000707a19ee4590 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x12e4590)
#38 0x0000707a1ce2c770 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.20.0git+0x422c770)
#39 0x0000707a1cd6c25f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x416c25f)
#40 0x0000707a1ceae777 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x42ae777)
#41 0x000000000041069e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x41069e)
#42 0x000000000040c903 (/usr/bin/clang+0x40c903)
#43 0x0000707a1c8e0899 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3ce0899)
#44 0x0000707a14e4cd9e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/bin/../lib/libLLVM.so.20.0git+0x304cd9e)
#45 0x0000707a1a18e240 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x158e240)
#46 0x0000707a1a04bb05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x144bb05)
#47 0x0000707a1c8dbd0c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3cdbd0c)
#48 0x000000000040b31a clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+0x40b31a)
#49 0x0000000000409635 main (/usr/bin/clang+0x409635)
#50 0x0000707a11bda127 (/usr/bin/../lib/libc.so.6+0x26127)
#51 0x0000707a11bda1e4 __libc_start_main (/usr/bin/../lib/libc.so.6+0x261e4)
#52 0x000000000040c441 _start (/usr/bin/clang+0x40c441)
*** Dump of Module IR Before Last Pass polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>> Filtered Out ***
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 20.0.0git (/home/marcus/Downloads/llvm-git/llvm-project 0cb5846a68cc5c5e519b2c80ab106e7e4fc6eedb)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:

transupp-d9a02e.c.txt
transupp-d9a02e.sh.txt

And this one:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/_build -I/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src -D_FORTIFY_SOURCE=0 -O3 -march=native -mtune=native -mllvm -inline-threshold=1500 -mllvm -polly -mllvm -polly-position=early -mllvm -polly-dependences-computeout=6000000 -mllvm -polly-detect-profitability-min-per-loop-insts=40 -mllvm -polly-tiling=true -mllvm -polly-prevect-width=256 -mllvm -polly-vectorizer=stripmine -mllvm -polly-invariant-load-hoisting -mllvm -polly-loopfusion-greedy -mllvm -polly-run-inliner -mllvm -polly-run-dce -mllvm -polly-enable-delicm=true -mllvm -polly -fmerge-all-constants -mllvm -polly-parallel -fopenmp -fopenmp-version=52 -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=28 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1 -mllvm -extra-vectorizer-passes -mllvm -enable-cond-stores-vec -mllvm -slp-vectorize-hor-store -mllvm -enable-loopinterchange -mllvm -enable-loop-distribute -mllvm -enable-unroll-and-jam -mllvm -enable-loop-flatten -mllvm -unroll-runtime-multi-exit -mllvm -aggressive-ext-opt -mllvm -enable-interleaved-mem-accesses -mllvm -enable-masked-interleaved-mem-accesses -fno-math-errno -fno-trapping-math -falign-functions=32 -funroll-loops -fno-semantic-interposition -fcf-protection=none -mharden-sls=none -fomit-frame-pointer -mprefer-vector-width=256 -flto -fsplit-lto-unit -mllvm -adce-remove-loops -mllvm -enable-ext-tsp-block-placement=1 -mllvm -enable-gvn-hoist=1 -mllvm -enable-dfa-jump-thread=1 -Wno-error -fprofile-use=/home/marcus/Downloads/libjpg.profdata -fdata-sections -ffunction-sections -fno-unique-section-names -fsplit-machine-functions -mtls-dialect=gnu2 -mllvm -print-on-crash -mllvm -print-module-scope -w -O3 -DNDEBUG -std=gnu23 -MD -MT CMakeFiles/jpegtran-static.dir/src/transupp.c.o -MF CMakeFiles/jpegtran-static.dir/src/transupp.c.o.d -o CMakeFiles/jpegtran-static.dir/src/transupp.c.o -c /tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c
1.      <eof> parser at end of file
2.      Optimizer
3.      Running pass "function(mem2reg,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;no-switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,instcombine<max-iterations=1;no-verify-fixpoint>,loop(indvars),polly::CodePreparationPass,polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>>,sroa<modify-cfg>,early-cse<memssa>,gvn-hoist,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>,loop-flatten),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-interchange,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-verify-fixpoint>,dfa-jump-threading,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,instcombine<max-iterations=1;no-verify-fixpoint>)" on module "/tmp/makepkg/libjpeg-turbo-git/src/libjpeg-turbo/src/transupp.c"
4.      Running pass "polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>>" on function "jtransform_adjust_parameters"
 #0 0x00007ee6dd2ef8e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef8e8)
 #1 0x00007ee6dd2ef072 llvm::sys::CleanupOnSignal(unsigned long) (/usr/bin/../lib/libLLVM.so.20.0git+0x30ef072)
 #2 0x00007ee6dd24cbb3 (/usr/bin/../lib/libLLVM.so.20.0git+0x304cbb3)
 #3 0x00007ee6d9ffb530 (/usr/bin/../lib/libc.so.6+0x47530)
 #4 0x00007ee6dcc2e8d4 llvm::DominatorTreeBase<llvm::BasicBlock, false>::dominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x2a2e8d4)
 #5 0x00007ee6ded3474d llvm::RegionBase<llvm::RegionTraits<llvm::Function>>::contains(llvm::BasicBlock const*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x4b3474d)
 #6 0x00007ee6e05229dd (/usr/bin/../lib/libLLVM.so.20.0git+0x63229dd)
 #7 0x00007ee6e0522751 polly::hasScalarDepsInsideRegion(llvm::SCEV const*, llvm::Region const*, llvm::Loop*, bool, llvm::SetVector<llvm::AssertingVH<llvm::LoadInst>, llvm::SmallVector<llvm::AssertingVH<llvm::LoadInst>, 0u>, llvm::DenseSet<llvm::AssertingVH<llvm::LoadInst>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::LoadInst>, void>>, 0u> const&) (/usr/bin/../lib/libLLVM.so.20.0git+0x6322751)
 #8 0x00007ee6e05d10ce polly::VirtualUse::create(polly::Scop*, polly::ScopStmt*, llvm::Loop*, llvm::Value*, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x63d10ce)
 #9 0x00007ee6e059cd23 polly::BlockGenerator::getNewValue(polly::ScopStmt&, llvm::Value*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value>, void>, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>>>&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&, llvm::Loop*) const (/usr/bin/../lib/libLLVM.so.20.0git+0x639cd23)
#10 0x00007ee6e059e742 polly::BlockGenerator::copyInstScalar(polly::ScopStmt&, llvm::Instruction*, llvm::DenseMap<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>, llvm::DenseMapInfo<llvm::AssertingVH<llvm::Value>, void>, llvm::detail::DenseMapPair<llvm::AssertingVH<llvm::Value>, llvm::AssertingVH<llvm::Value>>>&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x639e742)
#11 0x00007ee6e05a52f7 polly::RegionGenerator::copyStmt(polly::ScopStmt&, llvm::DenseMap<llvm::Loop const*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Loop const*, void>, llvm::detail::DenseMapPair<llvm::Loop const*, llvm::SCEV const*>>&, isl_id_to_ast_expr*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63a52f7)
#12 0x00007ee6e059572f polly::IslNodeBuilder::createUser(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x639572f)
#13 0x00007ee6e058fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#14 0x00007ee6e058f0ed polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f0ed)
#15 0x00007ee6e058fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#16 0x00007ee6e0593877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#17 0x00007ee6e058f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#18 0x00007ee6e058fbca polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/usr/bin/../lib/libLLVM.so.20.0git+0x638fbca)
#19 0x00007ee6e0593877 polly::IslNodeBuilder::createFor(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x6393877)
#20 0x00007ee6e05923d3 polly::IslNodeBuilder::createForParallel(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63923d3)
#21 0x00007ee6e05958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#22 0x00007ee6e058f166 polly::IslNodeBuilder::createMark(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x638f166)
#23 0x00007ee6e05958dc polly::IslNodeBuilder::createBlock(isl_ast_node*) (/usr/bin/../lib/libLLVM.so.20.0git+0x63958dc)
#24 0x00007ee6e04f6060 (/usr/bin/../lib/libLLVM.so.20.0git+0x62f6060)
#25 0x00007ee6e04f50aa polly::CodeGenerationPass::run(polly::Scop&, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) (/usr/bin/../lib/libLLVM.so.20.0git+0x62f50aa)
#26 0x00007ee6e04e1a89 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e1a89)
#27 0x00007ee6e055cfb2 llvm::PassManager<polly::Scop, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&>::run(polly::Scop&, llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&, polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) (/usr/bin/../lib/libLLVM.so.20.0git+0x635cfb2)
#28 0x00007ee6e04e9799 (/usr/bin/../lib/libLLVM.so.20.0git+0x62e9799)
#29 0x00007ee6dca212d8 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x28212d8)
#30 0x00007ee6dca20f0d (/usr/bin/../lib/libLLVM.so.20.0git+0x2820f0d)
#31 0x00007ee6dca76e05 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2876e05)
#32 0x00007ee6dca76bed (/usr/bin/../lib/libLLVM.so.20.0git+0x2876bed)
#33 0x00007ee6dcd4efc5 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/usr/bin/../lib/libLLVM.so.20.0git+0x2b4efc5)
#34 0x00007ee6e408e523 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x308e523)
#35 0x00007ee6e2521db2 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x1521db2)
#36 0x00007ee6e251f1f1 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x151f1f1)
#37 0x00007ee6e22e4590 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x12e4590)
#38 0x00007ee6e522c770 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.20.0git+0x422c770)
#39 0x00007ee6e516c25f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x416c25f)
#40 0x00007ee6e52ae777 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x42ae777)
#41 0x000000000041069e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x41069e)
#42 0x000000000040c903 (/usr/bin/clang+0x40c903)
#43 0x00007ee6e4ce0899 (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3ce0899)
#44 0x00007ee6dd24cd9e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/bin/../lib/libLLVM.so.20.0git+0x304cd9e)
#45 0x00007ee6e258e240 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x158e240)
#46 0x00007ee6e244bb05 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/bin/../lib/libclang-cpp.so.20.0git+0x144bb05)
#47 0x00007ee6e4cdbd0c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/usr/bin/../lib/libclang-cpp.so.20.0git+0x3cdbd0c)
#48 0x000000000040b31a clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+0x40b31a)
#49 0x0000000000409635 main (/usr/bin/clang+0x409635)
#50 0x00007ee6d9fda127 (/usr/bin/../lib/libc.so.6+0x26127)
#51 0x00007ee6d9fda1e4 __libc_start_main (/usr/bin/../lib/libc.so.6+0x261e4)
#52 0x000000000040c441 _start (/usr/bin/clang+0x40c441)
*** Dump of Module IR Before Last Pass polly::FunctionToScopPassAdaptor<llvm::PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &, SPMUpdater &>> Filtered Out ***
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 20.0.0git (/home/marcus/Downloads/llvm-git/llvm-project 0cb5846a68cc5c5e519b2c80ab106e7e4fc6eedb)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:

transupp-c855e4.c.txt
transupp-c855e4.sh.txt

@sharkautarch
Copy link

sharkautarch commented Dec 17, 2024

I've also run into this same bug when compiling a different project w/ clang 20 & polly w/ openmp
I'll just attach the smallest sized file that it crashes on (320KB size)
blake3_portable-5248ce.c.txt
blake3_portable-5248ce.sh.txt

Since it is relatively small, I decided to try lowering it to llvm ir and run bugpoint on it
clang -emit-llvm -c /tmp/blake3_portable-5248ce.c -o /tmp/blake3_portable-5248ce.i
blake3_portable-5248ce.i.txt

And right now I'm running bugpoint --polly --polly-enable-simplify --polly-vectorizer=stripmine --polly-parallel --run-llc /tmp/blake3_portable-5248ce.i
Tho I'm not 100% if I did everything right, since bugpoint initially printed this:

Read input file      : '/tmp/blake3_portable-5248ce.i'
*** All input ok
Initializing execution environment: Found llc: /usr/bin/llc
Running the code generator to test for a crash: <llc>
Generating reference output from raw program: <llc><llc><CC>
Error running tool:
  /usr/bin/clang -x assembler bugpoint-test-program-e29189b.bc-06f9970.llc.s -x none -o bugpoint-test-program-e29189b.bc-06f9970.llc.s-e37a0c4.cc.exe -lm -O2
clang: warning: '-x none' after last input file has no effect [-Wunused-command-line-argument]
/usr/bin/ld: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

*** There is a bug running the "safe" backend.  Either debug it (for example with the -run-jit bugpoint option, if JIT is being used as the "safe" backend), or fix the error some other way.
*** Debugging code generator crash!

Checking to see if we can delete global inits: <llc>
  - Removing all global inits hides problem!

*** Attempting to reduce the number of global initializers in the testcase
Checking for crash with only these global variables:  IV MSG_SCHEDULE: <llc>

Does the part where it says

Checking to see if we can delete global inits: <llc>
  - Removing all global inits hides problem!

Mean that bugpoint automatically fixed the initial issue with running the "safe" backend?
It's still continuing on, so IG I'll let it keep running for now

@efriedma-quic
Copy link
Collaborator

By default, I'd suggest using llvm-reduce, not bugpoint: as you've found, it's very hard to use bugpoint correctly.

This looks similar to #118963, but not sure if it's actually the same thing.

@kartcq
Copy link
Contributor

kartcq commented Dec 18, 2024

Yes @efriedma-quic, This is similar issue. But the cause of issue is in different part of source.
The fix would be something like to use the right dominator tree across RegionGenerator.
I will post the patch for this issue soon for review.

Meanwhile below is the reduced test case.

red.ll

; ModuleID = '<stdin>'
source_filename = "<stdin>"

define ptr @ham(ptr %arg, i64 %arg1, i1 %arg2) {
bb:
  br label %bb3

bb3:                                              ; preds = %bb8, %bb
  %phi = phi i64 [ 0, %bb ], [ %add9, %bb8 ]
  %getelementptr = getelementptr [64 x i16], ptr %arg, i64 %phi
  br label %bb4

bb4:                                              ; preds = %bb7, %bb3
  %phi5 = phi i64 [ %add, %bb7 ], [ 0, %bb3 ]
  %load = load i16, ptr null, align 2
  br i1 %arg2, label %bb7, label %bb6

bb6:                                              ; preds = %bb4
  store i16 0, ptr %getelementptr, align 2
  br label %bb7

bb7:                                              ; preds = %bb6, %bb4
  %add = add i64 %phi5, 1
  %icmp = icmp ne i64 %phi5, 64
  br i1 %icmp, label %bb4, label %bb8

bb8:                                              ; preds = %bb7
  %add9 = add i64 %phi, 1
  %icmp10 = icmp ult i64 %phi, %arg1
  br i1 %icmp10, label %bb3, label %bb11

bb11:                                             ; preds = %bb8
  ret ptr null
}

Command

opt -disable-output -polly-parallel -polly-codegen red.ll

kartcq added a commit to kartcq/llvm-project that referenced this issue Dec 18, 2024
The patch llvm#102460 already implements separate DT/LI/SE for
parallel sub function. Crashes have been reported while
region generator tries using oringinal function's DT while
creating new parallel sub function due to checks in llvm#101198.
This patch aims at fixing those cases by switching the DT/LI
while generating parallel function using Region Generator.

Fixes llvm#117877
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] polly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants