[PATCH] D94779: [Clang] Ensure vector predication loop metadata is always emitted when pragma is specified.

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 11 09:07:24 PST 2021


Meinersbur added a comment.

To illustrate how complicated interpreting the vectorize pragma has become in the mid-end:

  TransformationMode llvm::hasVectorizeTransformation(Loop *L) {
    Optional<bool> Enable =
        getOptionalBoolLoopAttribute(L, "llvm.loop.vectorize.enable");
  
    if (Enable == false)
      return TM_SuppressedByUser;
  
    Optional<ElementCount> VectorizeWidth =
        getOptionalElementCountLoopAttribute(L);
    Optional<int> InterleaveCount =
        getOptionalIntLoopAttribute(L, "llvm.loop.interleave.count");
  
    // 'Forcing' vector width and interleave count to one effectively disables
    // this transformation.
    if (Enable == true && VectorizeWidth && VectorizeWidth->isScalar() &&
        InterleaveCount == 1)
      return TM_SuppressedByUser;
  
    if (getBooleanLoopAttribute(L, "llvm.loop.isvectorized"))
      return TM_Disable;
  
    if (Enable == true)
      return TM_ForcedByUser;
  
    if ((VectorizeWidth && VectorizeWidth->isScalar()) && InterleaveCount == 1)
      return TM_Disable;
  
    if ((VectorizeWidth && VectorizeWidth->isVector()) || InterleaveCount > 1)
      return TM_Enable;
  
    if (hasDisableAllTransformsHint(L))
      return TM_Disable;
  
    return TM_Unspecified;
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94779



More information about the cfe-commits mailing list