#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/PassManager.h"

namespace llvm {

namespace aocc {
class RemoveReloadsPass : public PassInfoMixin<RemoveReloadsPass> {
public:
  RemoveReloadsPass() {}
  PreservedAnalyses run(Function &F, FunctionAnalysisManager &M);

private:
  AliasAnalysis *AA;
  LoopInfo *LI;
  ScalarEvolution *SE;
  bool transform(Function &F);
  bool memoryIsNotModifiedBetween(Instruction *, Instruction *);
  bool isArefEqual(DbgArefInst *Aref1, DbgArefInst *Aref2);
};

} // namespace aocc
} // namespace llvm