[PATCH] D129997: [Local] Allow creating callbr with duplicate successors
Nathan Chancellor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 13:08:54 PDT 2022
nathanchance added a comment.
Sorry I didn't get a chance to report this until after it was merged (my first round of tests forgot to update Linux to fix some unrelated build breakage) but I see a crash in some PowerPC Linux kernel builds as a result of this change in `net/ceph/messenger_v2.c`. A reduced C reproducer below.
struct ceph_connection_v2_info {
int in_state;
};
struct ceph_connection {
struct {
struct ceph_connection_v2_info v2;
};
};
int process_message_header_con_0;
int ceph_con_in_msg_alloc(int *);
int prepare_read_tail_plain() { return 2; }
int process_message_header() {
int skip = ceph_con_in_msg_alloc(&skip);
if (skip)
return 0;
if (__builtin_constant_p(process_message_header_con_0))
;
else
asm goto("" : : : : __label_warn_on);
__label_warn_on:
return 1;
}
int __handle_control() {
int ret = process_message_header();
if (ret == 0)
return 0;
return prepare_read_tail_plain();
}
void ceph_con_v2_try_read(struct ceph_connection *con) {
for (;;) {
struct ceph_connection __trans_tmp_3 = *con;
switch (__trans_tmp_3.v2.in_state)
case 1:
__handle_control();
}
}
$ clang --target=powerpc64le-linux-gnu -fno-PIE -O2 -c -o /dev/null messenger_v2.i
Use of %0 does not have a corresponding definition on every path:
fatal error: error in backend: Use not jointly dominated by defs.
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: clang --target=powerpc64le-linux-gnu -fno-PIE -O2 -c -o /dev/null messenger_v2.i
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'messenger_v2.i'.
4. Running pass 'Live Interval Analysis' on function '@ceph_con_v2_try_read'
#0 0x00005590013c98e3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4fdc8e3)
#1 0x00005590013c787e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4fda87e)
#2 0x0000559001349713 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
#3 0x000055900134968f llvm::CrashRecoveryContext::HandleExit(int) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4f5c68f)
#4 0x00005590013c40f7 llvm::sys::Process::Exit(int, bool) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4fd70f7)
#5 0x0000558fff6a7772 (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x32ba772)
#6 0x000055900134e599 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4f61599)
#7 0x000055900134e486 (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4f61486)
#8 0x0000559000717b8c llvm::LiveRangeCalc::findReachingDefs(llvm::LiveRange&, llvm::MachineBasicBlock&, llvm::SlotIndex, unsigned int, llvm::ArrayRef<llvm::SlotIndex>) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x432ab8c)
#9 0x0000559000716c96 llvm::LiveRangeCalc::extend(llvm::LiveRange&, llvm::SlotIndex, unsigned int, llvm::ArrayRef<llvm::SlotIndex>) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4329c96)
#10 0x000055900071a465 llvm::LiveIntervalCalc::extendToUses(llvm::LiveRange&, llvm::Register, llvm::LaneBitmask, llvm::LiveInterval*) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x432d465)
#11 0x000055900071a084 llvm::LiveIntervalCalc::calculate(llvm::LiveInterval&, bool) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x432d084)
#12 0x0000559000703542 llvm::LiveIntervals::computeVirtRegInterval(llvm::LiveInterval&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4316542)
#13 0x0000559000702131 llvm::LiveIntervals::computeVirtRegs() (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4315131)
#14 0x0000559000701f11 llvm::LiveIntervals::runOnMachineFunction(llvm::MachineFunction&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4314f11)
#15 0x0000559000778cbd llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x438bcbd)
#16 0x0000559000c263d7 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x48393d7)
#17 0x0000559000c2de81 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4840e81)
#18 0x0000559000c26de5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4839de5)
#19 0x0000559001bccafd 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/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x57dfafd)
#20 0x0000559001fbec6e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#21 0x000055900283e564 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x6451564)
#22 0x0000559001f02220 clang::FrontendAction::Execute() (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x5b15220)
#23 0x0000559001e752cf clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x5a882cf)
#24 0x0000559001fb8312 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x5bcb312)
#25 0x0000558fff6a7240 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x32ba240)
#26 0x0000558fff6a4f0f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#27 0x0000559001cf4842 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
#28 0x0000559001349627 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x4f5c627)
#29 0x0000559001cf439f 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/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x590739f)
#30 0x0000559001cb42fe clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x58c72fe)
#31 0x0000559001cb45ae clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x58c75ae)
#32 0x0000559001cd05d0 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x58e35d0)
#33 0x0000558fff6a458b clang_main(int, char**) (/home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin/clang-15+0x32b758b)
#34 0x00007f4538e10550 __libc_start_call_main (/lib64/libc.so.6+0x23550)
#35 0x00007f4538e10609 __libc_start_main at GLIBC_2.2.5 (/lib64/libc.so.6+0x23609)
#36 0x0000558fff6a1b35 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
clang-15: error: clang frontend command failed with exit code 70 (use -v to see invocation)
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project 08860f525a2363ccd697ebb3ff59769e37b1be21)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/tmp/tmp.A3o6TI3QI1/install/llvm/08860f525a2363ccd697ebb3ff59769e37b1be21/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
The same reproducer does not trigger on the parent commit. `-fno-PIE` is needed for reproducing the crash, it doesn't happen without it. If there is any more information that I can provide or patches I can test, please let me know!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129997/new/
https://reviews.llvm.org/D129997
More information about the llvm-commits
mailing list