<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [mips] After a26f1bf67ec, Bad machine code: Using an undefined physical register"
href="https://bugs.llvm.org/show_bug.cgi?id=51691">51691</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[mips] After a26f1bf67ec, Bad machine code: Using an undefined physical register
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This backend error appeared when compiling the FreeBSD base system for mips or
mips64 with clang 13:
*** Bad machine code: Using an undefined physical register ***
- function: checkfstab
- basic block: %bb.27 if.end51 (0x80768a568)
- instruction: %161:gpr32 = COPY $v1
- operand 1: $v1
fatal error: error in backend: Found 1 machine code errors.
Bisection shows this error starts occurring after
<a href="https://github.com/llvm/llvm-project/commit/a26f1bf67ec">https://github.com/llvm/llvm-project/commit/a26f1bf67ec</a> ("[PassManager] Run
additional LICM before LoopRotate "), so I am suspecting that this exposes a
latent bug somewhere in the Mips backend? (As these test cases seem to work
fine on other architectures.)
Minimized test case for 32-bit mips:
// clang -cc1 -triple mips-- -S -mrelocation-model static -target-cpu mips2 -O2
preen-min.c
typedef struct {
int a[0];
} b;
b c;
extern _Thread_local b *d;
int e, f, ay;
struct {
int g;
int h;
} * k;
char *ax;
b *l() {
if (d)
return d;
return &c;
}
int m() {
int i = 0, j = i;
f = l()->a[j];
return e;
}
char *n();
void o();
void q() {
if (k)
o(&k->h, k);
}
void o(char *r, int *s, int *t) {
char aw = *s;
char *p = n();
if (p)
p = &aw;
for (; *p && m(); p++)
for (; 0; ay = *t)
;
ax = r;
}
Minimized test case for 64-bit mips (looking very similar, though derived from
a very different source file):
// clang -cc1 -triple mips64-- -S -target-cpu mips3 -O2
-ftls-model=initial-exec tw-min.c
typedef struct {
int a[0];
} b;
b *c;
extern _Thread_local b *d;
int e, f;
b *g() {
if (d)
return d;
return c;
}
int h(j) {
int i = j;
e = g()->a[i];
return 1;
}
void k() {
int *a;
for (a = 0; f;)
if (0 ?: h) {
int b;
a++;
if (*a) {
b = 0;
a++;
}
for (; h(*a);)
;
}
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>