[PATCH] D54892: [LAA] Introduce enum for vectorization safety status (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 17:20:40 PST 2018


fhahn added inline comments.


================
Comment at: include/llvm/Analysis/LoopAccessAnalysis.h:206
   /// vectorization.
-  bool isSafeForVectorization() const { return SafeForVectorization; }
+  bool isSafeForVectorization() const { return Status == StatusTy::Safe; }
 
----------------
Ayal wrote:
> Use this `isSafeForVectorization()` getter method where the `SafeForVectorization` flag was read before, below, instead of replacing it with (inlined) comparisons of `Status == StatusTy::Safe`.
> 
> This will also make it useful (though it could be made protected/private).
I'll address visibility and unused functions as follow up commits.


================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:1323
+void MemoryDepChecker::mergeInStatus(StatusTy S) {
+  switch (Status) {
+  case StatusTy::Safe:
----------------
Ayal wrote:
> Could this be done as follows, based on the numerical values of the enum, properly sorted as now?
> 
> ```
>   if (Status < S)
>     Status = S;
> 
> ```
> 
Nice, I didn't know enum classes provide a default implementation for that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54892/new/

https://reviews.llvm.org/D54892





More information about the llvm-commits mailing list