AlignmentFromAssumptions.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===---- AlignmentFromAssumptions.h ----------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file implements a ScalarEvolution-based transformation to set
  15. // the alignments of load, stores and memory intrinsics based on the truth
  16. // expressions of assume intrinsics. The primary motivation is to handle
  17. // complex alignment assumptions that apply to vector loads and stores that
  18. // appear after vectorization and unrolling.
  19. //
  20. //===----------------------------------------------------------------------===//
  21. #ifndef LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H
  22. #define LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H
  23. #include "llvm/IR/PassManager.h"
  24. namespace llvm {
  25. class AssumptionCache;
  26. class DominatorTree;
  27. class ScalarEvolution;
  28. class SCEV;
  29. struct AlignmentFromAssumptionsPass
  30. : public PassInfoMixin<AlignmentFromAssumptionsPass> {
  31. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  32. // Glue for old PM.
  33. bool runImpl(Function &F, AssumptionCache &AC, ScalarEvolution *SE_,
  34. DominatorTree *DT_);
  35. ScalarEvolution *SE = nullptr;
  36. DominatorTree *DT = nullptr;
  37. bool extractAlignmentInfo(CallInst *I, unsigned Idx, Value *&AAPtr,
  38. const SCEV *&AlignSCEV, const SCEV *&OffSCEV);
  39. bool processAssumption(CallInst *I, unsigned Idx);
  40. };
  41. }
  42. #endif // LLVM_TRANSFORMS_SCALAR_ALIGNMENTFROMASSUMPTIONS_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif