VPlanTransforms.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //===- VPlanTransforms.h - Utility VPlan to VPlan transforms --------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. ///
  9. /// \file
  10. /// This file provides utility VPlan to VPlan transformations.
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
  13. #define LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
  14. #include "VPlan.h"
  15. #include "llvm/ADT/STLExtras.h"
  16. #include "llvm/Transforms/Vectorize/LoopVectorizationLegality.h"
  17. namespace llvm {
  18. class InductionDescriptor;
  19. class Instruction;
  20. class PHINode;
  21. class ScalarEvolution;
  22. struct VPlanTransforms {
  23. /// Replaces the VPInstructions in \p Plan with corresponding
  24. /// widen recipes.
  25. static void
  26. VPInstructionsToVPRecipes(Loop *OrigLoop, VPlanPtr &Plan,
  27. function_ref<const InductionDescriptor *(PHINode *)>
  28. GetIntOrFpInductionDescriptor,
  29. SmallPtrSetImpl<Instruction *> &DeadInstructions,
  30. ScalarEvolution &SE);
  31. static bool sinkScalarOperands(VPlan &Plan);
  32. static bool mergeReplicateRegions(VPlan &Plan);
  33. /// Remove redundant casts of inductions.
  34. ///
  35. /// Such redundant casts are casts of induction variables that can be ignored,
  36. /// because we already proved that the casted phi is equal to the uncasted phi
  37. /// in the vectorized loop. There is no need to vectorize the cast - the same
  38. /// value can be used for both the phi and casts in the vector loop.
  39. static void removeRedundantInductionCasts(VPlan &Plan);
  40. /// Try to replace VPWidenCanonicalIVRecipes with a widened canonical IV
  41. /// recipe, if it exists.
  42. static void removeRedundantCanonicalIVs(VPlan &Plan);
  43. };
  44. } // namespace llvm
  45. #endif // LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H