[PATCH] D37507: Fix maximum legal VF calculation

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 09:05:13 PDT 2017


Ayal accepted this revision.
Ayal added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1562
+  uint64_t getMaxSafeRegisterWidth() const {
+	  return LAI->getDepChecker().getMaxSafeRegisterWidth();
+  }
----------------
Best assert that LAI is not null before dereferencing it.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:6222
+      ((WidestRegister < MaxSafeRegisterWidth) ? WidestRegister
+                                               : MaxSafeRegisterWidth);
   unsigned MaxVectorSize = WidestRegister / WidestType;
----------------
While you're touching this, best use std::min.


================
Comment at: test/Transforms/LoopVectorize/memdep.ll:230
+;Therefore the maxVF was computed as 8 instead of 4.  
+
+;#define M 32
----------------
Better clarify:
; where the dependence distance here is 6 iterations, given by |N-(N-12)|/2.


https://reviews.llvm.org/D37507





More information about the llvm-commits mailing list