[llvm] [MachineFrameInfo] Refactoring with computeMaxcallFrameSize() (NFC) (PR #78001)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 08:27:11 PDT 2024


JonPsson1 wrote:

> I bisect a crash that I see while building the Linux kernel to this change. A trivial reproducer from `cvise` that crashes at this change but not the parent.
> 
> ```c
> void input_report_abs(int);
> void touchscreen_report_pos(_Bool multitouch) {
>   input_report_abs(multitouch ? 5 : 0);
>   input_report_abs(multitouch ? 6 : 1);
> }
> ```
> 
> ```
> $ clang --target=s390x-linux-gnu -O2 -c -o /dev/null touchscreen.i
> clang: /home/nathan/tmp/cvise.IoySpFokBb/src/llvm/lib/CodeGen/PrologEpilogInserter.cpp:376: void (anonymous namespace)::PEI::calculateCallFrameInfo(MachineFunction &): Assertion `(FrameSDOps.empty() || MF.getFrameInfo().adjustsStack()) && "AdjustsStack not set in presence of a frame pseudo instruction."' 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: clang --target=s390x-linux-gnu -O2 -c -o /dev/null touchscreen.i
> 1.	<eof> parser at end of file
> 2.	Code generation
> 3.	Running pass 'Function Pass Manager' on module 'touchscreen.i'.
> 4.	Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@touchscreen_report_pos'
>  #0 0x00000000026f1704 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x26f1704)
>  #1 0x00000000026ef64c llvm::sys::RunSignalHandlers() (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x26ef64c)
>  #2 0x0000000002674bec CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
>  #3 0x0000ffffa16677f0 (linux-vdso.so.1+0x7f0)
>  #4 0x0000ffffa1027c40 __pthread_kill_implementation (/lib64/libc.so.6+0x97c40)
>  #5 0x0000ffffa0fd5940 gsignal (/lib64/libc.so.6+0x45940)
>  #6 0x0000ffffa0fc0288 abort (/lib64/libc.so.6+0x30288)
>  #7 0x0000ffffa0fce340 __assert_fail_base (/lib64/libc.so.6+0x3e340)
>  #8 0x0000ffffa0fce3b4 (/lib64/libc.so.6+0x3e3b4)
>  #9 0x0000000001fad41c (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) PrologEpilogInserter.cpp:0:0
> #10 0x0000000001cda07c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x1cda07c)
> #11 0x0000000002260c18 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2260c18)
> #12 0x000000000226863c llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x226863c)
> #13 0x0000000002261510 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2261510)
> #14 0x0000000002e2fdf0 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*) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2e2fdf0)
> #15 0x0000000002e4fc1c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2e4fc1c)
> #16 0x0000000003f31994 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x3f31994)
> #17 0x00000000031fa970 clang::FrontendAction::Execute() (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x31fa970)
> #18 0x0000000003182590 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x3182590)
> #19 0x00000000032c52f8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x32c52f8)
> #20 0x0000000001905cdc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x1905cdc)
> #21 0x0000000001902cd0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
> #22 0x0000000003031140 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_0>(long) Job.cpp:0:0
> #23 0x0000000002674954 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2674954)
> #24 0x00000000030308f0 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x30308f0)
> #25 0x0000000002ff8474 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2ff8474)
> #26 0x0000000002ff86c0 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x2ff86c0)
> #27 0x00000000030117b0 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x30117b0)
> #28 0x00000000019020a4 clang_main(int, char**, llvm::ToolContext const&) (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x19020a4)
> #29 0x000000000191007c main (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x191007c)
> #30 0x0000ffffa0fc0adc __libc_start_call_main (/lib64/libc.so.6+0x30adc)
> #31 0x0000ffffa0fc0bbc __libc_start_main at GLIBC_2.17 (/lib64/libc.so.6+0x30bbc)
> #32 0x00000000019008f0 _start (/home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin/clang-19+0x19008f0)
> clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
> ClangBuiltLinux clang version 19.0.0git (https://github.com/llvm/llvm-project.git 09bc6abba6e226ad5e9d18d4365690d6f04de21a)
> Target: s390x-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /home/nathan/tmp/cvise.IoySpFokBb/install/llvm-bad/bin
> clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
> ```
> 
> ```
> # bad: [6872a646523c1e85a98dfa20b2f4dd7774e10ba4] [ValueTracking] Handle vector range metadata in isKnownNonZero()
> # good: [192be3c9c13363847d176f2c4bba2bd4be5e822f] fix: constexpr bit_cast with empty base classes (#82383)
> git bisect start '6872a646523c1e85a98dfa20b2f4dd7774e10ba4' '192be3c9c13363847d176f2c4bba2bd4be5e822f'
> # bad: [20f5bcfb1a3b58c430a5df6dd837b30c22a2b788] [OpenMP] Add OpenMP extension API to dump mapping tables (#85381)
> git bisect bad 20f5bcfb1a3b58c430a5df6dd837b30c22a2b788
> # good: [4c5bc7667728d5383c41eb8a20dd5e49257904d2] [libcxx][test] Create feature host-can-create-symlinks (#82204)
> git bisect good 4c5bc7667728d5383c41eb8a20dd5e49257904d2
> # bad: [487f356b20860a3eeb29b836483c639735f9393c] [RemoveDIs][AsmWriter] Add empty-metadata operands to the SlotTracker (#85636)
> git bisect bad 487f356b20860a3eeb29b836483c639735f9393c
> # good: [1d9fb2ee612f0ccf588d40dc4b5445cffd36e8af] [clang][Interp] Disable CFStringMakeConstantString test on AIX
> git bisect good 1d9fb2ee612f0ccf588d40dc4b5445cffd36e8af
> # good: [cb84f130b724f64f88f780c1731a4c6e9cba99cd] [AMDGPU] Remove unneeded addr mode predicates on FLAT Real instructions (#85641)
> git bisect good cb84f130b724f64f88f780c1731a4c6e9cba99cd
> # good: [e2e3624fae669f85de1445bf7037ff29feb30905] [clang][test] Try to fix constexpr-void-cast test
> git bisect good e2e3624fae669f85de1445bf7037ff29feb30905
> # bad: [09bc6abba6e226ad5e9d18d4365690d6f04de21a] [MachineFrameInfo] Refactoring around computeMaxcallFrameSize() (NFC) (#78001)
> git bisect bad 09bc6abba6e226ad5e9d18d4365690d6f04de21a
> # good: [9253950ec1690e786ba1cdaaf3234fb30b633eab] [libclc] Convert tabs to spaces in CMake (#85634)
> git bisect good 9253950ec1690e786ba1cdaaf3234fb30b633eab
> # first bad commit: [09bc6abba6e226ad5e9d18d4365690d6f04de21a] [MachineFrameInfo] Refactoring around computeMaxcallFrameSize() (NFC) (#78001)
> ```

Sorry for the trouble - thanks for the bugreport! Fix proposed at https://github.com/llvm/llvm-project/pull/85945


https://github.com/llvm/llvm-project/pull/78001


More information about the llvm-commits mailing list