[llvm-bugs] [Bug 51964] New: [Linux Kernel] 5.14.6 exposes a Polly bug when using FullLTO No. 2/2

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 24 15:13:36 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51964

            Bug ID: 51964
           Summary: [Linux Kernel] 5.14.6 exposes a Polly bug when using
                    FullLTO No. 2/2
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Optimizer
          Assignee: polly-dev at googlegroups.com
          Reporter: m.seyfarth at gmail.com
                CC: llvm-bugs at lists.llvm.org

This is bug number 2 split our from https://bugs.llvm.org/show_bug.cgi?id=51960

See also https://github.com/ClangBuiltLinux/linux/issues/1460 for more
background details, Kernel Makefile and related discussions with Nathan and
Nick.


$ cat simple-card-utils.i
struct {
  int num_cpus;
  int num_platforms;
} * asoc_simple_init_priv_dai_link;
int asoc_simple_init_priv_li_2, asoc_simple_init_priv_li_1_0_0,
    asoc_simple_init_priv_li_0;
void asoc_simple_init_priv() {
  int i;
  asm goto("" : : : : l_yes);
l_yes:
  i = 0;
  for (; i < asoc_simple_init_priv_li_0; i++)
    if (asoc_simple_init_priv_li_1_0_0)
      asoc_simple_init_priv_dai_link[i].num_cpus = asoc_simple_init_priv_li_2;
    else
      asoc_simple_init_priv_dai_link[i].num_platforms = 0;
}

$ clang -O2 -mllvm -polly -mllvm -polly-invariant-load-hoisting -c -o /dev/null
simple-card-utils.i
clang:
/home/nathan/cbl/github/tc-build/llvm-project/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1112:
llvm::BasicBlock *SplitBlockPredecessorsImpl(llvm::BasicBlock *,
ArrayRef<llvm::BasicBlock *>, const char *, llvm::DomTreeUpdater *,
llvm::DominatorTree *, llvm::LoopInfo *, llvm::MemorySSAUpdater *, bool):
Assertion `!isa<CallBrInst>(Preds[i]->getTerminator()) && "Cannot split an edge
from a CallBrInst"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -O2 -mllvm -polly -mllvm
-polly-invariant-load-hoisting -c -o /dev/null simple-card-utils.i
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x0000000002cb92d3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2cb92d3)
 #1 0x0000000002cb70fe llvm::sys::RunSignalHandlers()
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2cb70fe)
 #2 0x0000000002c401e3 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
CrashRecoveryContext.cpp:0:0
 #3 0x0000000002c4035e CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #4 0x00007f9682b54870 __restore_rt sigaction.c:0:0
 #5 0x00007f968260ed22 raise (/usr/lib/libc.so.6+0x3cd22)
 #6 0x00007f96825f8862 abort (/usr/lib/libc.so.6+0x26862)
 #7 0x00007f96825f8747 _nl_load_domain.cold loadmsgcat.c:0:0
 #8 0x00007f9682607616 (/usr/lib/libc.so.6+0x35616)
 #9 0x0000000002ccd6b7 SplitBlockPredecessorsImpl(llvm::BasicBlock*,
llvm::ArrayRef<llvm::BasicBlock*>, char const*, llvm::DomTreeUpdater*,
llvm::DominatorTree*, llvm::LoopInfo*, llvm::MemorySSAUpdater*, bool)
BasicBlockUtils.cpp:0:0
#10 0x0000000002ccbfbf llvm::SplitBlockPredecessors(llvm::BasicBlock*,
llvm::ArrayRef<llvm::BasicBlock*>, char const*, llvm::DominatorTree*,
llvm::LoopInfo*, llvm::MemorySSAUpdater*, bool)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2ccbfbf)
#11 0x0000000003e1ae8b polly::simplifyRegion(llvm::Region*,
llvm::DominatorTree*, llvm::LoopInfo*, llvm::RegionInfo*)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x3e1ae8b)
#12 0x0000000003d5ba19 generateCode(polly::Scop&, polly::IslAstInfo&,
llvm::LoopInfo&, llvm::DominatorTree&, llvm::ScalarEvolution&,
llvm::RegionInfo&) CodeGeneration.cpp:0:0
#13 0x0000000003d5b6cf polly::CodeGenerationPass::run(polly::Scop&,
llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&,
polly::ScopStandardAnalysisResults&, polly::SPMUpdater&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x3d5b6cf)
#14 0x0000000003d4e63d llvm::detail::PassModel<polly::Scop,
polly::CodeGenerationPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>,
polly::ScopStandardAnalysisResults&, polly::SPMUpdater&>::run(polly::Scop&,
llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>&,
polly::ScopStandardAnalysisResults&, polly::SPMUpdater&) RegisterPasses.cpp:0:0
#15 0x0000000003dbe2f5 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&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x3dbe2f5)
#16 0x0000000003d49840
polly::FunctionToScopPassAdaptor<llvm::PassManager<polly::Scop,
llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>,
polly::ScopStandardAnalysisResults&, polly::SPMUpdater&>
>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)
RegisterPasses.cpp:0:0
#17 0x0000000003d4921d llvm::detail::PassModel<llvm::Function,
polly::FunctionToScopPassAdaptor<llvm::PassManager<polly::Scop,
llvm::AnalysisManager<polly::Scop, polly::ScopStandardAnalysisResults&>,
polly::ScopStandardAnalysisResults&, polly::SPMUpdater&> >,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>
>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)
RegisterPasses.cpp:0:0
#18 0x0000000002555d31 llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2555d31)
#19 0x00000000033d601d llvm::detail::PassModel<llvm::Function,
llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>
>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)
BackendUtil.cpp:0:0
#20 0x0000000002559404 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2559404)
#21 0x00000000033d82dd llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) BackendUtil.cpp:0:0
#22 0x0000000002554a74 llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2554a74)
#23 0x00000000033cbea2 (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#24 0x00000000033c6707 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> >)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x33c6707)
#25 0x00000000037f6b10
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
CodeGenAction.cpp:0:0
#26 0x00000000041506f4 clang::ParseAST(clang::Sema&, bool, bool)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x41506f4)
#27 0x0000000003744600 clang::FrontendAction::Execute()
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x3744600)
#28 0x00000000036bd24f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x36bd24f)
#29 0x00000000037f05f7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x37f05f7)
#30 0x00000000019e43fb cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x19e43fb)
#31 0x00000000019e1f5d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#32 0x00000000035549d2 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long) Job.cpp:0:0
#33 0x0000000002c400f7
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x2c400f7)
#34 0x0000000003554537
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x3554537)
#35 0x000000000351c968
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x351c968)
#36 0x000000000351cc37
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x351cc37)
#37 0x0000000003535141
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x3535141)
#38 0x00000000019e1841 main
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x19e1841)
#39 0x00007f96825f9b25 __libc_start_main (/usr/lib/libc.so.6+0x27b25)
#40 0x00000000019ded8e _start
(/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin/clang-14+0x19ded8e)
clang-14: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
ClangBuiltLinux clang version 14.0.0 (https://github.com/llvm/llvm-project
85b4b21c8bbad346d58a30154d2767c39cf3285a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/nathan/tmp/llvm-85b4b21c8bbad346d58a30154d2767c39cf3285a-assertions/bin
clang-14: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

See https://github.com/ClangBuiltLinux/linux/issues/1460#issuecomment-924230262
and related messages there for additional findings.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210924/0b531716/attachment-0001.html>


More information about the llvm-bugs mailing list