Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Analysis/ValueLatticeUtils.cpp
Line
Count
Source
1
//===-- ValueLatticeUtils.cpp - Utils for solving lattices ------*- 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 implements common functions useful for performing data-flow
10
// analyses that propagate values across function boundaries.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "llvm/Analysis/ValueLatticeUtils.h"
15
#include "llvm/IR/GlobalVariable.h"
16
#include "llvm/IR/Instructions.h"
17
using namespace llvm;
18
19
1.42M
bool llvm::canTrackArgumentsInterprocedurally(Function *F) {
20
1.42M
  return F->hasLocalLinkage() && 
!F->hasAddressTaken()109k
;
21
1.42M
}
22
23
5.42M
bool llvm::canTrackReturnsInterprocedurally(Function *F) {
24
5.42M
  return F->hasExactDefinition() && 
!F->hasFnAttribute(Attribute::Naked)607k
;
25
5.42M
}
26
27
496k
bool llvm::canTrackGlobalVariableInterprocedurally(GlobalVariable *GV) {
28
496k
  if (GV->isConstant() || 
!GV->hasLocalLinkage()129k
||
29
496k
      
!GV->hasDefinitiveInitializer()22.1k
)
30
475k
    return false;
31
85.0k
  
return !any_of(GV->users(), [&](User *U) 21.9k
{
32
85.0k
    if (auto *Store = dyn_cast<StoreInst>(U)) {
33
36.0k
      if (Store->getValueOperand() == GV || 
Store->isVolatile()35.9k
)
34
16
        return true;
35
49.0k
    } else if (auto *Load = dyn_cast<LoadInst>(U)) {
36
36.3k
      if (Load->isVolatile())
37
2
        return true;
38
12.6k
    } else {
39
12.6k
      return true;
40
12.6k
    }
41
72.3k
    return false;
42
72.3k
  });
43
21.9k
}