https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108750
Bug ID: 108750
Summary: Loop unswitching fails for poly_int conditions
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rsandifo at gcc dot gnu.org
Target Milestone: ---
Loop unswitching fails to handle:
#include <arm_sve.h>
void foo(int *x, int *y, int z) {
for (int i = 0; i < 100; ++i)
if (svcntb() >= 4)
x[i] = y[i] + 1;
else
y[i] += 1;
}
(although it does of course handle the result of replacing svcntb() with a
variable). From a quick check, simply removing:
/* At least the LHS needs to be symbolic. */
if (TREE_CODE (gimple_cond_lhs (stmt)) != SSA_NAME)
return;
seems to fix it, but I've no idea what the fallout of that would be.