[PATCH] D61314: [SCCP] Remove forcedconstant, go to overdefined instead
Nathan Chancellor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 20:22:34 PST 2020
nathanchance added a comment.
The Linux kernel hits the assert in `markConstant` on arm32 defconfig in net/mac80211/sta_info.o, as reported by Linaro's CI:
00:14:30 clang: /home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-src/lib/Transforms/Scalar/SCCP.cpp:131: bool {anonymous}::LatticeVal::markConstant(llvm::Constant*): Assertion `isUnknown()' failed.
00:14:30 Stack dump:
00:14:30 0. Program arguments: /home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang -Wp,-MD,net/mac80211/.sta_info.o.d -nostdinc -isystem /home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/lib/clang/11.0.0/include -I./arch/arm/include -I./arch/arm/include/generated -I./include -I./arch/arm/include/uapi -I./arch/arm/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mbig-endian -Qunused-arguments -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 --target=arm-linux-gnueabihf --prefix=/usr/bin/ --gcc-toolchain=/usr -no-integrated-as -Werror=unknown-warning-option -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mfpu=vfp -funwind-tables -meabi gnu -marm -Wa,-mno-warn-deprecated -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s -msoft-float -Uarm -fno-delete-null-pointer-checks -Wno-address-of-packed-member -O2 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -mno-global-merge -Wno-unused-const-variable -ftrivial-auto-var-init=pattern -pg -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -fmacro-prefix-map=./= -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -DDEBUG -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -DKBUILD_MODFILE="net/mac80211/mac80211" -DKBUILD_BASENAME="sta_info" -DKBUILD_MODNAME="mac80211" -c -o net/mac80211/sta_info.o net/mac80211/sta_info.c
00:14:30 1. <eof> parser at end of file
00:14:30 2. Per-module optimization passes
00:14:30 3. Running pass 'Interprocedural Sparse Conditional Constant Propagation' on module 'net/mac80211/sta_info.c'.
00:14:31 #0 0x000055995af27e4a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1b48e4a)
00:14:31 #1 0x000055995af25944 llvm::sys::RunSignalHandlers() (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1b46944)
00:14:31 #2 0x000055995af25bb5 llvm::sys::CleanupOnSignal(unsigned long) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1b46bb5)
00:14:31 #3 0x000055995ae9cf38 CrashRecoverySignalHandler(int) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1abdf38)
00:14:31 #4 0x00007f9138484890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
00:14:31 #5 0x00007f9137135e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
00:14:31 #6 0x00007f9137137801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
00:14:31 #7 0x00007f913712739a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
00:14:31 #8 0x00007f9137127412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
00:14:31 #9 0x000055995ae0aced (anonymous namespace)::LatticeVal::markConstant(llvm::Constant*) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1a2bced)
00:14:31 #10 0x000055995ae0cf33 (anonymous namespace)::SCCPSolver::markConstant(llvm::Value*, llvm::Constant*) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1a2df33)
00:14:31 #11 0x000055995ae12875 llvm::InstVisitor<(anonymous namespace)::SCCPSolver, void>::visit(llvm::Instruction&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1a33875)
00:14:31 #12 0x000055995ae133de (anonymous namespace)::SCCPSolver::markUsersAsChanged(llvm::Value*) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1a343de)
00:14:31 #13 0x000055995ae1389c (anonymous namespace)::SCCPSolver::Solve() (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1a3489c)
00:14:31 #14 0x000055995ae1511f llvm::runIPSCCP(llvm::Module&, llvm::DataLayout const&, std::function<llvm::TargetLibraryInfo const& (llvm::Function&)>, llvm::function_ref<llvm::AnalysisResultsForFn (llvm::Function&)>) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1a3611f)
00:14:31 #15 0x000055995aa73269 (anonymous namespace)::IPSCCPLegacyPass::runOnModule(llvm::Module&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1694269)
00:14:31 #16 0x000055995a9342b1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x15552b1)
00:14:31 #17 0x000055995b14d70d (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1d6e70d)
00:14:31 #18 0x000055995b14f195 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/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1d70195)
00:14:31 #19 0x000055995bc60bf5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2881bf5)
00:14:31 #20 0x000055995c572379 clang::ParseAST(clang::Sema&, bool, bool) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x3193379)
00:14:31 #21 0x000055995bc60d78 clang::CodeGenAction::ExecuteAction() (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2881d78)
00:14:31 #22 0x000055995b694419 clang::FrontendAction::Execute() (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x22b5419)
00:14:31 #23 0x000055995b653352 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2274352)
00:14:31 #24 0x000055995b743b0c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2364b0c)
00:14:31 #25 0x0000559959f99d14 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0xbbad14)
00:14:31 #26 0x0000559959f950c9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0xbb60c9)
00:14:31 #27 0x000055995b535e55 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::'lambda'()>(long) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2156e55)
00:14:31 #28 0x000055995ae9d013 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x1abe013)
00:14:31 #29 0x000055995b536938 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/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2157938)
00:14:31 #30 0x000055995b512215 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2133215)
00:14:31 #31 0x000055995b512cd1 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x2133cd1)
00:14:31 #32 0x000055995b51b129 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0x213c129)
00:14:31 #33 0x0000559959f29a7f main (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0xb4aa7f)
00:14:31 #34 0x00007f9137118b97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
00:14:31 #35 0x0000559959f94c2a _start (/home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin/clang+0xbb5c2a)
00:14:31 clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
00:14:31 clang version 11.0.0
00:14:31 Target: arm-unknown-linux-gnueabihf
00:14:31 Thread model: posix
00:14:31 InstalledDir: /home/tcwg-buildslave/workspace/tcwg_kernel_1/llvm-install/bin
00:14:31 clang-11: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
00:14:31 clang-11: note: diagnostic msg:
00:14:31 ********************
00:14:31
00:14:31 PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
00:14:31 Preprocessed source(s) and associated run script(s) are located at:
00:14:31 clang-11: note: diagnostic msg: /tmp/sta_info-eeebaf.c
00:14:31 clang-11: note: diagnostic msg: /tmp/sta_info-eeebaf.sh
00:14:31 clang-11: note: diagnostic msg:
00:14:31
00:14:31 ********************
00:14:31 LLVM ERROR: out of memory
00:14:31 Aborted (core dumped)
I've creduce'd it down to
enum { a };
enum b { c, d };
e;
static _Bool g(struct f *h, enum b i) {
i &&j();
return a;
}
static k(char h, enum b i) {
_Bool l = g(e, i);
l;
}
m(h) {
k(h, c);
g(h, d);
}
The full preprocessed file and interestingness test are available here: https://github.com/nathanchance/creduce-files/tree/872520243c62229267aa0ad0b091a5f4e6e1e2be/aadb635e04854220064b77cc10d0e6772f5492fd
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61314/new/
https://reviews.llvm.org/D61314
More information about the llvm-commits
mailing list