-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
Description
Reduced testcase:
int f(int* a, int b, int c, int size) {
union {
int value;
struct {
int flag : 1;
int data : 31;
} parts;
} u;
for (int i = 0; i < size; i++) {
if (a[i] > 0 && b < 10) {
if (c > 5 && a[i] % 3 == 0) {
c += a[i];
a[i] = 0;
u.value = c;
if (u.parts.flag) {
b += 2;
}
if (c > 10) {
u.parts.flag = -1;
}
if (b > 5 && (c % 4 == 0 || c % 7 == 0)) {
a[i] = c - b;
if ((c - b) % 2 == 0 && (c - b) > 5) {
a[i + 1] = (c - b) * 3;
}
if (a[i] > 10) {
a[i] = a[i] / 2;
}
}
// Additional union code usage
u.parts.data = a[i] * 2;
a[i] = u.value;
if (u.parts.flag) {
a[i] += 1;
}
}
return 0;
}
}
return (c % 2 == 0) ? 0 : 1;
}
Size after/before:
[davidino@alcor]$ size /tmp/with
text data bss dec hex filename
287 0 0 287 11f /tmp/with
[davidino@alcor]$ size /tmp/without
text data bss dec hex filename
264 0 0 264 108 /tmp/without
This bisects to:
commit 0659000ff79decc1173aac140d4b0325fe696c57 (HEAD)
Author: Nikita Popov <[email protected]>
Date: Wed Apr 26 10:00:42 2023 +0200
[LICM] Don't duplicate instructions just because they're free
Unclear to me if this is the real regression or it's exposing something else, but I wanted to report anyway.