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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 02:42:13 PDT 2020


This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.
Closed by commit rG79d185c79271: [VPlan] Move Load/Store checks out of tryToWiden (NFC). (authored by fhahn).

Changed prior to commit:
  https://reviews.llvm.org/D77972?vs=256936&id=257642#toc

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
@@ -6961,6 +6961,7 @@
   if (IsPredicated)
     return nullptr;
 
+  assert(!isa<PHINode>(I) && "PHIs should have been handled earlier");
   auto IsVectorizableOpcode = [](unsigned Opcode) {
     switch (Opcode) {
     case Instruction::Add:
@@ -6981,11 +6982,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:
@@ -6993,7 +6992,6 @@
     case Instruction::Shl:
     case Instruction::SIToFP:
     case Instruction::SRem:
-    case Instruction::Store:
     case Instruction::Sub:
     case Instruction::Trunc:
     case Instruction::UDiv:
@@ -7010,16 +7008,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.257642.patch
Type: text/x-patch
Size: 1765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/7241d24a/attachment.bin>


More information about the llvm-commits mailing list