//===- ValueLattice.cpp - Value constraint analysis -------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/Analysis/ValueLattice.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/IR/Instructions.h" namespace llvm { Constant * ValueLatticeElement::getCompare(CmpInst::Predicate Pred, Type *Ty, const ValueLatticeElement &Other, const DataLayout &DL) const { … } static bool hasSingleValue(const ValueLatticeElement &Val) { … } /// Combine two sets of facts about the same value into a single set of /// facts. Note that this method is not suitable for merging facts along /// different paths in a CFG; that's what the mergeIn function is for. This /// is for merging facts gathered about the same value at the same location /// through two independent means. /// Notes: /// * This method does not promise to return the most precise possible lattice /// value implied by A and B. It is allowed to return any lattice element /// which is at least as strong as *either* A or B (unless our facts /// conflict, see below). /// * Due to unreachable code, the intersection of two lattice values could be /// contradictory. If this happens, we return some valid lattice value so as /// not confuse the rest of LVI. Ideally, we'd always return Undefined, but /// we do not make this guarantee. TODO: This would be a useful enhancement. ValueLatticeElement ValueLatticeElement::intersect(const ValueLatticeElement &Other) const { … } raw_ostream &operator<<(raw_ostream &OS, const ValueLatticeElement &Val) { … } } // end namespace llvm