You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though an intrinsic may be vectorized, the backend may end up scalarizing it.
Usually in this case the IntrCost >= CallCost, so NoCallIntrinsic will already detect the case when it's not scalarized and exclude it from the cost.
This fixes examples like
#include <math.h>
void f(double *f) {
double a = f[0], b = f[1];
a += 1;
b += 1;
a = tanh(a);
b = tanh(b);
a += 1;
b += 1;
f[0] = a;
f[1] = b;
}
From being unprofitably vectorized to this after llvm#124984
vsetivli zero, 2, e64, m1, ta, ma
vle64.v v8, (a0)
.Lpcrel_hi0:
auipc a0, %pcrel_hi(.LCPI0_0)
fld fs1, %pcrel_lo(.Lpcrel_hi0)(a0)
vfadd.vf v8, v8, fs1
addi a0, sp, 16
vs1r.v v8, (a0) # Unknown-size Folded Spill
vslidedown.vi v8, v8, 1
vfmv.f.s fa0, v8
call tanh
fmv.d fs0, fa0
fld fa0, 16(sp) # 8-byte Folded Reload
call tanh
vsetivli zero, 2, e64, m1, ta, ma
vfmv.v.f v8, fa0
vfslide1down.vf v8, v8, fs0
vfadd.vf v8, v8, fs1
vse64.v v8, (s0)
0 commit comments