[PATCH] D51313: [LV] Fix code gen for conditionally executed uniform loads

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 18:48:17 PDT 2018


hsaito added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1433
+      return false;
+    if (!isa<LoadInst>(I) && !isa<StoreInst>(I))
+      return isScalarWithPredication(I);
----------------
Maybe a nit picking, but I think the logic is clearer if we write this code as in

if (load_or_store) {
   return Legal->isMaskRequired(I)
}
return isScalarWithPredication(I)



================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4404
+      // Gather/Scatter are NOT treated as scalar with predication.
+      return WideningDecision != CM_GatherScatter;
+    }
----------------
If "WideningDecision == CM_Scalarize" doesn't work here, we need comments on  why that won't work.
Else, change the condition to more straightforward "WideningDecition == CM_Scalarize" to avoid bugs now or later.



================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:6826
     if (isa<LoadInst>(I) || isa<StoreInst>(I)) {
-      assert(CM.getWideningDecision(I, VF) ==
-                 LoopVectorizationCostModel::CM_Scalarize &&
+      assert((CM.getWideningDecision(I, VF) !=
+                  LoopVectorizationCostModel::CM_Widen &&
----------------
Same as Line 4404.


Repository:
  rL LLVM

https://reviews.llvm.org/D51313





More information about the llvm-commits mailing list