Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure in llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp after commit f91cc09a5a90 in -next #2043

Open
nathanchance opened this issue Jul 26, 2024 · 2 comments
Labels
[ARCH] hexagon This bug impacts ARCH=hexagon [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 20 This bug was fixed in LLVM 20 [PATCH] Submitted A patch has been submitted for review Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.

Comments

@nathanchance
Copy link
Member

After commit f91cc09a5a90 ("bcachefs: Btree path tracepoints") in linux-next, there is a crash when assertions are enabled (or a hang when they are not):

$ make -skj"$(nproc)" ARCH=hexagon LLVM=1 mrproper allmodconfig fs/bcachefs/btree_io.o
clang: llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp:745: bool (anonymous namespace)::HexagonConstExtenders::ExtRoot::operator<(const HCE::ExtRoot &) const: Assertion `ThisB->getParent() == OtherB->getParent()' 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: /home/nathan/cbl/toolchains/llvm-latest/bin/clang --target=hexagon-linux-musl -fintegrated-as .../fs/bcachefs/btree_io.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'fs/bcachefs/btree_io.c'.
4.      Running pass 'Hexagon constant-extender optimization' on function '@__btree_node_lock_nopath'
...

I reported this upstream at llvm/llvm-project#99714.

I plan to send this diff soon to avoid this problematic pass for now, eventually changing it to be gated by a broken version check.

diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
index 92d005958dfb..49679120e975 100644
--- a/arch/hexagon/Makefile
+++ b/arch/hexagon/Makefile
@@ -32,3 +32,6 @@ KBUILD_LDFLAGS += $(ldflags-y)
 TIR_NAME := r19
 KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
 KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
+
+# https://github.com/llvm/llvm-project/issues/99714
+KBUILD_CFLAGS += -mllvm -hexagon-cext=false
@nathanchance nathanchance added [BUG] llvm A bug that should be fixed in upstream LLVM [ARCH] hexagon This bug impacts ARCH=hexagon Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. labels Jul 26, 2024
@nathanchance
Copy link
Member Author

This is now fixed in main: llvm/llvm-project@68df06a

A backport to 19.1 has been requested, so I will send the above change once that is merged.

@nathanchance nathanchance added the [FIXED][LLVM] 20 This bug was fixed in LLVM 20 label Aug 8, 2024
@nathanchance
Copy link
Member Author

Workaround for older releases submitted as the patch has been back ported to 19.1: https://lore.kernel.org/20240819-hexagon-disable-constant-expander-pass-v1-1-36a734e9527d@kernel.org

@nathanchance nathanchance added the [PATCH] Submitted A patch has been submitted for review label Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] hexagon This bug impacts ARCH=hexagon [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 20 This bug was fixed in LLVM 20 [PATCH] Submitted A patch has been submitted for review Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.
Projects
None yet
Development

No branches or pull requests

1 participant