Issue 176227
Summary [RISCV] Crash in Machine Instruction Scheduler for invalid global physical register w/ a fixed register
Labels backend:RISC-V, crash-on-valid
Assignees
Reporter ilovepi
    We're seeing some compiler crashes in codegen for RISC-V in Fuchsia builds. This is a new build configuration in our CI, so its unclear when this may have been introduced. I have a suspicion that this is related to the recent changes to the default scheduling model, but I haven't started bisecting yet.

Error from CI:
```
FAILED: [code=1] kernel_riscv64/obj/zircon/kernel/arch/riscv64/riscv64.mp.cc.o 
../../prebuilt/third_party/clang/custom/bin/clang++ -MD -MF kernel_riscv64/obj/zircon/kernel/arch/riscv64/riscv64.mp.cc.o.d -o kernel_riscv64/obj/zircon/kernel/arch/riscv64/riscv64.mp.cc.o -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -DSMP_MAX_CPUS=16 -D_KERNEL -DLK -DENABLE_PANIC_SHELL -DZIRCON_TOOLCHAIN -DLK_DEBUGLEVEL=2 -DDEBUG_PRINT_LEVEL=2 -DVM_TRACING_LEVEL=0 -DFUTEX_BLOCK_TRACING_ENABLED=false -DLOCK_NAME_TRACING_ENABLED=false -DEXPERIMENTAL_THREAD_SAMPLER_ENABLED=false -DEXPERIMENTAL_KTRACE_STREAMING_ENABLED=true -DEXPERIMENTAL_FORCE_NEW_WAKEUP_ACCOUNTING=false -DCHANNEL_MESSAGE_BODY_TRACING_ENABLED=false -DJTRACE_TARGET_BUFFER_SIZE=0 -DSCHEDULER_TRACING_LEVEL=0 -DSCHEDULER_QUEUE_TRACING_ENABLED=false -DSCHEDULER_EXTRA_INVARIANT_VALIDATION=false -DSCHEDULER_LOCK_SPIN_TRACING_COMPRESSED=false -DSCHEDULER_LOCK_SPIN_TRACING_ENABLED=false -DWAIT_QUEUE_DEPTH_TRACING_ENABLED=false -DKERNEL_IMAGE_MAX_SIZE=14680064 -DWITH_FRAME_POINTERS=1 -DZX_ASSERT_LEVEL=2 -DMIN_CRASHLOG_SIZE=2048 -DPERSISTENT_RAM_ALLOCATION_GRANULARITY=128 -DKERNEL_MEMORY_PROFILER=false -DLIB_ARCH_PAGING_CONFIGURATION=\"sv39\" -I../../zircon/kernel/include -I../../zircon/kernel/lib/libc/include -I../../zircon/kernel/lib/ktl/include -I../../sdk/lib/fit/include -I../../zircon/kernel/lib/heap/include -I../../zircon/kernel/lib/lockup_detector/include -I../../zircon/system/ulib/lazy_init/include -I../../zircon/system/ulib/lockdep/include -I../../zircon/system/ulib/ffl/include -I../../zircon/kernel/lib/kconcurrent/include -I../../zircon/system/ulib/concurrent/include -I../../zircon/kernel/vm/include -I../../zircon/kernel/vm/phys/include -I../../zircon/kernel/lib/user_copy/include -I../../zircon/kernel/lib/acpi_lite/include -I../../zircon/kernel/lib/boot-options/include -I../../zircon/kernel/lib/devicetree/include -I../../zircon/system/ulib/uart/include -I../../zircon/system/ulib/hwreg/include -I../../zircon/kernel/phys/lib/memalloc/include -I../../zircon/system/ulib/zircon-internal/include -I../../zircon/kernel/lib/spsc_buffer/include -I../../src/performance/lib/fxt/include -I../../zircon/kernel/lib/special-sections/include -I../../zircon/system/ulib/fbl/include -I../../zircon/kernel/lib/fbl/include -I../../zircon/system/ulib/mmio-ptr/include -I../../zircon/kernel/lib/id_allocator/include -I../../zircon/system/ulib/zx/include -I../../sdk/lib/stdcompat/include -I../../zircon/kernel/lib/backtrace/include -I../../zircon/kernel/lib/version/include -I../../zircon/kernel/lib/wake-vector/include -I../../zircon/kernel/lib/sched/include -I../../zircon/kernel/lib/arch/riscv64/include -I../../zircon/kernel/lib/arch/include -I../../sdk/lib/zbi-format/include -I../../zircon/kernel/lib/power-management/include -I../../zircon/kernel/lib/stall/include -I../../zircon/system/public -I../../sdk/lib/zircon-assert -I../../zircon/kernel/arch/riscv64/include -I../../zircon/kernel/dev/iommu/stub/include -I../../zircon/kernel/dev/pdev/power/include -I../../zircon/kernel/dev/pdev/timer/include -Igen/zircon/kernel/lib/arch/gen-arm64-feature-asm.include -Igen/zircon/kernel/lib/arch/gen-arm64-system-asm.include -Igen/zircon/kernel/lib/arch/gen-riscv64-system-asm.include -Igen/zircon/kernel/lib/arch/gen-x86-msr-asm.include -Igen/zircon/kernel/lib/arch/gen-x86-cpuid-asm.include -I../../src/zircon/lib/zircon/include -Ifidling/gen/zircon/vdso/zx/zither/legacy_syscall_cdecl -I../../zircon/kernel/lib/code-patching/include -Igen/zircon/kernel/lib/code-patching/case-id-asm.include -I../../src/lib/zbitl/include -I../../zircon/third_party/ulib/cksum/include -I../../zircon/kernel/lib/efi/include -I../../zircon/kernel/arch/riscv64/code-patches/include -I../../zircon/kernel/lib/console/include -I../../zircon/kernel/lib/counters/include -I../../zircon/kernel/lib/crashlog/include -I../../zircon/kernel/lib/init/include -I../../zircon/kernel/lib/page/include -I../../zircon/kernel/lib/syscalls/include -Ifidling/gen/zircon/vdso/zx/zither/kernel -I../../zircon/kernel/lib/thread-stack/include -I../../zircon/kernel/phys/include -I../../zircon/kernel/arch/riscv64/phys/include -I../../zircon/kernel/lib/unittest/include -I../../zircon/kernel/object/include -I../../zircon/kernel/lib/crypto/include -I../../zircon/third_party/lib/jitterentropy/include -I../../zircon/kernel/lib/page_cache/include -I../../zircon/kernel/lib/instrumentation/include -I../../zircon/kernel/lib/object_cache/include -I../../zircon/kernel/dev/pcie/include -I../../zircon/kernel/dev/interrupt/include -I../../zircon/system/ulib/region-alloc/include -I../../zircon/kernel/lib/debuglog/include -I../../zircon/system/ulib/affine/include -I../../src/lib/elfldltl/include -I../../zircon/system/ulib/bitmap/include -I../../zircon/system/ulib/pretty/include -idirafter ../../zircon/kernel/lib/libc/include-after -idirafter ../../zircon/kernel/lib/ktl/include-after -Xclang -debug-info-kind=constructor -g3 -grecord-gcc-switches -gdwarf-4 -gz=zstd -fdata-sections -ffunction-sections -O2 -Wall -Wextra -Wconversion -Wextra-semi -Wimplicit-fallthrough -Wnewline-eof -Wstrict-prototypes -Wwrite-strings -Wno-sign-conversion -Wno-unused-parameter -Wnonportable-system-include-path -Wno-missing-field-initializers -Wno-extra-qualification -Wno-cast-function-type-mismatch -Wno-unknown-warning-option -Wno-missing-template-arg-list-after-template-kw -Wno-deprecated-pragma -Wno-nontrivial-memaccess -ftrivial-auto-var-init=pattern -ffile-compilation-dir=. -no-canonical-prefixes -fvisibility=hidden -Wthread-safety -Wno-unknown-warning-option -Wno-thread-safety-reference-return -Werror -Wa,--fatal-warnings -fno-common -fsized-deallocation --target=riscv64-fuchsia -msmall-data-limit=0 -march=rv64gcv_zihintpause_zba_zbb_zbs_zicbom_zicbop_zicboz_zfhmin_zkt -mabi=lp64d -fcolor-diagnostics -fcrash-diagnostics-dir=clang-crashreports -fcrash-diagnostics=all -gen-reproducer=error -fstack-size-section -ffuchsia-api-level=4293918720 -fpie -ffreestanding -include ../../zircon/kernel/include/hidden.h -fno-unwind-tables -Wformat=2 -Wmissing-declarations -Wvla -Wshadow -march=rv64imac_zihintpause_zba_zbb_zbs_zicbom_zicbop_zicboz_zfhmin_zkt_zicsr_zifencei -mabi=lp64 -ffixed-x27 -fno-sanitize=safe-stack -fsanitize=shadow-call-stack -fno-finite-loops -fdata-sections -fno-omit-frame-pointer -momit-leaf-frame-pointer -fno-omit-frame-pointer -momit-leaf-frame-pointer -idirafter ../../zircon/kernel/lib/ktl/include-after -idirafter ../../zircon/kernel/lib/libc/include-after -idirafter ../../zircon/kernel/lib/ktl/include-after -Wno-deprecated-this-capture -std=c++20 -fno-exceptions -fno-rtti -Xclang -fexperimental-omit-vtable-rtti -fvisibility-inlines-hidden -ftemplate-backtrace-limit=0 -faligned-new=8 -fno-exceptions -c ../../zircon/kernel/arch/riscv64/mp.cc
The register $x27 needs to be live in to %bb.2, but is missing from the live-in list.
fatal error: error in backend: Invalid global physical register
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: ../../prebuilt/third_party/clang/custom/bin/clang++ -MD -MF kernel_riscv64/obj/zircon/kernel/arch/riscv64/riscv64.mp.cc.o.d -o kernel_riscv64/obj/zircon/kernel/arch/riscv64/riscv64.mp.cc.o -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -DSMP_MAX_CPUS=16 -D_KERNEL -DLK -DENABLE_PANIC_SHELL -DZIRCON_TOOLCHAIN -DLK_DEBUGLEVEL=2 -DDEBUG_PRINT_LEVEL=2 -DVM_TRACING_LEVEL=0 -DFUTEX_BLOCK_TRACING_ENABLED=false -DLOCK_NAME_TRACING_ENABLED=false -DEXPERIMENTAL_THREAD_SAMPLER_ENABLED=false -DEXPERIMENTAL_KTRACE_STREAMING_ENABLED=true -DEXPERIMENTAL_FORCE_NEW_WAKEUP_ACCOUNTING=false -DCHANNEL_MESSAGE_BODY_TRACING_ENABLED=false -DJTRACE_TARGET_BUFFER_SIZE=0 -DSCHEDULER_TRACING_LEVEL=0 -DSCHEDULER_QUEUE_TRACING_ENABLED=false -DSCHEDULER_EXTRA_INVARIANT_VALIDATION=false -DSCHEDULER_LOCK_SPIN_TRACING_COMPRESSED=false -DSCHEDULER_LOCK_SPIN_TRACING_ENABLED=false -DWAIT_QUEUE_DEPTH_TRACING_ENABLED=false -DKERNEL_IMAGE_MAX_SIZE=14680064 -DWITH_FRAME_POINTERS=1 -DZX_ASSERT_LEVEL=2 -DMIN_CRASHLOG_SIZE=2048 -DPERSISTENT_RAM_ALLOCATION_GRANULARITY=128 -DKERNEL_MEMORY_PROFILER=false -DLIB_ARCH_PAGING_CONFIGURATION=\"sv39\" -I../../zircon/kernel/include -I../../zircon/kernel/lib/libc/include -I../../zircon/kernel/lib/ktl/include -I../../sdk/lib/fit/include -I../../zircon/kernel/lib/heap/include -I../../zircon/kernel/lib/lockup_detector/include -I../../zircon/system/ulib/lazy_init/include -I../../zircon/system/ulib/lockdep/include -I../../zircon/system/ulib/ffl/include -I../../zircon/kernel/lib/kconcurrent/include -I../../zircon/system/ulib/concurrent/include -I../../zircon/kernel/vm/include -I../../zircon/kernel/vm/phys/include -I../../zircon/kernel/lib/user_copy/include -I../../zircon/kernel/lib/acpi_lite/include -I../../zircon/kernel/lib/boot-options/include -I../../zircon/kernel/lib/devicetree/include -I../../zircon/system/ulib/uart/include -I../../zircon/system/ulib/hwreg/include -I../../zircon/kernel/phys/lib/memalloc/include -I../../zircon/system/ulib/zircon-internal/include -I../../zircon/kernel/lib/spsc_buffer/include -I../../src/performance/lib/fxt/include -I../../zircon/kernel/lib/special-sections/include -I../../zircon/system/ulib/fbl/include -I../../zircon/kernel/lib/fbl/include -I../../zircon/system/ulib/mmio-ptr/include -I../../zircon/kernel/lib/id_allocator/include -I../../zircon/system/ulib/zx/include -I../../sdk/lib/stdcompat/include -I../../zircon/kernel/lib/backtrace/include -I../../zircon/kernel/lib/version/include -I../../zircon/kernel/lib/wake-vector/include -I../../zircon/kernel/lib/sched/include -I../../zircon/kernel/lib/arch/riscv64/include -I../../zircon/kernel/lib/arch/include -I../../sdk/lib/zbi-format/include -I../../zircon/kernel/lib/power-management/include -I../../zircon/kernel/lib/stall/include -I../../zircon/system/public -I../../sdk/lib/zircon-assert -I../../zircon/kernel/arch/riscv64/include -I../../zircon/kernel/dev/iommu/stub/include -I../../zircon/kernel/dev/pdev/power/include -I../../zircon/kernel/dev/pdev/timer/include -Igen/zircon/kernel/lib/arch/gen-arm64-feature-asm.include -Igen/zircon/kernel/lib/arch/gen-arm64-system-asm.include -Igen/zircon/kernel/lib/arch/gen-riscv64-system-asm.include -Igen/zircon/kernel/lib/arch/gen-x86-msr-asm.include -Igen/zircon/kernel/lib/arch/gen-x86-cpuid-asm.include -I../../src/zircon/lib/zircon/include -Ifidling/gen/zircon/vdso/zx/zither/legacy_syscall_cdecl -I../../zircon/kernel/lib/code-patching/include -Igen/zircon/kernel/lib/code-patching/case-id-asm.include -I../../src/lib/zbitl/include -I../../zircon/third_party/ulib/cksum/include -I../../zircon/kernel/lib/efi/include -I../../zircon/kernel/arch/riscv64/code-patches/include -I../../zircon/kernel/lib/console/include -I../../zircon/kernel/lib/counters/include -I../../zircon/kernel/lib/crashlog/include -I../../zircon/kernel/lib/init/include -I../../zircon/kernel/lib/page/include -I../../zircon/kernel/lib/syscalls/include -Ifidling/gen/zircon/vdso/zx/zither/kernel -I../../zircon/kernel/lib/thread-stack/include -I../../zircon/kernel/phys/include -I../../zircon/kernel/arch/riscv64/phys/include -I../../zircon/kernel/lib/unittest/include -I../../zircon/kernel/object/include -I../../zircon/kernel/lib/crypto/include -I../../zircon/third_party/lib/jitterentropy/include -I../../zircon/kernel/lib/page_cache/include -I../../zircon/kernel/lib/instrumentation/include -I../../zircon/kernel/lib/object_cache/include -I../../zircon/kernel/dev/pcie/include -I../../zircon/kernel/dev/interrupt/include -I../../zircon/system/ulib/region-alloc/include -I../../zircon/kernel/lib/debuglog/include -I../../zircon/system/ulib/affine/include -I../../src/lib/elfldltl/include -I../../zircon/system/ulib/bitmap/include -I../../zircon/system/ulib/pretty/include -idirafter ../../zircon/kernel/lib/libc/include-after -idirafter ../../zircon/kernel/lib/ktl/include-after -Xclang -debug-info-kind=constructor -g3 -grecord-gcc-switches -gdwarf-4 -gz=zstd -fdata-sections -ffunction-sections -O2 -Wall -Wextra -Wconversion -Wextra-semi -Wimplicit-fallthrough -Wnewline-eof -Wstrict-prototypes -Wwrite-strings -Wno-sign-conversion -Wno-unused-parameter -Wnonportable-system-include-path -Wno-missing-field-initializers -Wno-extra-qualification -Wno-cast-function-type-mismatch -Wno-unknown-warning-option -Wno-missing-template-arg-list-after-template-kw -Wno-deprecated-pragma -Wno-nontrivial-memaccess -ftrivial-auto-var-init=pattern -ffile-compilation-dir=. -no-canonical-prefixes -fvisibility=hidden -Wthread-safety -Wno-unknown-warning-option -Wno-thread-safety-reference-return -Werror -Wa,--fatal-warnings -fno-common -fsized-deallocation --target=riscv64-fuchsia -msmall-data-limit=0 -march=rv64gcv_zihintpause_zba_zbb_zbs_zicbom_zicbop_zicboz_zfhmin_zkt -mabi=lp64d -fcolor-diagnostics -fcrash-diagnostics-dir=clang-crashreports -fcrash-diagnostics=all -gen-reproducer=error -fstack-size-section -ffuchsia-api-level=4293918720 -fpie -ffreestanding -include ../../zircon/kernel/include/hidden.h -fno-unwind-tables -Wformat=2 -Wmissing-declarations -Wvla -Wshadow -march=rv64imac_zihintpause_zba_zbb_zbs_zicbom_zicbop_zicboz_zfhmin_zkt_zicsr_zifencei -mabi=lp64 -ffixed-x27 -fno-sanitize=safe-stack -fsanitize=shadow-call-stack -fno-finite-loops -fdata-sections -fno-omit-frame-pointer -momit-leaf-frame-pointer -fno-omit-frame-pointer -momit-leaf-frame-pointer -idirafter ../../zircon/kernel/lib/ktl/include-after -idirafter ../../zircon/kernel/lib/libc/include-after -idirafter ../../zircon/kernel/lib/ktl/include-after -Wno-deprecated-this-capture -std=c++20 -fno-exceptions -fno-rtti -Xclang -fexperimental-omit-vtable-rtti -fvisibility-inlines-hidden -ftemplate-backtrace-limit=0 -faligned-new=8 -fno-exceptions -c ../../zircon/kernel/arch/riscv64/mp.cc
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '../../zircon/kernel/arch/riscv64/mp.cc'.
4.	Running pass 'Machine Instruction Scheduler' on function '@_Z26riscv64_software_exceptionv'
#0 0x00005592afee87f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../prebuilt/third_party/clang/custom/bin/clang+++0x97c77f8)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Fuchsia clang version 23.0.0git (https://llvm.googlesource.com/llvm-project 444adbe53472582f3f077fa1a16e52df97caddb8)
Target: riscv64-unknown-fuchsia
Thread model: posix
InstalledDir: ../../prebuilt/third_party/clang/custom/bin
Build config: +assertions
clang++: note: diagnostic msg: 
**<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to