Consider the following functions.
https://godbolt.org/z/KxdWKofjd
int test2(int a) {
if (a / 5)
return 0;
else
return (2 * a / 9);
}
int test3(int a) {
if (a / 5)
return 0;
else
return (3 * a / 13);
}
int test4(int a) {
if (a / 5)
return 0;
else
return (4 * a / 17);
}
int test5(int a) {
if (a / 5)
return 0;
else
return (5 * a / 21);
}
int test6(int a) {
if (a / 5)
return 0;
else
return (6 * a / 25);
}
int test7(int a) {
if (a / 5)
return 0;
else
return (7 * a / 29);
}
int test8(int a) {
if (a / 5)
return 0;
else
return (8 * a / 33);
}
All of these functions can be optimized (to the function which returns zero), but Clang cannot optimize test2, test4, and test8.