llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.03k stars 11.97k forks source link

clang-15 regression: llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = llvm::PHINode, From = llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, false>]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed. #57511

Closed berolinux closed 2 years ago

berolinux commented 2 years ago

Trying to build libreoffice 7.4.1.1 with clang 15-rc3 results in:

clang++: /builddir/build/BUILD/llvm-project-release-15.x/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = llvm::PHINode, From = llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, false>]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
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++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DCPPU_ENV=gcc3 -DLINUX -DNDEBUG -DOSL_DEBUG_LEVEL=0 -DUNIX -DUNX -DX86_64 -D_PTHREADS -D_REENTRANT -DSVXCORE_DLLIMPLEMENTATION -DSYSTEM_LIBXML -flto=thin -fvisibility=hidden -Wall -Wno-missing-braces -Wnon-virtual-dtor -Wendif-labels -Wextra -Wundef -Wunreachable-code -Wshadow -Wunused-macros -Wembedded-directive -finput-charset=UTF-8 -fmessage-length=0 -fno-common -pipe -fstack-protector-strong -Wdeprecated-copy-dtor -Wimplicit-fallthrough -Wunused-exception-parameter -Wrange-loop-analysis -fvisibility-inlines-hidden -fPIC -Wshadow -Woverloaded-virtual -std=c++17 -pthread -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -O3 -m64 -march=znver1 -mtune=znver1 -mmmx -msse -msse2 -mssse3 -msse4a -msse4.1 -msse4.2 -mavx -mavx2 -msha -maes -mclflushopt -mfsgsbase -mrdrnd -mfma -mrdseed -mpopcnt -madx -mbmi -mbmi2 -mfxsr -mxsave -mxsaveopt -mxsavec -mxsaves -mmwaitx -mclzero -mfpmath=sse -flto -g0 -I/usr/include/harfbuzz -fno-omit-frame-pointer -fno-strict-aliasing -fpermissive -std=gnu++20 -DEXCEPTIONS_ON -fexceptions -DLIBO_INTERNAL_ONLY -c /home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/svx/source/svdraw/svdpagv.cxx -o /home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/workdir/CxxObject/svx/source/svdraw/svdpagv.o -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/svx/inc -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/svx/source/inc -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/include -I/usr/lib/jvm/java-12-openjdk/include -I/usr/lib/jvm/java-12-openjdk/include/linux -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/config_host -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/workdir/CustomTarget/officecfg/registry -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/workdir/UnoApiHeadersTarget/udkapi/normal -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/workdir/UnoApiHeadersTarget/offapi/normal -I/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1/workdir/SdiTarget/svx/sdi -I/usr/include -isystem /usr/include/libxml2
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x00007fe325e4aa01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-15.so+0x41d0a01)
 #1 0x00007fe325e4ad9b (/lib64/libLLVM-15.so+0x41d0d9b)
 #2 0x00007fe325e4964a llvm::sys::RunSignalHandlers() (/lib64/libLLVM-15.so+0x41cf64a)
 #3 0x00007fe325e4992b llvm::sys::CleanupOnSignal(unsigned long) (/lib64/libLLVM-15.so+0x41cf92b)
 #4 0x00007fe325d28277 (/lib64/libLLVM-15.so+0x40ae277)
 #5 0x00007fe325d27f6c (/lib64/libLLVM-15.so+0x40adf6c)
 #6 0x00007fe32188e2a0 (/lib64/libc.so.6+0x382a0)
 #7 0x00007fe3218ddffc (/lib64/libc.so.6+0x87ffc)
 #8 0x00007fe32188e1f2 raise (/lib64/libc.so.6+0x381f2)
 #9 0x00007fe321878472 abort (/lib64/libc.so.6+0x22472)
#10 0x00007fe321878395 (/lib64/libc.so.6+0x22395)
#11 0x00007fe321886f12 (/lib64/libc.so.6+0x30f12)
#12 0x00007fe327198dde (/lib64/libLLVM-15.so+0x551edde)
#13 0x00007fe3271a0d9b (/lib64/libLLVM-15.so+0x5526d9b)
#14 0x00007fe32719d50a llvm::InstCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/lib64/libLLVM-15.so+0x552350a)
#15 0x00007fe329dbcdef (/lib64/libLLVM-15.so+0x8142def)
#16 0x00007fe3260f0354 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/lib64/libLLVM-15.so+0x4476354)
#17 0x00007fe328a49cbf (/lib64/libLLVM-15.so+0x6dcfcbf)
#18 0x00007fe327aebd59 llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib64/libLLVM-15.so+0x5e71d59)
#19 0x00007fe328a498df (/lib64/libLLVM-15.so+0x6dcf8df)
#20 0x00007fe327ae36f5 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&) (/lib64/libLLVM-15.so+0x5e696f5)
#21 0x00007fe32775ad8f (/lib64/libLLVM-15.so+0x5ae0d8f)
#22 0x00007fe327ae8a4c llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib64/libLLVM-15.so+0x5e6ea4c)
#23 0x00007fe32775a75f (/lib64/libLLVM-15.so+0x5ae075f)
#24 0x00007fe327ae5ee2 llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x5e6bee2)
#25 0x00007fe32775aabf (/lib64/libLLVM-15.so+0x5ae0abf)
#26 0x00007fe3260ece20 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x4472e20)
#27 0x00007fe32775a2c8 llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x5ae02c8)
#28 0x00007fe329dc5f1f (/lib64/libLLVM-15.so+0x814bf1f)
#29 0x00007fe3260ece20 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x4472e20)
#30 0x00007fe32d603c3f (/lib64/libclang-cpp.so.15+0x2a02c3f)
#31 0x00007fe32d5fcc84 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>>) (/lib64/libclang-cpp.so.15+0x29fbc84)
#32 0x00007fe32da28e66 (/lib64/libclang-cpp.so.15+0x2e27e66)
#33 0x00007fe32c2d1ece clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.15+0x16d0ece)
#34 0x00007fe32e4e68ef clang::ASTFrontendAction::ExecuteAction() (/lib64/libclang-cpp.so.15+0x38e58ef)
#35 0x00007fe32da21de9 clang::CodeGenAction::ExecuteAction() (/lib64/libclang-cpp.so.15+0x2e20de9)
#36 0x00007fe32e4e66bb clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.15+0x38e56bb)
#37 0x00007fe32e43c07b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.15+0x383b07b)
#38 0x00007fe32e55e9c2 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.15+0x395d9c2)
#39 0x000000000021928e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+++0x21928e)
#40 0x0000000000215b5d (/usr/bin/clang+++0x215b5d)
#41 0x00007fe32e01d6e4 (/lib64/libclang-cpp.so.15+0x341c6e4)
#42 0x00007fe325d2860a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM-15.so+0x40ae60a)
#43 0x00007fe32e01d5b5 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.15+0x341c5b5)
#44 0x00007fe32dfcb1a3 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.15+0x33ca1a3)
#45 0x00007fe32dfcb65e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.15+0x33ca65e)
#46 0x00007fe32e019420 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.15+0x3418420)
#47 0x0000000000214dbb clang_main(int, char**) (/usr/bin/clang+++0x214dbb)
#48 0x0000000000226243 main (/usr/bin/clang+++0x226243)
#49 0x00007fe32187918a (/lib64/libc.so.6+0x2318a)
#50 0x00007fe321879245 __libc_start_main (/lib64/libc.so.6+0x23245)
#51 0x0000000000212081 _start (/usr/bin/clang+++0x212081)
clang-15: error: clang frontend command failed with exit code 134 (use -v to see invocation)
OpenMandriva 15.0.0-0.20220826.1 clang version 15.0.0 (/builddir/build/BUILD/llvm-project-release-15.x/clang b12227227093f5113fa12506a13d796070398270)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
fhahn commented 2 years ago

@berolinux could you please provide the preprocessed C/C++ reproducer file & script Clang generates wen crashing? This is need for further investigation.

Also, if you have an assert build, it would be great if you could also share the output of adding -mllvm -print-on-crash -mllvm -print-module-scope.

berolinux commented 2 years ago

Sure, was just waiting for creduce to finish its job. This is what it comes down to (build with clang++ -O -std=c++20):

struct a {
  long b();
};
struct c {
  c(long);
};
class d;
class e;
struct f {
  void g(d &);
  e *h();
};
struct d {
  void i(c);
};
struct e {
  int j();
  a k;
  a l;
} m, n;
void f::g(d &o) {
  long p = m.k.b(), q = n.l.b(), r = h()->j();
  for (;;) {
    long s;
    while (s < r)
      s += p;
    long t = s;
    while (t < r)
      t += q;
    o.i(t);
  }
}

reduced test case

berolinux commented 2 years ago
$ clang++ -O -std=c++20 -mllvm -print-on-crash -mllvm -print-module-scope svdpagv.cpp
clang-15: /builddir/build/BUILD/llvm-project-release-15.x/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = llvm::PHINode, From = llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, false>]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
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-15 -cc1 -triple x86_64-pc-linux-gnu -emit-obj --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name svdpagv.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1 -resource-dir /usr/lib64/clang/15.0.0 -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.2.0/../../../../include/c++/12.2.0 -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.2.0/../../../../include/c++/12.2.0/x86_64-openmandriva-linux-gnu -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.2.0/../../../../include/c++/12.2.0/backward -internal-isystem /usr/lib64/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/12.2.0/../../../../x86_64-openmandriva-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O1 -std=c++20 -fdeprecated-macro -fdebug-compilation-dir=/home/bero/temp/abf/libreoffice/BUILD/libreoffice-7.4.1.1 -ferror-limit 19 -fgnuc-version=12.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -fcolor-diagnostics -mllvm -print-on-crash -mllvm -print-module-scope -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/svdpagv-d54f53.o -x c++ svdpagv.cpp
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x00007fd119a90a01 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM-15.so+0x41d0a01)
 #1 0x00007fd119a90d9b (/lib64/libLLVM-15.so+0x41d0d9b)
 #2 0x00007fd119a8f64a llvm::sys::RunSignalHandlers() (/lib64/libLLVM-15.so+0x41cf64a)
 #3 0x00007fd119a902f6 (/lib64/libLLVM-15.so+0x41d02f6)
 #4 0x00007fd1154d42a0 (/lib64/libc.so.6+0x382a0)
 #5 0x00007fd115523ffc (/lib64/libc.so.6+0x87ffc)
 #6 0x00007fd1154d41f2 raise (/lib64/libc.so.6+0x381f2)
 #7 0x00007fd1154be472 abort (/lib64/libc.so.6+0x22472)
 #8 0x00007fd1154be395 (/lib64/libc.so.6+0x22395)
 #9 0x00007fd1154ccf12 (/lib64/libc.so.6+0x30f12)
#10 0x00007fd11addedde (/lib64/libLLVM-15.so+0x551edde)
#11 0x00007fd11ade6d9b (/lib64/libLLVM-15.so+0x5526d9b)
#12 0x00007fd11ade350a llvm::InstCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/lib64/libLLVM-15.so+0x552350a)
#13 0x00007fd11da02def (/lib64/libLLVM-15.so+0x8142def)
#14 0x00007fd119d36354 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/lib64/libLLVM-15.so+0x4476354)
#15 0x00007fd11c68fcbf (/lib64/libLLVM-15.so+0x6dcfcbf)
#16 0x00007fd11b731d59 llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib64/libLLVM-15.so+0x5e71d59)
#17 0x00007fd11c68f8df (/lib64/libLLVM-15.so+0x6dcf8df)
#18 0x00007fd11b7296f5 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&) (/lib64/libLLVM-15.so+0x5e696f5)
#19 0x00007fd11b3a0d8f (/lib64/libLLVM-15.so+0x5ae0d8f)
#20 0x00007fd11b72ea4c llvm::DevirtSCCRepeatedPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (/lib64/libLLVM-15.so+0x5e6ea4c)
#21 0x00007fd11b3a075f (/lib64/libLLVM-15.so+0x5ae075f)
#22 0x00007fd11b72bee2 llvm::ModuleToPostOrderCGSCCPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x5e6bee2)
#23 0x00007fd11b3a0abf (/lib64/libLLVM-15.so+0x5ae0abf)
#24 0x00007fd119d32e20 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x4472e20)
#25 0x00007fd11b3a02c8 llvm::ModuleInlinerWrapperPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x5ae02c8)
#26 0x00007fd11da0bf1f (/lib64/libLLVM-15.so+0x814bf1f)
#27 0x00007fd119d32e20 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/lib64/libLLVM-15.so+0x4472e20)
#28 0x00007fd121249c3f (/lib64/libclang-cpp.so.15+0x2a02c3f)
#29 0x00007fd121242c84 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>>) (/lib64/libclang-cpp.so.15+0x29fbc84)
#30 0x00007fd12166ee66 (/lib64/libclang-cpp.so.15+0x2e27e66)
#31 0x00007fd11ff17ece clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.15+0x16d0ece)
#32 0x00007fd12212c8ef clang::ASTFrontendAction::ExecuteAction() (/lib64/libclang-cpp.so.15+0x38e58ef)
#33 0x00007fd121667de9 clang::CodeGenAction::ExecuteAction() (/lib64/libclang-cpp.so.15+0x2e20de9)
#34 0x00007fd12212c6bb clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.15+0x38e56bb)
#35 0x00007fd12208207b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.15+0x383b07b)
#36 0x00007fd1221a49c2 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.15+0x395d9c2)
#37 0x000000000021928e cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang-15+0x21928e)
#38 0x0000000000215b5d (/usr/bin/clang-15+0x215b5d)
#39 0x00000000002154be clang_main(int, char**) (/usr/bin/clang-15+0x2154be)
#40 0x0000000000226243 main (/usr/bin/clang-15+0x226243)
#41 0x00007fd1154bf18a (/lib64/libc.so.6+0x2318a)
#42 0x00007fd1154bf245 __libc_start_main (/lib64/libc.so.6+0x23245)
#43 0x0000000000212081 _start (/usr/bin/clang-15+0x212081)
*** Dump of Module IR Before Last Pass InstCombinePass Started ***
; ModuleID = 'svdpagv.cpp'
source_filename = "svdpagv.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

%struct.e = type { %struct.a, %struct.a }
%struct.a = type { i8 }
%struct.c = type { i8 }

@m = dso_local global %struct.e zeroinitializer, align 1
@n = dso_local global %struct.e zeroinitializer, align 1

; Function Attrs: mustprogress noreturn uwtable
define dso_local void @_ZN1f1gER1d(ptr noundef nonnull align 1 dereferenceable(1) %this, ptr noundef nonnull align 1 dereferenceable(1) %o) local_unnamed_addr #0 align 2 {
entry:
  %agg.tmp = alloca %struct.c, align 1
  %call = call noundef i64 @_ZN1a1bEv(ptr noundef nonnull align 1 dereferenceable(1) @m)
  %call2 = call noundef i64 @_ZN1a1bEv(ptr noundef nonnull align 1 dereferenceable(1) getelementptr inbounds (%struct.e, ptr @n, i64 0, i32 1))
  %call3 = call noundef ptr @_ZN1f1hEv(ptr noundef nonnull align 1 dereferenceable(1) %this)
  %call4 = call noundef i32 @_ZN1e1jEv(ptr noundef nonnull align 1 dereferenceable(2) %call3)
  %conv = sext i32 %call4 to i64
  %umax = call i64 @llvm.umax.i64(i64 %call, i64 1)
  %umax17 = call i64 @llvm.umax.i64(i64 %call2, i64 1)
  br label %for.cond

for.cond:                                         ; preds = %while.end9, %entry
  %s.0 = phi i64 [ undef, %entry ], [ %5, %while.end9 ]
  %smax = call i64 @llvm.smax.i64(i64 %s.0, i64 %conv)
  %0 = sub i64 %smax, %s.0
  %umin = call i64 @llvm.umin.i64(i64 %0, i64 1)
  %1 = sub i64 %0, %umin
  %2 = udiv i64 %1, %umax
  %3 = add i64 %umin, %2
  %4 = mul i64 %call, %3
  br label %while.cond5.preheader

while.cond5.preheader:                            ; preds = %for.cond
  %5 = add i64 %s.0, %4
  %6 = add i64 %s.0, %4
  %smax15 = call i64 @llvm.smax.i64(i64 %5, i64 %conv)
  %7 = sub i64 %smax15, %5
  %umin16 = call i64 @llvm.umin.i64(i64 %7, i64 1)
  br label %while.cond5

while.cond5:                                      ; preds = %while.cond5, %while.cond5.preheader
  %8 = sub i64 %smax15, %umin16
  %9 = sub i64 %8, %5
  %10 = udiv i64 %9, %umax17
  %11 = add i64 %umin16, %10
  %12 = mul i64 %call2, %11
  %13 = add i64 %6, %12
  %t.0 = phi i64 [ %add8, %while.cond5 ], [ %5, %while.cond5.preheader ]
  %cmp6 = icmp slt i64 %t.0, %conv
  %add8 = add nsw i64 %t.0, %call2
  br i1 %cmp6, label %while.cond5, label %while.end9, !llvm.loop !5

while.end9:                                       ; preds = %while.cond5
  %t.0.lcssa = phi i64 [ %13, %while.cond5 ]
  call void @_ZN1cC1El(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp, i64 noundef %t.0.lcssa)
  call void @_ZN1d1iE1c(ptr noundef nonnull align 1 dereferenceable(1) %o)
  br label %for.cond, !llvm.loop !8
}

declare noundef i64 @_ZN1a1bEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1

declare noundef ptr @_ZN1f1hEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1

declare noundef i32 @_ZN1e1jEv(ptr noundef nonnull align 1 dereferenceable(2)) local_unnamed_addr #1

declare void @_ZN1d1iE1c(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1

declare void @_ZN1cC1El(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
declare i64 @llvm.smax.i64(i64, i64) #2

; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
declare i64 @llvm.umin.i64(i64, i64) #2

; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
declare i64 @llvm.umax.i64(i64, i64) #2

attributes #0 = { mustprogress noreturn uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind readnone speculatable willreturn }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"OpenMandriva 15.0.0-0.20220826.1 clang version 15.0.0 (/builddir/build/BUILD/llvm-project-release-15.x/clang b12227227093f5113fa12506a13d796070398270)"}
!5 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.unroll.disable"}
!8 = distinct !{!8, !6, !7}
clang-15: error: unable to execute command: Aborted (core dumped)
clang-15: error: clang frontend command failed due to signal (use -v to see invocation)
OpenMandriva 15.0.0-0.20220826.1 clang version 15.0.0 (/builddir/build/BUILD/llvm-project-release-15.x/clang b12227227093f5113fa12506a13d796070398270)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
fhahn commented 2 years ago

Thanks! Looks like the same issue as #57336

We should probably pick the fix for the release. @preames WDYT?

nikic commented 2 years ago

/cherry-pick c37b1a5f764380f83ba08ae0cebca2b162123eb6

llvmbot commented 2 years ago

/branch llvm/llvm-project-release-prs/issue57511

llvmbot commented 2 years ago

/pull-request llvm/llvm-project-release-prs#142

preames commented 2 years ago

Thanks! Looks like the same issue as #57336

We should probably pick the fix for the release. @preames WDYT?

No objection. Seems like a reasonable backport.

fhahn commented 2 years ago

Great, thanks @nikic for already triggering the cherry-pick

berolinux commented 2 years ago

confirmed to fix libreoffice build

fhahn commented 2 years ago

Thanks @berolinux for the quick responses!