[llvm-bugs] [Bug 42762] New: unexpected codegen for inline asm
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 25 14:25:48 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42762
Bug ID: 42762
Summary: unexpected codegen for inline asm
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: PowerPC
Assignee: unassignedbugs at nondot.org
Reporter: ndesaulniers at google.com
CC: hfinkel at anl.gov, kit.barton at gmail.com,
llvm-bugs at lists.llvm.org, nemanja.i.ibm at gmail.com
Blocks: 4068
The powerpc (32b) Linux kernel started panicing at runtime recently when built
with LLVM due to a change in the kernel sources. We narrowed it down to
commit, and a single call site of a static inline function containing extended
inline assembly with constraints.
I think this concise test case distills this issue:
https://godbolt.org/z/E4f1Us
Basically, we had:
// from arch/powerpc/include/asm/cache.h
// pre-commit 6c5875843b87 ("powerpc: slightly improve cache helpers")
void dcbz_old(void* addr)
{
asm volatile ("dcbz 0, %0" : : "r"(addr) : "memory");
}
then moved to:
// from arch/powerpc/include/asm/cache.h
// post-commit 6c5875843b87 ("powerpc: slightly improve cache helpers")
void dcbz_current(void* addr)
{
asm volatile ("dcbz %y0" :: "Z"(*(unsigned char*)addr) : "memory");
}
It seems that GCC generates the same code for both cases, and LLVM matches GCC
for the first case. In the second case, the codegen is wildly different, which
seems like what's leading to our panic at runtime.
I'm not super familiar with the "Z" constraint and "%y" output format, but they
might be related?
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=4068
[Bug 4068] [Meta] Compiling the Linux kernel with clang
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190725/989f44fc/attachment.html>
More information about the llvm-bugs
mailing list