[PATCH] D77973: [VPlan] Move widening check for non-memory/non-calls to function (NFC).

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 12 16:33:44 PDT 2020


Ayal added a comment.

Yes, this follows D77972 <https://reviews.llvm.org/D77972> naturally :-)



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6940
+bool VPRecipeBuilder::shouldWiden(Instruction *I, VFRange &Range) const {
+  assert(!isa<CallInst>(I) && !isa<StoreInst>(I) && !isa<LoadInst>(I) &&
+         "Called with unsupported instruction");
----------------
Can add !isa<PHINode>(I) to this assertion list after sinking tryToWidenSelect() as suggested below.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7122
   }
 
   // Handle GEP widening.
----------------
How about doing here (`tryToCreateRecipe` should have a better name btw):


```
  if (!shouldWiden(I, Range))
    return false;

  if ((Recipe = tryToWidenSelect(Instr)) ||
      (isa<GetElementPtrInst>(Instr) &&
       (Recipe = new VPWidenGEPRecipe(GEP, OrigLoop)))) ||
     (Recipe = tryToWiden(Instr, *Plan))) {
    setRecipe(Instr, Recipe);
    VPBB->appendRecipe(Recipe);
    return true;
  }

  return false;
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77973





More information about the llvm-commits mailing list