[PATCH] D32093: [InstCombine] PR32078: convert scalar operations to vector.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 07:51:18 PDT 2017
spatel requested changes to this revision.
spatel added a reviewer: efriedma.
spatel added a comment.
This revision now requires changes to proceed.
This transform is not safe as written. This program compiled with -O1 will crash/cause exception after this patch, but it does not before:
typedef int v4si __attribute__((__vector_size__(16)));
v4si divs(v4si x, v4si y) {
int eltX = x[1];
int eltY = y[1];
x[1] = eltX / eltY;
return x;
}
int main() {
v4si x = (v4si){0, 1, 2, 3};
x = divs(x, x);
return x[0];
}
The division example shows that we're operating on elements that the original program does not, so any FP op would also be a concern. If some element in a vector is a denorm, that could cause a perf explosion that doesn't exist in the original program. Besides that, I'm not sure that we can actually do this transform for any op in a target-independent pass. We're replacing scalar ops with potentially more expensive vector ops.
https://reviews.llvm.org/D32093
More information about the llvm-commits
mailing list