Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

LLVM Assertion failure with new-experimental-pass-manager and ThinLTO #32508

Closed Quuxplusone closed 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR33536
Status RESOLVED FIXED
Importance P normal
Reported by Kit Barton (kit.barton@gmail.com)
Reported on 2017-06-20 17:58:19 -0700
Last modified on 2017-07-10 22:40:35 -0700
Version trunk
Hardware Other Linux
CC chandlerc@gmail.com, ditaliano@apple.com, echristo@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
The following test case causes an assert on PPC64LE Linux using the
experimental pass manager and ThinLTO:

namespace std {
template <typename _CharT, typename = _CharT> class basic_ofstream;
typedef basic_ofstream<char> ofstream;
template <typename, typename> class basic_filebuf { virtual int sync(); };
template <typename _CharT, typename _Traits> class basic_ofstream {
  typedef _CharT char_type;
  typedef _Traits traits_type;
  typedef basic_filebuf<char_type, traits_type> __filebuf_type;
  __filebuf_type _M_filebuf;
};
}

std::ofstream out_file;

Compile Command:
 /home/kbarton/llvm/build/dev.github//bin/clang++ -c -o example.o -m64 -fexperimental-new-pass-manager -flto=thin -O2 -mcpu=power8 example.i

Traceback:
clang-5.0: warning: treating 'cpp-output' input as 'c++-cpp-output' when in C++
mode, this behavior is deprecated [-Wdeprecated]
clang-5.0:
/home/kbarton/llvm/src/dev.github/include/llvm/ADT/ilist_iterator.h:140:
llvm::ilist_iterator<OptionsT, IsReverse, IsConst>::reference
llvm::ilist_iterator<OptionsT, IsReverse, IsConst>::operator*() const [with
OptionsT = llvm::ilist_detail::node_options<llvm::BasicBlock, true, false,
void>; bool IsReverse
 = false; bool IsConst = false; llvm::ilist_iterator<OptionsT, IsReverse, IsConst>::reference = llvm::BasicBlock&]: Assertion `!NodePtr->isKnownSentinel()' failed.
#0 0x00000000121fc9a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x121fc9a8)
#1 0x00000000121fcae0 PrintStackTraceSignalHandler(void*)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x121fcae0)
#2 0x00000000121fa36c llvm::sys::RunSignalHandlers()
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x121fa36c)
#3 0x00000000121fa564 SignalHandler(int)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x121fa564)
#4 0x00003fff799f0478  0x100478 gsignal
#5 0x00003fff799f0478 /build/buildd/eglibc-
2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00003fff799f0478 abort /build/buildd/eglibc-2.19/stdlib/abort.c:74:0
#7 0x00003fff79410a88 __assert_fail_base /build/buildd/eglibc-
2.19/assert/assert.c:92:0
#8 0x00003fff7941693c __assert_fail /build/buildd/eglibc-
2.19/assert/assert.c:101:0
#9 0x00003fff794065b4
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::BasicBlock, true,
false, void>, false, false>::operator*() const (/lib/powerpc64le-linux-
gnu/libc.so.6+0x365b4)
#10 0x00003fff794066a4 void
llvm::DominatorTreeBase<llvm::BasicBlock>::recalculate<llvm::Function>(llvm::Function&)
(/lib/powerpc64le-linux-gnu/libc.so.6+0x366a4)
#11 0x0000000011693f0c llvm::DominatorTreeAnalysis::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x11693f0c)
#12 0x00000000117d22b4 llvm::detail::AnalysisPassModel<llvm::Function,
llvm::DominatorTreeAnalysis, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator>::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x117d22b4)
#13 0x0000000011c1677c
llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*,
llvm::Function&) (/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x11c1677c)
#14 0x0000000012ca5e04 llvm::BasicAA::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ca5e04)
#15 0x0000000011ca5348 llvm::detail::AnalysisPassModel<llvm::Function,
llvm::BasicAA, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator>::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x11ca5348)
#16 0x00000000115b7620
llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*,
llvm::Function&) (/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x115b7620)
#17 0x0000000012c7a5b8 void
llvm::AAManager::getFunctionAAResultImpl<llvm::BasicAA>(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&, llvm::AAResults&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12c7a5b8)
#18 0x0000000011ca5348 llvm::detail::AnalysisPassModel<llvm::Function,
llvm::AAManager, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>::Invalidator>::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x11ca5348)
#19 0x0000000012ca93c0 llvm::AAResults& llvm::function_ref<llvm::AAResults&
(llvm::Function&)>::callback_fn<llvm::ThinLTOBitcodeWriterPass::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)::{lambda(llvm::Function&)#1}>(long,
llvm::Function&) (/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ca93c0)
#20 0x00000000123f8178 (anonymous
namespace)::forEachVirtualFunction(llvm::Constant*, llvm::function_ref<void
(llvm::Function*)>) [clone .constprop.523]
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x123f8178)
#21 0x0000000012ccf7d4 (anonymous
namespace)::forEachVirtualFunction(llvm::Constant*, llvm::function_ref<void
(llvm::Function*)>) [clone .constprop.523]
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ccf7d4)
#22 0x0000000012ccd760 (anonymous
namespace)::forEachVirtualFunction(llvm::Constant*, llvm::function_ref<void
(llvm::Function*)>) [clone .constprop.523]
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ccd760)
#23 0x0000000012ccd6dc (anonymous
namespace)::forEachVirtualFunction(llvm::Constant*, llvm::function_ref<void
(llvm::Function*)>) [clone .constprop.523]
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ccd6dc)
#24 0x0000000012ccd6dc (anonymous
namespace)::splitAndWriteThinLTOBitcode(llvm::raw_ostream&, llvm::raw_ostream*,
llvm::function_ref<llvm::AAResults& (llvm::Function&)>, llvm::Module&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ccd6dc)
#25 0x0000000012ccd6dc llvm::ThinLTOBitcodeWriterPass::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12ccd6dc)
#26 0x0000000012cd0510 llvm::detail::PassModel<llvm::Module,
llvm::ThinLTOBitcodeWriterPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12cd0510)
#27 0x0000000012cd26a4 llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12cd26a4)
#28 0x00000000123f0db4 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x123f0db4)
#29 0x0000000011ca1088 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x11ca1088)
#30 0x00000000123f9d9c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x123f9d9c)
#31 0x00000000123fb0a4 clang::ParseAST(clang::Sema&, bool, bool)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x123fb0a4)
#32 0x0000000012c021b8 clang::ASTFrontendAction::ExecuteAction()
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12c021b8)
#33 0x00000000130ba34c clang::CodeGenAction::ExecuteAction()
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x130ba34c)
#34 0x000000001283d900 clang::FrontendAction::Execute()
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x1283d900)
#35 0x0000000012c01414
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x12c01414)
#36 0x000000001283f818
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x1283f818)
#37 0x000000001280ad80 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/kbarton/llvm/build/dev.github/bin/clang-5.0+0x1280ad80)
#38 0x00000000128ede68 main (/home/kbarton/llvm/build/dev.github/bin/clang-
5.0+0x128ede68)
#39 0x0000000010866478 generic_start_main /build/buildd/eglibc-
2.19/csu/../csu/libc-start.c:287:0
#40 0x00000000107f7790 __libc_start_main /build/buildd/eglibc-
2.19/csu/../sysdeps/unix/sysv/linux/powerpc/libc-start.c:93:0

Stack dump:
0.      Program arguments: /home/kbarton/llvm/build/dev.github/bin/clang-5.0 -
cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm-bc -flto=thin -flto-unit -
disable-free -main-file-name example.i -mrelocation-model pic -pic-level 2 -
mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-
array -target-cpu pwr8 -mfloat-abi hard -target-abi elfv2 -momit-leaf-frame-
pointer -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file
/home/kbarton/llvm/Defects/soplex/example.gcno -resource-dir
/home/kbarton/llvm/build/dev.github/lib/clang/5.0.0 -O2 -fdeprecated-macro -
fdebug-compilation-dir /home/kbarton/llvm/Defects/soplex -ferror-limit 19 -
fmessage-length 0 -fno-signed-char -fexperimental-new-pass-manager -fobjc-
runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-
loops -vectorize-slp -o example.o -x c++-cpp-output example.i
1.      <eof> parser at end of file
2.      Optimizer
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (git@github.ibm.com:llvm/clang.git
f5f37badaf42c9f95d12cedd7d097cf7673c8817) (llvm/llvm.git
b1618d24d34d659f7e38a57005382d4b92ff2c92)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/kbarton/llvm/build/dev.github//bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

This test was reduced from the soplex benchmark in SPEC2006 using creduce.
Quuxplusone commented 7 years ago

There are similar assertions (!NodePtr->isKnownSentinel) in dealII, omnetpp, and xalanbmk also.

Quuxplusone commented 7 years ago

I thought this was the same as a bug with a stale domtree I was working on, but it was actually different. The other bug fix didn't help.

Fixed this finally in r307625 -- it was actually a bug in the ThinLTO bitcode writer.