[PATCH] D77972: [VPlan] Move Load/Store checks out of tryToWiden (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 01:03:09 PDT 2020


fhahn updated this revision to Diff 256936.
fhahn added a comment.

Also remove PHI from vectorizable opcodes, remove assertion in handleReplication.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77972

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp


Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6967,6 +6967,7 @@
   if (IsPredicated)
     return nullptr;
 
+  assert(!isa<PHINode>(I) && "PHIs should have been handled earlier");
   auto IsVectorizableOpcode = [](unsigned Opcode) {
     switch (Opcode) {
     case Instruction::Add:
@@ -6987,11 +6988,9 @@
     case Instruction::FSub:
     case Instruction::ICmp:
     case Instruction::IntToPtr:
-    case Instruction::Load:
     case Instruction::LShr:
     case Instruction::Mul:
     case Instruction::Or:
-    case Instruction::PHI:
     case Instruction::PtrToInt:
     case Instruction::SDiv:
     case Instruction::Select:
@@ -6999,7 +6998,6 @@
     case Instruction::Shl:
     case Instruction::SIToFP:
     case Instruction::SRem:
-    case Instruction::Store:
     case Instruction::Sub:
     case Instruction::Trunc:
     case Instruction::UDiv:
@@ -7016,16 +7014,8 @@
     return nullptr;
 
   auto willWiden = [&](unsigned VF) -> bool {
-    if (!isa<PHINode>(I) && (CM.isScalarAfterVectorization(I, VF) ||
-                             CM.isProfitableToScalarize(I, VF)))
-      return false;
-    if (isa<LoadInst>(I) || isa<StoreInst>(I)) {
-      assert(CM.getWideningDecision(I, VF) ==
-                 LoopVectorizationCostModel::CM_Scalarize &&
-             "Memory widening decisions should have been taken care by now");
-      return false;
-    }
-    return true;
+    return !CM.isScalarAfterVectorization(I, VF) &&
+                             !CM.isProfitableToScalarize(I, VF);
   };
 
   if (!LoopVectorizationPlanner::getDecisionAndClampRange(willWiden, Range))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77972.256936.patch
Type: text/x-patch
Size: 1783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200413/d97a6d1e/attachment.bin>


More information about the llvm-commits mailing list