1 //===- LocalAliasAnalysis.h - Local Stateless Alias Analysis ----*- C++ -*-===// 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 // This file contains the implementation of a local stateless alias analysis. 10 // This analysis walks from the values being compared to determine their 11 // potential for aliasing. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef MLIR_ANALYSIS_ALIASANALYSIS_LOCALALIASANALYSIS_H_ 16 #define MLIR_ANALYSIS_ALIASANALYSIS_LOCALALIASANALYSIS_H_ 17 18 #include "mlir/Analysis/AliasAnalysis.h" 19 20 namespace mlir { 21 /// This class implements a local form of alias analysis that tries to identify 22 /// the underlying values addressed by each value and performs a few basic 23 /// checks to see if they alias. 24 class LocalAliasAnalysis { 25 public: 26 virtual ~LocalAliasAnalysis() = default; 27 28 /// Given two values, return their aliasing behavior. 29 AliasResult alias(Value lhs, Value rhs); 30 31 /// Return the modify-reference behavior of `op` on `location`. 32 ModRefResult getModRef(Operation *op, Value location); 33 34 protected: 35 /// Given the two values, return their aliasing behavior. 36 virtual AliasResult aliasImpl(Value lhs, Value rhs); 37 }; 38 } // namespace mlir 39 40 #endif // MLIR_ANALYSIS_ALIASANALYSIS_LOCALALIASANALYSIS_H_ 41