//===- ProvenanceAnalysis.cpp - ObjC ARC Optimization ---------------------===// // // 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 // //===----------------------------------------------------------------------===// // /// \file /// /// This file defines a special form of Alias Analysis called ``Provenance /// Analysis''. The word ``provenance'' refers to the history of the ownership /// of an object. Thus ``Provenance Analysis'' is an analysis which attempts to /// use various techniques to determine if locally /// /// WARNING: This file knows about certain library functions. It recognizes them /// by name, and hardwires knowledge of their semantics. /// /// WARNING: This file knows about how certain Objective-C library functions are /// used. Naive LLVM IR transformations which would otherwise be /// behavior-preserving may break these assumptions. // //===----------------------------------------------------------------------===// #include "ProvenanceAnalysis.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/ObjCARCAnalysisUtils.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" #include "llvm/IR/Use.h" #include "llvm/IR/User.h" #include "llvm/IR/Value.h" #include "llvm/Support/Casting.h" #include <utility> usingnamespacellvm; usingnamespacellvm::objcarc; bool ProvenanceAnalysis::relatedSelect(const SelectInst *A, const Value *B) { … } bool ProvenanceAnalysis::relatedPHI(const PHINode *A, const Value *B) { … } /// Test if the value of P, or any value covered by its provenance, is ever /// stored within the function (not counting callees). static bool IsStoredObjCPointer(const Value *P) { … } bool ProvenanceAnalysis::relatedCheck(const Value *A, const Value *B) { … } bool ProvenanceAnalysis::related(const Value *A, const Value *B) { … }