Bug#988965: llvm-toolchain-12: llvm 12 generates bad human-readable IR output on mipsel

Ximin Luo <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <162163643348.1020279.10419295410525468894.reportbug__18407.986143005$1621636946$gmane$org@localhost>
Source: llvm-toolchain-12
Version: 1:12.0.0-3
Severity: important
X-Debbugs-Cc: [email protected], [email protected]

Dear Maintainer,

LLVM 12's ability to emit IR in human-readable form is corrupted on mipsel 32-bit:

$ cat main.c 
#include <string.h>

int main() {
  char *a = NULL;
  char *b = NULL;
  memcpy(a, b, 0);
}
$ clang-12 -S -emit-llvm main.c
$ grep 00G8 main.ll
  call void @llvm.memcpy.00G8.00G8.G32(i8* align 1 %3, i8* align 1 %4, i32 0, i1 false)
declare void @llvm.memcpy.00G8.00G8.G32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1

00G8 is not correct, it should be p0i8 and suggests miscompilation somewhere as
the source code of the function does not contain these characters:

https://github.com/llvm/llvm-project/blob/5b6cae5524905bc43cfc21a515f828528d1f2e68/llvm/lib/IR/Function.cpp#L777

This additionally makes some rustc tests fail.

LLVM 11 is fine.

I filed a Debian bug for now because I could not find any other LLVM 12 mipsel
binaries to test with online; neither upstream nor Fedora distribute these.
Please do forward upstream if you are confident this is not a Debian-specific
issue.

X

-- System Information:
Debian Release: 11.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-security'), (500, 'testing-debug'), (500, 'stable'), (300, 'unstable'), (100, 'experimental'), (1, 'experimental-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.9.0-4-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.