[llvm-bugs] [Bug 26314] New: Vectorizer failure
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 26 04:27:38 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26314
Bug ID: 26314
Summary: Vectorizer failure
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: egor.kochetov at intel.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 15718
--> https://llvm.org/bugs/attachment.cgi?id=15718&action=edit
The reproducer (20 SLOC, either C or C++, does not matter)
While compiling the attached 'main.cpp' I've encountered clang vectorization
problem, the performance difference is 58ms vs 20ms (almost 200%). After the
commit r257134 clang fails to vectorize 'slow_function'.
I compile with:
clang++ -O2 -m64 -march=slm -mfpmath=sse -fPIE -flto -g -fvectorize
Results for -O2 and -Ofast, for -m32 and -m64 are all the same.
Here is what I get from an old (fast) clang:
main.cpp:11:9: remark: the cost-model indicates that interleaving is not
beneficial [-Rpass-analysis=loop-vectorize]
for (int k=0; k<Z; k++) {
Here is what I get from a new (slow) clang:
main.cpp:11:9: remark: loop not vectorized: cannot check memory
dependencies at runtime [-Rpass-analysis=loop-vectorize]
for (int k=0; k<Z; k++) {
The triggering SVN change is:
Index: lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- lib/Analysis/LoopAccessAnalysis.cpp (revision 257133)
+++ lib/Analysis/LoopAccessAnalysis.cpp (revision 257134)
@@ -845,6 +845,7 @@
if (Lp != AR->getLoop()) {
DEBUG(dbgs() << "LAA: Bad stride - Not striding over innermost loop "
<<
*Ptr << " SCEV: " << *PtrScev << "\n");
+ return 0;
}
// The address calculation must not wrap. Otherwise, a dependence could
be
For comparison, here is what I get from GCC 6.0 trunk with
'-fopt-info-vec-note':
loop at main.cpp:12: if (ivtmp_126 >= bnd.8_75)
main.cpp:11:24: note: LOOP VECTORIZED
The binary compiled by GCC is slightly faster than that compiled by old clang
(well, if I add fwrite of s to /dev/null at the end of 'main').
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160126/84e17f76/attachment-0001.html>
More information about the llvm-bugs
mailing list