LCOV - code coverage report
Current view: top level - lib/Analysis - ValueLatticeUtils.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 11 11 100.0 %
Date: 2018-05-20 00:06:23 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- ValueLatticeUtils.cpp - Utils for solving lattices ------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file implements common functions useful for performing data-flow
      11             : // analyses that propagate values across function boundaries.
      12             : //
      13             : //===----------------------------------------------------------------------===//
      14             : 
      15             : #include "llvm/Analysis/ValueLatticeUtils.h"
      16             : #include "llvm/IR/GlobalVariable.h"
      17             : #include "llvm/IR/Instructions.h"
      18             : using namespace llvm;
      19             : 
      20       78574 : bool llvm::canTrackArgumentsInterprocedurally(Function *F) {
      21       11435 :   return F->hasLocalLinkage() && !F->hasAddressTaken();
      22             : }
      23             : 
      24      453871 : bool llvm::canTrackReturnsInterprocedurally(Function *F) {
      25      525984 :   return F->hasExactDefinition() && !F->hasFnAttribute(Attribute::Naked);
      26             : }
      27             : 
      28       89899 : bool llvm::canTrackGlobalVariableInterprocedurally(GlobalVariable *GV) {
      29      232093 :   if (GV->isConstant() || !GV->hasLocalLinkage() ||
      30       52295 :       !GV->hasDefinitiveInitializer())
      31             :     return false;
      32      158074 :   return !any_of(GV->users(), [&](User *U) {
      33             :     if (auto *Store = dyn_cast<StoreInst>(U)) {
      34       91700 :       if (Store->getValueOperand() == GV || Store->isVolatile())
      35             :         return true;
      36             :     } else if (auto *Load = dyn_cast<LoadInst>(U)) {
      37        7768 :       if (Load->isVolatile())
      38             :         return true;
      39             :     } else {
      40             :       return true;
      41             :     }
      42             :     return false;
      43       52274 :   });
      44             : }

Generated by: LCOV version 1.13