Coverage Report

Created: 2019-02-21 13:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/BasicTTIImpl.h
<
Line
Count
Source (jump to first uncovered line)
1
//===- BasicTTIImpl.h -------------------------------------------*- 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
/// \file
10
/// This file provides a helper that implements much of the TTI interface in
11
/// terms of the target-independent code generator and TargetLowering
12
/// interfaces.
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_CODEGEN_BASICTTIIMPL_H
17
#define LLVM_CODEGEN_BASICTTIIMPL_H
18
19
#include "llvm/ADT/APInt.h"
20
#include "llvm/ADT/ArrayRef.h"
21
#include "llvm/ADT/BitVector.h"
22
#include "llvm/ADT/SmallPtrSet.h"
23
#include "llvm/ADT/SmallVector.h"
24
#include "llvm/Analysis/LoopInfo.h"
25
#include "llvm/Analysis/TargetTransformInfo.h"
26
#include "llvm/Analysis/TargetTransformInfoImpl.h"
27
#include "llvm/CodeGen/ISDOpcodes.h"
28
#include "llvm/CodeGen/TargetLowering.h"
29
#include "llvm/CodeGen/TargetSubtargetInfo.h"
30
#include "llvm/CodeGen/ValueTypes.h"
31
#include "llvm/IR/BasicBlock.h"
32
#include "llvm/IR/CallSite.h"
33
#include "llvm/IR/Constant.h"
34
#include "llvm/IR/Constants.h"
35
#include "llvm/IR/DataLayout.h"
36
#include "llvm/IR/DerivedTypes.h"
37
#include "llvm/IR/InstrTypes.h"
38
#include "llvm/IR/Instruction.h"
39
#include "llvm/IR/Instructions.h"
40
#include "llvm/IR/Intrinsics.h"
41
#include "llvm/IR/Operator.h"
42
#include "llvm/IR/Type.h"
43
#include "llvm/IR/Value.h"
44
#include "llvm/MC/MCSchedule.h"
45
#include "llvm/Support/Casting.h"
46
#include "llvm/Support/CommandLine.h"
47
#include "llvm/Support/ErrorHandling.h"
48
#include "llvm/Support/MachineValueType.h"
49
#include "llvm/Support/MathExtras.h"
50
#include <algorithm>
51
#include <cassert>
52
#include <cstdint>
53
#include <limits>
54
#include <utility>
55
56
namespace llvm {
57
58
class Function;
59
class GlobalValue;
60
class LLVMContext;
61
class ScalarEvolution;
62
class SCEV;
63
class TargetMachine;
64
65
extern cl::opt<unsigned> PartialUnrollingThreshold;
66
67
/// Base class which can be used to help build a TTI implementation.
68
///
69
/// This class provides as much implementation of the TTI interface as is
70
/// possible using the target independent parts of the code generator.
71
///
72
/// In order to subclass it, your class must implement a getST() method to
73
/// return the subtarget, and a getTLI() method to return the target lowering.
74
/// We need these methods implemented in the derived class so that this class
75
/// doesn't have to duplicate storage for them.
76
template <typename T>
77
class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
78
private:
79
  using BaseT = TargetTransformInfoImplCRTPBase<T>;
80
  using TTI = TargetTransformInfo;
81
82
  /// Estimate a cost of Broadcast as an extract and sequence of insert
83
  /// operations.
84
45
  unsigned getBroadcastShuffleOverhead(Type *Ty) {
85
45
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
86
45
    unsigned Cost = 0;
87
45
    // Broadcast cost is equal to the cost of extracting the zero'th element
88
45
    // plus the cost of inserting it into every element of the result vector.
89
45
    Cost += static_cast<T *>(this)->getVectorInstrCost(
90
45
        Instruction::ExtractElement, Ty, 0);
91
45
92
135
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i90
) {
93
90
      Cost += static_cast<T *>(this)->getVectorInstrCost(
94
90
          Instruction::InsertElement, Ty, i);
95
90
    }
96
45
    return Cost;
97
45
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Line
Count
Source
84
2
  unsigned getBroadcastShuffleOverhead(Type *Ty) {
85
2
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
86
2
    unsigned Cost = 0;
87
2
    // Broadcast cost is equal to the cost of extracting the zero'th element
88
2
    // plus the cost of inserting it into every element of the result vector.
89
2
    Cost += static_cast<T *>(this)->getVectorInstrCost(
90
2
        Instruction::ExtractElement, Ty, 0);
91
2
92
6
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i4
) {
93
4
      Cost += static_cast<T *>(this)->getVectorInstrCost(
94
4
          Instruction::InsertElement, Ty, i);
95
4
    }
96
2
    return Cost;
97
2
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Line
Count
Source
84
2
  unsigned getBroadcastShuffleOverhead(Type *Ty) {
85
2
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
86
2
    unsigned Cost = 0;
87
2
    // Broadcast cost is equal to the cost of extracting the zero'th element
88
2
    // plus the cost of inserting it into every element of the result vector.
89
2
    Cost += static_cast<T *>(this)->getVectorInstrCost(
90
2
        Instruction::ExtractElement, Ty, 0);
91
2
92
6
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i4
) {
93
4
      Cost += static_cast<T *>(this)->getVectorInstrCost(
94
4
          Instruction::InsertElement, Ty, i);
95
4
    }
96
2
    return Cost;
97
2
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
Line
Count
Source
84
41
  unsigned getBroadcastShuffleOverhead(Type *Ty) {
85
41
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
86
41
    unsigned Cost = 0;
87
41
    // Broadcast cost is equal to the cost of extracting the zero'th element
88
41
    // plus the cost of inserting it into every element of the result vector.
89
41
    Cost += static_cast<T *>(this)->getVectorInstrCost(
90
41
        Instruction::ExtractElement, Ty, 0);
91
41
92
123
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i82
) {
93
82
      Cost += static_cast<T *>(this)->getVectorInstrCost(
94
82
          Instruction::InsertElement, Ty, i);
95
82
    }
96
41
    return Cost;
97
41
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getBroadcastShuffleOverhead(llvm::Type*)
98
99
  /// Estimate a cost of shuffle as a sequence of extract and insert
100
  /// operations.
101
3.64k
  unsigned getPermuteShuffleOverhead(Type *Ty) {
102
3.64k
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
103
3.64k
    unsigned Cost = 0;
104
3.64k
    // Shuffle cost is equal to the cost of extracting element from its argument
105
3.64k
    // plus the cost of inserting them onto the result vector.
106
3.64k
107
3.64k
    // e.g. <4 x float> has a mask of <0,5,2,7> i.e we need to extract from
108
3.64k
    // index 0 of first vector, index 1 of second vector,index 2 of first
109
3.64k
    // vector and finally index 3 of second vector and insert them at index
110
3.64k
    // <0,1,2,3> of result vector.
111
21.0k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i17.3k
) {
112
17.3k
      Cost += static_cast<T *>(this)
113
17.3k
                  ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
114
17.3k
      Cost += static_cast<T *>(this)
115
17.3k
                  ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
116
17.3k
    }
117
3.64k
    return Cost;
118
3.64k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Line
Count
Source
101
3.01k
  unsigned getPermuteShuffleOverhead(Type *Ty) {
102
3.01k
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
103
3.01k
    unsigned Cost = 0;
104
3.01k
    // Shuffle cost is equal to the cost of extracting element from its argument
105
3.01k
    // plus the cost of inserting them onto the result vector.
106
3.01k
107
3.01k
    // e.g. <4 x float> has a mask of <0,5,2,7> i.e we need to extract from
108
3.01k
    // index 0 of first vector, index 1 of second vector,index 2 of first
109
3.01k
    // vector and finally index 3 of second vector and insert them at index
110
3.01k
    // <0,1,2,3> of result vector.
111
16.7k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i13.7k
) {
112
13.7k
      Cost += static_cast<T *>(this)
113
13.7k
                  ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
114
13.7k
      Cost += static_cast<T *>(this)
115
13.7k
                  ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
116
13.7k
    }
117
3.01k
    return Cost;
118
3.01k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Line
Count
Source
101
54
  unsigned getPermuteShuffleOverhead(Type *Ty) {
102
54
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
103
54
    unsigned Cost = 0;
104
54
    // Shuffle cost is equal to the cost of extracting element from its argument
105
54
    // plus the cost of inserting them onto the result vector.
106
54
107
54
    // e.g. <4 x float> has a mask of <0,5,2,7> i.e we need to extract from
108
54
    // index 0 of first vector, index 1 of second vector,index 2 of first
109
54
    // vector and finally index 3 of second vector and insert them at index
110
54
    // <0,1,2,3> of result vector.
111
254
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i200
) {
112
200
      Cost += static_cast<T *>(this)
113
200
                  ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
114
200
      Cost += static_cast<T *>(this)
115
200
                  ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
116
200
    }
117
54
    return Cost;
118
54
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Line
Count
Source
101
96
  unsigned getPermuteShuffleOverhead(Type *Ty) {
102
96
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
103
96
    unsigned Cost = 0;
104
96
    // Shuffle cost is equal to the cost of extracting element from its argument
105
96
    // plus the cost of inserting them onto the result vector.
106
96
107
96
    // e.g. <4 x float> has a mask of <0,5,2,7> i.e we need to extract from
108
96
    // index 0 of first vector, index 1 of second vector,index 2 of first
109
96
    // vector and finally index 3 of second vector and insert them at index
110
96
    // <0,1,2,3> of result vector.
111
480
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i384
) {
112
384
      Cost += static_cast<T *>(this)
113
384
                  ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
114
384
      Cost += static_cast<T *>(this)
115
384
                  ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
116
384
    }
117
96
    return Cost;
118
96
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
Line
Count
Source
101
478
  unsigned getPermuteShuffleOverhead(Type *Ty) {
102
478
    assert(Ty->isVectorTy() && "Can only shuffle vectors");
103
478
    unsigned Cost = 0;
104
478
    // Shuffle cost is equal to the cost of extracting element from its argument
105
478
    // plus the cost of inserting them onto the result vector.
106
478
107
478
    // e.g. <4 x float> has a mask of <0,5,2,7> i.e we need to extract from
108
478
    // index 0 of first vector, index 1 of second vector,index 2 of first
109
478
    // vector and finally index 3 of second vector and insert them at index
110
478
    // <0,1,2,3> of result vector.
111
3.49k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i3.01k
) {
112
3.01k
      Cost += static_cast<T *>(this)
113
3.01k
                  ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
114
3.01k
      Cost += static_cast<T *>(this)
115
3.01k
                  ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
116
3.01k
    }
117
478
    return Cost;
118
478
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getPermuteShuffleOverhead(llvm::Type*)
119
120
  /// Estimate a cost of subvector extraction as a sequence of extract and
121
  /// insert operations.
122
3.93k
  unsigned getExtractSubvectorOverhead(Type *Ty, int Index, Type *SubTy) {
123
3.93k
    assert(Ty && Ty->isVectorTy() && SubTy && SubTy->isVectorTy() &&
124
3.93k
           "Can only extract subvectors from vectors");
125
3.93k
    int NumSubElts = SubTy->getVectorNumElements();
126
3.93k
    assert((Index + NumSubElts) <= (int)Ty->getVectorNumElements() &&
127
3.93k
           "SK_ExtractSubvector index out of range");
128
3.93k
129
3.93k
    unsigned Cost = 0;
130
3.93k
    // Subvector extraction cost is equal to the cost of extracting element from
131
3.93k
    // the source type plus the cost of inserting them into the result vector
132
3.93k
    // type.
133
13.9k
    for (int i = 0; i != NumSubElts; 
++i10.0k
) {
134
10.0k
      Cost += static_cast<T *>(this)->getVectorInstrCost(
135
10.0k
          Instruction::ExtractElement, Ty, i + Index);
136
10.0k
      Cost += static_cast<T *>(this)->getVectorInstrCost(
137
10.0k
          Instruction::InsertElement, SubTy, i);
138
10.0k
    }
139
3.93k
    return Cost;
140
3.93k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Line
Count
Source
122
3.89k
  unsigned getExtractSubvectorOverhead(Type *Ty, int Index, Type *SubTy) {
123
3.89k
    assert(Ty && Ty->isVectorTy() && SubTy && SubTy->isVectorTy() &&
124
3.89k
           "Can only extract subvectors from vectors");
125
3.89k
    int NumSubElts = SubTy->getVectorNumElements();
126
3.89k
    assert((Index + NumSubElts) <= (int)Ty->getVectorNumElements() &&
127
3.89k
           "SK_ExtractSubvector index out of range");
128
3.89k
129
3.89k
    unsigned Cost = 0;
130
3.89k
    // Subvector extraction cost is equal to the cost of extracting element from
131
3.89k
    // the source type plus the cost of inserting them into the result vector
132
3.89k
    // type.
133
13.7k
    for (int i = 0; i != NumSubElts; 
++i9.84k
) {
134
9.84k
      Cost += static_cast<T *>(this)->getVectorInstrCost(
135
9.84k
          Instruction::ExtractElement, Ty, i + Index);
136
9.84k
      Cost += static_cast<T *>(this)->getVectorInstrCost(
137
9.84k
          Instruction::InsertElement, SubTy, i);
138
9.84k
    }
139
3.89k
    return Cost;
140
3.89k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Line
Count
Source
122
25
  unsigned getExtractSubvectorOverhead(Type *Ty, int Index, Type *SubTy) {
123
25
    assert(Ty && Ty->isVectorTy() && SubTy && SubTy->isVectorTy() &&
124
25
           "Can only extract subvectors from vectors");
125
25
    int NumSubElts = SubTy->getVectorNumElements();
126
25
    assert((Index + NumSubElts) <= (int)Ty->getVectorNumElements() &&
127
25
           "SK_ExtractSubvector index out of range");
128
25
129
25
    unsigned Cost = 0;
130
25
    // Subvector extraction cost is equal to the cost of extracting element from
131
25
    // the source type plus the cost of inserting them into the result vector
132
25
    // type.
133
141
    for (int i = 0; i != NumSubElts; 
++i116
) {
134
116
      Cost += static_cast<T *>(this)->getVectorInstrCost(
135
116
          Instruction::ExtractElement, Ty, i + Index);
136
116
      Cost += static_cast<T *>(this)->getVectorInstrCost(
137
116
          Instruction::InsertElement, SubTy, i);
138
116
    }
139
25
    return Cost;
140
25
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Line
Count
Source
122
12
  unsigned getExtractSubvectorOverhead(Type *Ty, int Index, Type *SubTy) {
123
12
    assert(Ty && Ty->isVectorTy() && SubTy && SubTy->isVectorTy() &&
124
12
           "Can only extract subvectors from vectors");
125
12
    int NumSubElts = SubTy->getVectorNumElements();
126
12
    assert((Index + NumSubElts) <= (int)Ty->getVectorNumElements() &&
127
12
           "SK_ExtractSubvector index out of range");
128
12
129
12
    unsigned Cost = 0;
130
12
    // Subvector extraction cost is equal to the cost of extracting element from
131
12
    // the source type plus the cost of inserting them into the result vector
132
12
    // type.
133
60
    for (int i = 0; i != NumSubElts; 
++i48
) {
134
48
      Cost += static_cast<T *>(this)->getVectorInstrCost(
135
48
          Instruction::ExtractElement, Ty, i + Index);
136
48
      Cost += static_cast<T *>(this)->getVectorInstrCost(
137
48
          Instruction::InsertElement, SubTy, i);
138
48
    }
139
12
    return Cost;
140
12
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getExtractSubvectorOverhead(llvm::Type*, int, llvm::Type*)
141
142
  /// Estimate a cost of subvector insertion as a sequence of extract and
143
  /// insert operations.
144
39
  unsigned getInsertSubvectorOverhead(Type *Ty, int Index, Type *SubTy) {
145
39
    assert(Ty && Ty->isVectorTy() && SubTy && SubTy->isVectorTy() &&
146
39
           "Can only insert subvectors into vectors");
147
39
    int NumSubElts = SubTy->getVectorNumElements();
148
39
    assert((Index + NumSubElts) <= (int)Ty->getVectorNumElements() &&
149
39
           "SK_InsertSubvector index out of range");
150
39
151
39
    unsigned Cost = 0;
152
39
    // Subvector insertion cost is equal to the cost of extracting element from
153
39
    // the source type plus the cost of inserting them into the result vector
154
39
    // type.
155
117
    for (int i = 0; i != NumSubElts; 
++i78
) {
156
78
      Cost += static_cast<T *>(this)->getVectorInstrCost(
157
78
          Instruction::ExtractElement, SubTy, i);
158
78
      Cost += static_cast<T *>(this)->getVectorInstrCost(
159
78
          Instruction::InsertElement, Ty, i + Index);
160
78
    }
161
39
    return Cost;
162
39
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
Line
Count
Source
144
39
  unsigned getInsertSubvectorOverhead(Type *Ty, int Index, Type *SubTy) {
145
39
    assert(Ty && Ty->isVectorTy() && SubTy && SubTy->isVectorTy() &&
146
39
           "Can only insert subvectors into vectors");
147
39
    int NumSubElts = SubTy->getVectorNumElements();
148
39
    assert((Index + NumSubElts) <= (int)Ty->getVectorNumElements() &&
149
39
           "SK_InsertSubvector index out of range");
150
39
151
39
    unsigned Cost = 0;
152
39
    // Subvector insertion cost is equal to the cost of extracting element from
153
39
    // the source type plus the cost of inserting them into the result vector
154
39
    // type.
155
117
    for (int i = 0; i != NumSubElts; 
++i78
) {
156
78
      Cost += static_cast<T *>(this)->getVectorInstrCost(
157
78
          Instruction::ExtractElement, SubTy, i);
158
78
      Cost += static_cast<T *>(this)->getVectorInstrCost(
159
78
          Instruction::InsertElement, Ty, i + Index);
160
78
    }
161
39
    return Cost;
162
39
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getInsertSubvectorOverhead(llvm::Type*, int, llvm::Type*)
163
164
  /// Local query method delegates up to T which *must* implement this!
165
387k
  const TargetSubtargetInfo *getST() const {
166
387k
    return static_cast<const T *>(this)->getST();
167
387k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getST() const
Line
Count
Source
165
358k
  const TargetSubtargetInfo *getST() const {
166
358k
    return static_cast<const T *>(this)->getST();
167
358k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getST() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getST() const
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getST() const
Line
Count
Source
165
6.81k
  const TargetSubtargetInfo *getST() const {
166
6.81k
    return static_cast<const T *>(this)->getST();
167
6.81k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getST() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getST() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getST() const
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getST() const
Line
Count
Source
165
2
  const TargetSubtargetInfo *getST() const {
166
2
    return static_cast<const T *>(this)->getST();
167
2
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getST() const
Line
Count
Source
165
552
  const TargetSubtargetInfo *getST() const {
166
552
    return static_cast<const T *>(this)->getST();
167
552
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getST() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getST() const
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getST() const
Line
Count
Source
165
21.5k
  const TargetSubtargetInfo *getST() const {
166
21.5k
    return static_cast<const T *>(this)->getST();
167
21.5k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getST() const
168
169
  /// Local query method delegates up to T which *must* implement this!
170
115M
  const TargetLoweringBase *getTLI() const {
171
115M
    return static_cast<const T *>(this)->getTLI();
172
115M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getTLI() const
Line
Count
Source
170
104M
  const TargetLoweringBase *getTLI() const {
171
104M
    return static_cast<const T *>(this)->getTLI();
172
104M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getTLI() const
Line
Count
Source
170
3.43k
  const TargetLoweringBase *getTLI() const {
171
3.43k
    return static_cast<const T *>(this)->getTLI();
172
3.43k
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getTLI() const
Line
Count
Source
170
88.5k
  const TargetLoweringBase *getTLI() const {
171
88.5k
    return static_cast<const T *>(this)->getTLI();
172
88.5k
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getTLI() const
Line
Count
Source
170
1.86M
  const TargetLoweringBase *getTLI() const {
171
1.86M
    return static_cast<const T *>(this)->getTLI();
172
1.86M
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getTLI() const
Line
Count
Source
170
43.1k
  const TargetLoweringBase *getTLI() const {
171
43.1k
    return static_cast<const T *>(this)->getTLI();
172
43.1k
  }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getTLI() const
Line
Count
Source
170
268
  const TargetLoweringBase *getTLI() const {
171
268
    return static_cast<const T *>(this)->getTLI();
172
268
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getTLI() const
Line
Count
Source
170
1.36k
  const TargetLoweringBase *getTLI() const {
171
1.36k
    return static_cast<const T *>(this)->getTLI();
172
1.36k
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getTLI() const
Line
Count
Source
170
2.22k
  const TargetLoweringBase *getTLI() const {
171
2.22k
    return static_cast<const T *>(this)->getTLI();
172
2.22k
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getTLI() const
Line
Count
Source
170
106k
  const TargetLoweringBase *getTLI() const {
171
106k
    return static_cast<const T *>(this)->getTLI();
172
106k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getTLI() const
Line
Count
Source
170
11.6k
  const TargetLoweringBase *getTLI() const {
171
11.6k
    return static_cast<const T *>(this)->getTLI();
172
11.6k
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getTLI() const
Line
Count
Source
170
1.14k
  const TargetLoweringBase *getTLI() const {
171
1.14k
    return static_cast<const T *>(this)->getTLI();
172
1.14k
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getTLI() const
Line
Count
Source
170
8.97M
  const TargetLoweringBase *getTLI() const {
171
8.97M
    return static_cast<const T *>(this)->getTLI();
172
8.97M
  }
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getTLI() const
Line
Count
Source
170
26
  const TargetLoweringBase *getTLI() const {
171
26
    return static_cast<const T *>(this)->getTLI();
172
26
  }
173
174
8.19M
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
8.19M
    switch (M) {
176
8.19M
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
8.19M
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
8.19M
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
8.19M
      case TTI::MIM_PostInc:
183
8.19M
        return ISD::POST_INC;
184
8.19M
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
6.82M
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
6.82M
    switch (M) {
176
6.82M
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
6.82M
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
6.82M
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
6.82M
      case TTI::MIM_PostInc:
183
6.82M
        return ISD::POST_INC;
184
6.82M
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
256
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
256
    switch (M) {
176
256
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
256
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
256
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
256
      case TTI::MIM_PostInc:
183
256
        return ISD::POST_INC;
184
256
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
6.92k
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
6.92k
    switch (M) {
176
6.92k
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
6.92k
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
6.92k
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
6.92k
      case TTI::MIM_PostInc:
183
6.92k
        return ISD::POST_INC;
184
6.92k
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
161k
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
161k
    switch (M) {
176
161k
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
161k
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
161k
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
161k
      case TTI::MIM_PostInc:
183
161k
        return ISD::POST_INC;
184
161k
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
8.34k
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
8.34k
    switch (M) {
176
8.34k
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
8.34k
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
8.34k
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
8.34k
      case TTI::MIM_PostInc:
183
8.34k
        return ISD::POST_INC;
184
8.34k
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
112
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
112
    switch (M) {
176
112
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
112
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
112
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
112
      case TTI::MIM_PostInc:
183
112
        return ISD::POST_INC;
184
112
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
454
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
454
    switch (M) {
176
454
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
454
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
454
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
454
      case TTI::MIM_PostInc:
183
454
        return ISD::POST_INC;
184
454
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
494
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
494
    switch (M) {
176
494
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
494
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
494
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
494
      case TTI::MIM_PostInc:
183
494
        return ISD::POST_INC;
184
494
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
19.9k
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
19.9k
    switch (M) {
176
19.9k
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
19.9k
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
19.9k
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
19.9k
      case TTI::MIM_PostInc:
183
19.9k
        return ISD::POST_INC;
184
19.9k
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
1.54k
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
1.54k
    switch (M) {
176
1.54k
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
1.54k
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
1.54k
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
1.54k
      case TTI::MIM_PostInc:
183
1.54k
        return ISD::POST_INC;
184
1.54k
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
432
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
432
    switch (M) {
176
432
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
432
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
432
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
432
      case TTI::MIM_PostInc:
183
432
        return ISD::POST_INC;
184
432
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
1.16M
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
1.16M
    switch (M) {
176
1.16M
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
1.16M
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
1.16M
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
1.16M
      case TTI::MIM_PostInc:
183
1.16M
        return ISD::POST_INC;
184
1.16M
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getISDIndexedMode(llvm::TargetTransformInfo::MemIndexedMode)
Line
Count
Source
174
8
  static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M) {
175
8
    switch (M) {
176
8
      case TTI::MIM_Unindexed:
177
0
        return ISD::UNINDEXED;
178
8
      case TTI::MIM_PreInc:
179
0
        return ISD::PRE_INC;
180
8
      case TTI::MIM_PreDec:
181
0
        return ISD::PRE_DEC;
182
8
      case TTI::MIM_PostInc:
183
8
        return ISD::POST_INC;
184
8
      case TTI::MIM_PostDec:
185
0
        return ISD::POST_DEC;
186
0
    }
187
0
    llvm_unreachable("Unexpected MemIndexedMode");
188
0
  }
189
190
protected:
191
  explicit BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
192
16.1M
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
11.9M
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
37.6k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::AMDGPUTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
463k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
425k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
601k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
30.5k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
627
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
19.5k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
90.3k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
97.6k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
29.4k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
2.27M
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
1.87k
      : BaseT(DL) {}
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::BasicTTIImplBase(llvm::TargetMachine const*, llvm::DataLayout const&)
Line
Count
Source
192
93.9k
      : BaseT(DL) {}
193
194
  using TargetTransformInfoImplBase::DL;
195
196
public:
197
  /// \name Scalar TTI Implementations
198
  /// @{
199
  bool allowsMisalignedMemoryAccesses(LLVMContext &Context,
200
                                      unsigned BitWidth, unsigned AddressSpace,
201
8.70k
                                      unsigned Alignment, bool *Fast) const {
202
8.70k
    EVT E = EVT::getIntegerVT(Context, BitWidth);
203
8.70k
    return getTLI()->allowsMisalignedMemoryAccesses(E, AddressSpace, Alignment, Fast);
204
8.70k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Line
Count
Source
201
118
                                      unsigned Alignment, bool *Fast) const {
202
118
    EVT E = EVT::getIntegerVT(Context, BitWidth);
203
118
    return getTLI()->allowsMisalignedMemoryAccesses(E, AddressSpace, Alignment, Fast);
204
118
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Line
Count
Source
201
8.52k
                                      unsigned Alignment, bool *Fast) const {
202
8.52k
    EVT E = EVT::getIntegerVT(Context, BitWidth);
203
8.52k
    return getTLI()->allowsMisalignedMemoryAccesses(E, AddressSpace, Alignment, Fast);
204
8.52k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Line
Count
Source
201
21
                                      unsigned Alignment, bool *Fast) const {
202
21
    EVT E = EVT::getIntegerVT(Context, BitWidth);
203
21
    return getTLI()->allowsMisalignedMemoryAccesses(E, AddressSpace, Alignment, Fast);
204
21
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
Line
Count
Source
201
47
                                      unsigned Alignment, bool *Fast) const {
202
47
    EVT E = EVT::getIntegerVT(Context, BitWidth);
203
47
    return getTLI()->allowsMisalignedMemoryAccesses(E, AddressSpace, Alignment, Fast);
204
47
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::allowsMisalignedMemoryAccesses(llvm::LLVMContext&, unsigned int, unsigned int, unsigned int, bool*) const
205
206
462k
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::hasBranchDivergence()
Line
Count
Source
206
357k
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::hasBranchDivergence()
Line
Count
Source
206
2.43k
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::hasBranchDivergence()
Line
Count
Source
206
22.2k
  bool hasBranchDivergence() { return false; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::hasBranchDivergence()
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::hasBranchDivergence()
Line
Count
Source
206
45
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::hasBranchDivergence()
Line
Count
Source
206
74
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::hasBranchDivergence()
Line
Count
Source
206
3.18k
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::hasBranchDivergence()
Line
Count
Source
206
164
  bool hasBranchDivergence() { return false; }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::hasBranchDivergence()
Line
Count
Source
206
75.9k
  bool hasBranchDivergence() { return false; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::hasBranchDivergence()
207
208
0
  bool isSourceOfDivergence(const Value *V) { return false; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isSourceOfDivergence(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isSourceOfDivergence(llvm::Value const*)
209
210
108
  bool isAlwaysUniform(const Value *V) { return false; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isAlwaysUniform(llvm::Value const*)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isAlwaysUniform(llvm::Value const*)
Line
Count
Source
210
108
  bool isAlwaysUniform(const Value *V) { return false; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isAlwaysUniform(llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isAlwaysUniform(llvm::Value const*)
211
212
2.35k
  unsigned getFlatAddressSpace() {
213
2.35k
    // Return an invalid address space.
214
2.35k
    return -1;
215
2.35k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getFlatAddressSpace()
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getFlatAddressSpace()
Line
Count
Source
212
2.35k
  unsigned getFlatAddressSpace() {
213
2.35k
    // Return an invalid address space.
214
2.35k
    return -1;
215
2.35k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getFlatAddressSpace()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getFlatAddressSpace()
216
217
2.61M
  bool isLegalAddImmediate(int64_t imm) {
218
2.61M
    return getTLI()->isLegalAddImmediate(imm);
219
2.61M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
2.55M
  bool isLegalAddImmediate(int64_t imm) {
218
2.55M
    return getTLI()->isLegalAddImmediate(imm);
219
2.55M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
14
  bool isLegalAddImmediate(int64_t imm) {
218
14
    return getTLI()->isLegalAddImmediate(imm);
219
14
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
618
  bool isLegalAddImmediate(int64_t imm) {
218
618
    return getTLI()->isLegalAddImmediate(imm);
219
618
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
28.3k
  bool isLegalAddImmediate(int64_t imm) {
218
28.3k
    return getTLI()->isLegalAddImmediate(imm);
219
28.3k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
1.20k
  bool isLegalAddImmediate(int64_t imm) {
218
1.20k
    return getTLI()->isLegalAddImmediate(imm);
219
1.20k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isLegalAddImmediate(long long)
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
5
  bool isLegalAddImmediate(int64_t imm) {
218
5
    return getTLI()->isLegalAddImmediate(imm);
219
5
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
19
  bool isLegalAddImmediate(int64_t imm) {
218
19
    return getTLI()->isLegalAddImmediate(imm);
219
19
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
2.98k
  bool isLegalAddImmediate(int64_t imm) {
218
2.98k
    return getTLI()->isLegalAddImmediate(imm);
219
2.98k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
21
  bool isLegalAddImmediate(int64_t imm) {
218
21
    return getTLI()->isLegalAddImmediate(imm);
219
21
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
16
  bool isLegalAddImmediate(int64_t imm) {
218
16
    return getTLI()->isLegalAddImmediate(imm);
219
16
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isLegalAddImmediate(long long)
Line
Count
Source
217
32.5k
  bool isLegalAddImmediate(int64_t imm) {
218
32.5k
    return getTLI()->isLegalAddImmediate(imm);
219
32.5k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isLegalAddImmediate(long long)
220
221
528k
  bool isLegalICmpImmediate(int64_t imm) {
222
528k
    return getTLI()->isLegalICmpImmediate(imm);
223
528k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
452k
  bool isLegalICmpImmediate(int64_t imm) {
222
452k
    return getTLI()->isLegalICmpImmediate(imm);
223
452k
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
74
  bool isLegalICmpImmediate(int64_t imm) {
222
74
    return getTLI()->isLegalICmpImmediate(imm);
223
74
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
470
  bool isLegalICmpImmediate(int64_t imm) {
222
470
    return getTLI()->isLegalICmpImmediate(imm);
223
470
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
12.0k
  bool isLegalICmpImmediate(int64_t imm) {
222
12.0k
    return getTLI()->isLegalICmpImmediate(imm);
223
12.0k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
1.26k
  bool isLegalICmpImmediate(int64_t imm) {
222
1.26k
    return getTLI()->isLegalICmpImmediate(imm);
223
1.26k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isLegalICmpImmediate(long long)
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
22
  bool isLegalICmpImmediate(int64_t imm) {
222
22
    return getTLI()->isLegalICmpImmediate(imm);
223
22
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
48
  bool isLegalICmpImmediate(int64_t imm) {
222
48
    return getTLI()->isLegalICmpImmediate(imm);
223
48
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
2.78k
  bool isLegalICmpImmediate(int64_t imm) {
222
2.78k
    return getTLI()->isLegalICmpImmediate(imm);
223
2.78k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
222
  bool isLegalICmpImmediate(int64_t imm) {
222
222
    return getTLI()->isLegalICmpImmediate(imm);
223
222
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
50
  bool isLegalICmpImmediate(int64_t imm) {
222
50
    return getTLI()->isLegalICmpImmediate(imm);
223
50
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isLegalICmpImmediate(long long)
Line
Count
Source
221
59.6k
  bool isLegalICmpImmediate(int64_t imm) {
222
59.6k
    return getTLI()->isLegalICmpImmediate(imm);
223
59.6k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isLegalICmpImmediate(long long)
224
225
  bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset,
226
                             bool HasBaseReg, int64_t Scale,
227
58.1M
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
58.1M
    TargetLoweringBase::AddrMode AM;
229
58.1M
    AM.BaseGV = BaseGV;
230
58.1M
    AM.BaseOffs = BaseOffset;
231
58.1M
    AM.HasBaseReg = HasBaseReg;
232
58.1M
    AM.Scale = Scale;
233
58.1M
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
58.1M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
53.3M
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
53.3M
    TargetLoweringBase::AddrMode AM;
229
53.3M
    AM.BaseGV = BaseGV;
230
53.3M
    AM.BaseOffs = BaseOffset;
231
53.3M
    AM.HasBaseReg = HasBaseReg;
232
53.3M
    AM.Scale = Scale;
233
53.3M
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
53.3M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
2.35k
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
2.35k
    TargetLoweringBase::AddrMode AM;
229
2.35k
    AM.BaseGV = BaseGV;
230
2.35k
    AM.BaseOffs = BaseOffset;
231
2.35k
    AM.HasBaseReg = HasBaseReg;
232
2.35k
    AM.Scale = Scale;
233
2.35k
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
2.35k
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
55.7k
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
55.7k
    TargetLoweringBase::AddrMode AM;
229
55.7k
    AM.BaseGV = BaseGV;
230
55.7k
    AM.BaseOffs = BaseOffset;
231
55.7k
    AM.HasBaseReg = HasBaseReg;
232
55.7k
    AM.Scale = Scale;
233
55.7k
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
55.7k
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
793k
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
793k
    TargetLoweringBase::AddrMode AM;
229
793k
    AM.BaseGV = BaseGV;
230
793k
    AM.BaseOffs = BaseOffset;
231
793k
    AM.HasBaseReg = HasBaseReg;
232
793k
    AM.Scale = Scale;
233
793k
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
793k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
23.1k
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
23.1k
    TargetLoweringBase::AddrMode AM;
229
23.1k
    AM.BaseGV = BaseGV;
230
23.1k
    AM.BaseOffs = BaseOffset;
231
23.1k
    AM.HasBaseReg = HasBaseReg;
232
23.1k
    AM.Scale = Scale;
233
23.1k
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
23.1k
  }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
32
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
32
    TargetLoweringBase::AddrMode AM;
229
32
    AM.BaseGV = BaseGV;
230
32
    AM.BaseOffs = BaseOffset;
231
32
    AM.HasBaseReg = HasBaseReg;
232
32
    AM.Scale = Scale;
233
32
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
32
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
333
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
333
    TargetLoweringBase::AddrMode AM;
229
333
    AM.BaseGV = BaseGV;
230
333
    AM.BaseOffs = BaseOffset;
231
333
    AM.HasBaseReg = HasBaseReg;
232
333
    AM.Scale = Scale;
233
333
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
333
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
899
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
899
    TargetLoweringBase::AddrMode AM;
229
899
    AM.BaseGV = BaseGV;
230
899
    AM.BaseOffs = BaseOffset;
231
899
    AM.HasBaseReg = HasBaseReg;
232
899
    AM.Scale = Scale;
233
899
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
899
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
45.8k
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
45.8k
    TargetLoweringBase::AddrMode AM;
229
45.8k
    AM.BaseGV = BaseGV;
230
45.8k
    AM.BaseOffs = BaseOffset;
231
45.8k
    AM.HasBaseReg = HasBaseReg;
232
45.8k
    AM.Scale = Scale;
233
45.8k
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
45.8k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
4.13k
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
4.13k
    TargetLoweringBase::AddrMode AM;
229
4.13k
    AM.BaseGV = BaseGV;
230
4.13k
    AM.BaseOffs = BaseOffset;
231
4.13k
    AM.HasBaseReg = HasBaseReg;
232
4.13k
    AM.Scale = Scale;
233
4.13k
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
4.13k
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
142
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
142
    TargetLoweringBase::AddrMode AM;
229
142
    AM.BaseGV = BaseGV;
230
142
    AM.BaseOffs = BaseOffset;
231
142
    AM.HasBaseReg = HasBaseReg;
232
142
    AM.Scale = Scale;
233
142
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
142
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
3.81M
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
3.81M
    TargetLoweringBase::AddrMode AM;
229
3.81M
    AM.BaseGV = BaseGV;
230
3.81M
    AM.BaseOffs = BaseOffset;
231
3.81M
    AM.HasBaseReg = HasBaseReg;
232
3.81M
    AM.Scale = Scale;
233
3.81M
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
3.81M
  }
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isLegalAddressingMode(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int, llvm::Instruction*)
Line
Count
Source
227
10
                             unsigned AddrSpace, Instruction *I = nullptr) {
228
10
    TargetLoweringBase::AddrMode AM;
229
10
    AM.BaseGV = BaseGV;
230
10
    AM.BaseOffs = BaseOffset;
231
10
    AM.HasBaseReg = HasBaseReg;
232
10
    AM.Scale = Scale;
233
10
    return getTLI()->isLegalAddressingMode(DL, AM, Ty, AddrSpace, I);
234
10
  }
235
236
  bool isIndexedLoadLegal(TTI::MemIndexedMode M, Type *Ty,
237
7.59M
                          const DataLayout &DL) const {
238
7.59M
    EVT VT = getTLI()->getValueType(DL, Ty);
239
7.59M
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
7.59M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
6.82M
                          const DataLayout &DL) const {
238
6.82M
    EVT VT = getTLI()->getValueType(DL, Ty);
239
6.82M
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
6.82M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
128
                          const DataLayout &DL) const {
238
128
    EVT VT = getTLI()->getValueType(DL, Ty);
239
128
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
128
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
3.46k
                          const DataLayout &DL) const {
238
3.46k
    EVT VT = getTLI()->getValueType(DL, Ty);
239
3.46k
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
3.46k
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
161k
                          const DataLayout &DL) const {
238
161k
    EVT VT = getTLI()->getValueType(DL, Ty);
239
161k
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
161k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
8.34k
                          const DataLayout &DL) const {
238
8.34k
    EVT VT = getTLI()->getValueType(DL, Ty);
239
8.34k
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
8.34k
  }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
56
                          const DataLayout &DL) const {
238
56
    EVT VT = getTLI()->getValueType(DL, Ty);
239
56
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
56
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
267
                          const DataLayout &DL) const {
238
267
    EVT VT = getTLI()->getValueType(DL, Ty);
239
267
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
267
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
247
                          const DataLayout &DL) const {
238
247
    EVT VT = getTLI()->getValueType(DL, Ty);
239
247
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
247
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
9.97k
                          const DataLayout &DL) const {
238
9.97k
    EVT VT = getTLI()->getValueType(DL, Ty);
239
9.97k
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
9.97k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
773
                          const DataLayout &DL) const {
238
773
    EVT VT = getTLI()->getValueType(DL, Ty);
239
773
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
773
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
216
                          const DataLayout &DL) const {
238
216
    EVT VT = getTLI()->getValueType(DL, Ty);
239
216
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
216
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
582k
                          const DataLayout &DL) const {
238
582k
    EVT VT = getTLI()->getValueType(DL, Ty);
239
582k
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
582k
  }
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isIndexedLoadLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
237
4
                          const DataLayout &DL) const {
238
4
    EVT VT = getTLI()->getValueType(DL, Ty);
239
4
    return getTLI()->isIndexedLoadLegal(getISDIndexedMode(M), VT);
240
4
  }
241
242
  bool isIndexedStoreLegal(TTI::MemIndexedMode M, Type *Ty,
243
597k
                           const DataLayout &DL) const {
244
597k
    EVT VT = getTLI()->getValueType(DL, Ty);
245
597k
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
597k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
128
                           const DataLayout &DL) const {
244
128
    EVT VT = getTLI()->getValueType(DL, Ty);
245
128
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
128
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
3.46k
                           const DataLayout &DL) const {
244
3.46k
    EVT VT = getTLI()->getValueType(DL, Ty);
245
3.46k
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
3.46k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
56
                           const DataLayout &DL) const {
244
56
    EVT VT = getTLI()->getValueType(DL, Ty);
245
56
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
56
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
187
                           const DataLayout &DL) const {
244
187
    EVT VT = getTLI()->getValueType(DL, Ty);
245
187
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
187
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
247
                           const DataLayout &DL) const {
244
247
    EVT VT = getTLI()->getValueType(DL, Ty);
245
247
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
247
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
9.97k
                           const DataLayout &DL) const {
244
9.97k
    EVT VT = getTLI()->getValueType(DL, Ty);
245
9.97k
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
9.97k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
773
                           const DataLayout &DL) const {
244
773
    EVT VT = getTLI()->getValueType(DL, Ty);
245
773
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
773
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
216
                           const DataLayout &DL) const {
244
216
    EVT VT = getTLI()->getValueType(DL, Ty);
245
216
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
216
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
582k
                           const DataLayout &DL) const {
244
582k
    EVT VT = getTLI()->getValueType(DL, Ty);
245
582k
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
582k
  }
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isIndexedStoreLegal(llvm::TargetTransformInfo::MemIndexedMode, llvm::Type*, llvm::DataLayout const&) const
Line
Count
Source
243
4
                           const DataLayout &DL) const {
244
4
    EVT VT = getTLI()->getValueType(DL, Ty);
245
4
    return getTLI()->isIndexedStoreLegal(getISDIndexedMode(M), VT);
246
4
  }
247
248
4.10M
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
4.10M
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
4.10M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
3.97M
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
3.97M
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
3.97M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
74
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
74
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
74
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
934
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
934
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
934
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
113k
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
113k
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
113k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
4.51k
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
4.51k
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
4.51k
  }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
28
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
28
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
28
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
142
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
142
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
142
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
130
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
130
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
130
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
4.25k
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
4.25k
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
4.25k
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
112
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
112
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
112
  }
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isLSRCostLess(llvm::TargetTransformInfo::LSRCost, llvm::TargetTransformInfo::LSRCost)
Line
Count
Source
248
2
  bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2) {
249
2
    return TargetTransformInfoImplBase::isLSRCostLess(C1, C2);
250
2
  }
251
252
  int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset,
253
5.85M
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
5.85M
    TargetLoweringBase::AddrMode AM;
255
5.85M
    AM.BaseGV = BaseGV;
256
5.85M
    AM.BaseOffs = BaseOffset;
257
5.85M
    AM.HasBaseReg = HasBaseReg;
258
5.85M
    AM.Scale = Scale;
259
5.85M
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
5.85M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
5.13M
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
5.13M
    TargetLoweringBase::AddrMode AM;
255
5.13M
    AM.BaseGV = BaseGV;
256
5.13M
    AM.BaseOffs = BaseOffset;
257
5.13M
    AM.HasBaseReg = HasBaseReg;
258
5.13M
    AM.Scale = Scale;
259
5.13M
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
5.13M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
10
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
10
    TargetLoweringBase::AddrMode AM;
255
10
    AM.BaseGV = BaseGV;
256
10
    AM.BaseOffs = BaseOffset;
257
10
    AM.HasBaseReg = HasBaseReg;
258
10
    AM.Scale = Scale;
259
10
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
10
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
434
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
434
    TargetLoweringBase::AddrMode AM;
255
434
    AM.BaseGV = BaseGV;
256
434
    AM.BaseOffs = BaseOffset;
257
434
    AM.HasBaseReg = HasBaseReg;
258
434
    AM.Scale = Scale;
259
434
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
434
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
95.0k
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
95.0k
    TargetLoweringBase::AddrMode AM;
255
95.0k
    AM.BaseGV = BaseGV;
256
95.0k
    AM.BaseOffs = BaseOffset;
257
95.0k
    AM.HasBaseReg = HasBaseReg;
258
95.0k
    AM.Scale = Scale;
259
95.0k
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
95.0k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
4
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
4
    TargetLoweringBase::AddrMode AM;
255
4
    AM.BaseGV = BaseGV;
256
4
    AM.BaseOffs = BaseOffset;
257
4
    AM.HasBaseReg = HasBaseReg;
258
4
    AM.Scale = Scale;
259
4
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
4
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
14
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
14
    TargetLoweringBase::AddrMode AM;
255
14
    AM.BaseGV = BaseGV;
256
14
    AM.BaseOffs = BaseOffset;
257
14
    AM.HasBaseReg = HasBaseReg;
258
14
    AM.Scale = Scale;
259
14
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
14
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
7.15k
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
7.15k
    TargetLoweringBase::AddrMode AM;
255
7.15k
    AM.BaseGV = BaseGV;
256
7.15k
    AM.BaseOffs = BaseOffset;
257
7.15k
    AM.HasBaseReg = HasBaseReg;
258
7.15k
    AM.Scale = Scale;
259
7.15k
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
7.15k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
662
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
662
    TargetLoweringBase::AddrMode AM;
255
662
    AM.BaseGV = BaseGV;
256
662
    AM.BaseOffs = BaseOffset;
257
662
    AM.HasBaseReg = HasBaseReg;
258
662
    AM.Scale = Scale;
259
662
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
662
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
Line
Count
Source
253
623k
                           bool HasBaseReg, int64_t Scale, unsigned AddrSpace) {
254
623k
    TargetLoweringBase::AddrMode AM;
255
623k
    AM.BaseGV = BaseGV;
256
623k
    AM.BaseOffs = BaseOffset;
257
623k
    AM.HasBaseReg = HasBaseReg;
258
623k
    AM.Scale = Scale;
259
623k
    return getTLI()->getScalingFactorCost(DL, AM, Ty, AddrSpace);
260
623k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getScalingFactorCost(llvm::Type*, llvm::GlobalValue*, long long, bool, long long, unsigned int)
261
262
1.46M
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
1.46M
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
1.46M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
1.43M
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
1.43M
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
1.43M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
26
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
26
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
26
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
1.27k
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
1.27k
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
1.27k
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
4.05k
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
4.05k
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
4.05k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
443
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
443
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
443
  }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
8
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
8
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
8
  }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
65
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
65
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
65
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
98
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
98
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
98
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
1.66k
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
1.66k
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
1.66k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
209
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
209
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
209
  }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
76
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
76
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
76
  }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
Line
Count
Source
262
21.0k
  bool isTruncateFree(Type *Ty1, Type *Ty2) {
263
21.0k
    return getTLI()->isTruncateFree(Ty1, Ty2);
264
21.0k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isTruncateFree(llvm::Type*, llvm::Type*)
265
266
120k
  bool isProfitableToHoist(Instruction *I) {
267
120k
    return getTLI()->isProfitableToHoist(I);
268
120k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isProfitableToHoist(llvm::Instruction*)
Line
Count
Source
266
78.0k
  bool isProfitableToHoist(Instruction *I) {
267
78.0k
    return getTLI()->isProfitableToHoist(I);
268
78.0k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isProfitableToHoist(llvm::Instruction*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isProfitableToHoist(llvm::Instruction*)
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isProfitableToHoist(llvm::Instruction*)
Line
Count
Source
266
8.91k
  bool isProfitableToHoist(Instruction *I) {
267
8.91k
    return getTLI()->isProfitableToHoist(I);
268
8.91k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isProfitableToHoist(llvm::Instruction*)
Line
Count
Source
266
16
  bool isProfitableToHoist(Instruction *I) {
267
16
    return getTLI()->isProfitableToHoist(I);
268
16
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isProfitableToHoist(llvm::Instruction*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isProfitableToHoist(llvm::Instruction*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isProfitableToHoist(llvm::Instruction*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isProfitableToHoist(llvm::Instruction*)
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isProfitableToHoist(llvm::Instruction*)
Line
Count
Source
266
64
  bool isProfitableToHoist(Instruction *I) {
267
64
    return getTLI()->isProfitableToHoist(I);
268
64
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isProfitableToHoist(llvm::Instruction*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isProfitableToHoist(llvm::Instruction*)
Line
Count
Source
266
33.2k
  bool isProfitableToHoist(Instruction *I) {
267
33.2k
    return getTLI()->isProfitableToHoist(I);
268
33.2k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isProfitableToHoist(llvm::Instruction*)
269
270
576
  bool useAA() const { return getST()->useAA(); }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::useAA() const
Line
Count
Source
270
35
  bool useAA() const { return getST()->useAA(); }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::useAA() const
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::useAA() const
Line
Count
Source
270
541
  bool useAA() const { return getST()->useAA(); }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::X86TTIImpl>::useAA() const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::useAA() const
271
272
17.8k
  bool isTypeLegal(Type *Ty) {
273
17.8k
    EVT VT = getTLI()->getValueType(DL, Ty);
274
17.8k
    return getTLI()->isTypeLegal(VT);
275
17.8k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
17.0k
  bool isTypeLegal(Type *Ty) {
273
17.0k
    EVT VT = getTLI()->getValueType(DL, Ty);
274
17.0k
    return getTLI()->isTypeLegal(VT);
275
17.0k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isTypeLegal(llvm::Type*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
2
  bool isTypeLegal(Type *Ty) {
273
2
    EVT VT = getTLI()->getValueType(DL, Ty);
274
2
    return getTLI()->isTypeLegal(VT);
275
2
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
149
  bool isTypeLegal(Type *Ty) {
273
149
    EVT VT = getTLI()->getValueType(DL, Ty);
274
149
    return getTLI()->isTypeLegal(VT);
275
149
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
3
  bool isTypeLegal(Type *Ty) {
273
3
    EVT VT = getTLI()->getValueType(DL, Ty);
274
3
    return getTLI()->isTypeLegal(VT);
275
3
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isTypeLegal(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isTypeLegal(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isTypeLegal(llvm::Type*)
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
7
  bool isTypeLegal(Type *Ty) {
273
7
    EVT VT = getTLI()->getValueType(DL, Ty);
274
7
    return getTLI()->isTypeLegal(VT);
275
7
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
5
  bool isTypeLegal(Type *Ty) {
273
5
    EVT VT = getTLI()->getValueType(DL, Ty);
274
5
    return getTLI()->isTypeLegal(VT);
275
5
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isTypeLegal(llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::isTypeLegal(llvm::Type*)
Line
Count
Source
272
576
  bool isTypeLegal(Type *Ty) {
273
576
    EVT VT = getTLI()->getValueType(DL, Ty);
274
576
    return getTLI()->isTypeLegal(VT);
275
576
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isTypeLegal(llvm::Type*)
276
277
  int getGEPCost(Type *PointeeType, const Value *Ptr,
278
6.01M
                 ArrayRef<const Value *> Operands) {
279
6.01M
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
6.01M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
5.46M
                 ArrayRef<const Value *> Operands) {
279
5.46M
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
5.46M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
1.84k
                 ArrayRef<const Value *> Operands) {
279
1.84k
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
1.84k
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
33.4k
                 ArrayRef<const Value *> Operands) {
279
33.4k
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
33.4k
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
89.8k
                 ArrayRef<const Value *> Operands) {
279
89.8k
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
89.8k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
27
                 ArrayRef<const Value *> Operands) {
279
27
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
27
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
335
                 ArrayRef<const Value *> Operands) {
279
335
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
335
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
887
                 ArrayRef<const Value *> Operands) {
279
887
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
887
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
75
                 ArrayRef<const Value *> Operands) {
279
75
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
75
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
278
419k
                 ArrayRef<const Value *> Operands) {
279
419k
    return BaseT::getGEPCost(PointeeType, Ptr, Operands);
280
419k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getGEPCost(llvm::Type*, llvm::Value const*, llvm::ArrayRef<llvm::Value const*>)
281
282
1.48M
  int getExtCost(const Instruction *I, const Value *Src) {
283
1.48M
    if (getTLI()->isExtFree(I))
284
595k
      return TargetTransformInfo::TCC_Free;
285
894k
286
894k
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)578k
)
287
821k
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
553k
        if (getTLI()->isExtLoad(LI, I, DL))
289
544k
          return TargetTransformInfo::TCC_Free;
290
349k
291
349k
    return TargetTransformInfo::TCC_Basic;
292
349k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
1.34M
  int getExtCost(const Instruction *I, const Value *Src) {
283
1.34M
    if (getTLI()->isExtFree(I))
284
570k
      return TargetTransformInfo::TCC_Free;
285
776k
286
776k
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)520k
)
287
703k
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
482k
        if (getTLI()->isExtLoad(LI, I, DL))
289
475k
          return TargetTransformInfo::TCC_Free;
290
301k
291
301k
    return TargetTransformInfo::TCC_Basic;
292
301k
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
1
  int getExtCost(const Instruction *I, const Value *Src) {
283
1
    if (getTLI()->isExtFree(I))
284
0
      return TargetTransformInfo::TCC_Free;
285
1
286
1
    if (isa<ZExtInst>(I) || isa<SExtInst>(I))
287
1
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
0
        if (getTLI()->isExtLoad(LI, I, DL))
289
0
          return TargetTransformInfo::TCC_Free;
290
1
291
1
    return TargetTransformInfo::TCC_Basic;
292
1
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
190
  int getExtCost(const Instruction *I, const Value *Src) {
283
190
    if (getTLI()->isExtFree(I))
284
104
      return TargetTransformInfo::TCC_Free;
285
86
286
86
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)77
)
287
86
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
34
        if (getTLI()->isExtLoad(LI, I, DL))
289
30
          return TargetTransformInfo::TCC_Free;
290
56
291
56
    return TargetTransformInfo::TCC_Basic;
292
56
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
48.6k
  int getExtCost(const Instruction *I, const Value *Src) {
283
48.6k
    if (getTLI()->isExtFree(I))
284
0
      return TargetTransformInfo::TCC_Free;
285
48.6k
286
48.6k
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)18.0k
)
287
48.6k
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
29.9k
        if (getTLI()->isExtLoad(LI, I, DL))
289
29.5k
          return TargetTransformInfo::TCC_Free;
290
19.0k
291
19.0k
    return TargetTransformInfo::TCC_Basic;
292
19.0k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
12
  int getExtCost(const Instruction *I, const Value *Src) {
283
12
    if (getTLI()->isExtFree(I))
284
0
      return TargetTransformInfo::TCC_Free;
285
12
286
12
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)2
)
287
12
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
2
        if (getTLI()->isExtLoad(LI, I, DL))
289
2
          return TargetTransformInfo::TCC_Free;
290
10
291
10
    return TargetTransformInfo::TCC_Basic;
292
10
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
1
  int getExtCost(const Instruction *I, const Value *Src) {
283
1
    if (getTLI()->isExtFree(I))
284
0
      return TargetTransformInfo::TCC_Free;
285
1
286
1
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)0
)
287
1
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
0
        if (getTLI()->isExtLoad(LI, I, DL))
289
0
          return TargetTransformInfo::TCC_Free;
290
1
291
1
    return TargetTransformInfo::TCC_Basic;
292
1
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
223
  int getExtCost(const Instruction *I, const Value *Src) {
283
223
    if (getTLI()->isExtFree(I))
284
6
      return TargetTransformInfo::TCC_Free;
285
217
286
217
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)92
)
287
217
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
113
        if (getTLI()->isExtLoad(LI, I, DL))
289
108
          return TargetTransformInfo::TCC_Free;
290
109
291
109
    return TargetTransformInfo::TCC_Basic;
292
109
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
17
  int getExtCost(const Instruction *I, const Value *Src) {
283
17
    if (getTLI()->isExtFree(I))
284
0
      return TargetTransformInfo::TCC_Free;
285
17
286
17
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)4
)
287
17
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
9
        if (getTLI()->isExtLoad(LI, I, DL))
289
9
          return TargetTransformInfo::TCC_Free;
290
8
291
8
    return TargetTransformInfo::TCC_Basic;
292
8
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
Line
Count
Source
282
93.8k
  int getExtCost(const Instruction *I, const Value *Src) {
283
93.8k
    if (getTLI()->isExtFree(I))
284
24.8k
      return TargetTransformInfo::TCC_Free;
285
69.0k
286
69.0k
    if (isa<ZExtInst>(I) || 
isa<SExtInst>(I)39.7k
)
287
69.0k
      if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
288
40.2k
        if (getTLI()->isExtLoad(LI, I, DL))
289
39.9k
          return TargetTransformInfo::TCC_Free;
290
29.0k
291
29.0k
    return TargetTransformInfo::TCC_Basic;
292
29.0k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getExtCost(llvm::Instruction const*, llvm::Value const*)
293
294
  unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
295
4
                            ArrayRef<const Value *> Arguments) {
296
4
    return BaseT::getIntrinsicCost(IID, RetTy, Arguments);
297
4
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
295
2
                            ArrayRef<const Value *> Arguments) {
296
2
    return BaseT::getIntrinsicCost(IID, RetTy, Arguments);
297
2
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
295
2
                            ArrayRef<const Value *> Arguments) {
296
2
    return BaseT::getIntrinsicCost(IID, RetTy, Arguments);
297
2
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
298
299
  unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
300
897k
                            ArrayRef<Type *> ParamTys) {
301
897k
    if (IID == Intrinsic::cttz) {
302
6.83k
      if (getTLI()->isCheapToSpeculateCttz())
303
3.69k
        return TargetTransformInfo::TCC_Basic;
304
3.14k
      return TargetTransformInfo::TCC_Expensive;
305
3.14k
    }
306
890k
307
890k
    if (IID == Intrinsic::ctlz) {
308
10.2k
      if (getTLI()->isCheapToSpeculateCtlz())
309
6.31k
        return TargetTransformInfo::TCC_Basic;
310
3.89k
      return TargetTransformInfo::TCC_Expensive;
311
3.89k
    }
312
880k
313
880k
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
880k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
744k
                            ArrayRef<Type *> ParamTys) {
301
744k
    if (IID == Intrinsic::cttz) {
302
686
      if (getTLI()->isCheapToSpeculateCttz())
303
686
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
743k
307
743k
    if (IID == Intrinsic::ctlz) {
308
1.50k
      if (getTLI()->isCheapToSpeculateCtlz())
309
1.50k
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
742k
313
742k
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
742k
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
2
                            ArrayRef<Type *> ParamTys) {
301
2
    if (IID == Intrinsic::cttz) {
302
0
      if (getTLI()->isCheapToSpeculateCttz())
303
0
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
2
307
2
    if (IID == Intrinsic::ctlz) {
308
0
      if (getTLI()->isCheapToSpeculateCtlz())
309
0
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
2
313
2
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
2
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
476
                            ArrayRef<Type *> ParamTys) {
301
476
    if (IID == Intrinsic::cttz) {
302
12
      if (getTLI()->isCheapToSpeculateCttz())
303
12
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
464
307
464
    if (IID == Intrinsic::ctlz) {
308
12
      if (getTLI()->isCheapToSpeculateCtlz())
309
12
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
452
313
452
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
452
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
36.0k
                            ArrayRef<Type *> ParamTys) {
301
36.0k
    if (IID == Intrinsic::cttz) {
302
2.03k
      if (getTLI()->isCheapToSpeculateCttz())
303
1.97k
        return TargetTransformInfo::TCC_Basic;
304
60
      return TargetTransformInfo::TCC_Expensive;
305
60
    }
306
34.0k
307
34.0k
    if (IID == Intrinsic::ctlz) {
308
4.20k
      if (getTLI()->isCheapToSpeculateCtlz())
309
3.76k
        return TargetTransformInfo::TCC_Basic;
310
437
      return TargetTransformInfo::TCC_Expensive;
311
437
    }
312
29.8k
313
29.8k
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
29.8k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
14
                            ArrayRef<Type *> ParamTys) {
301
14
    if (IID == Intrinsic::cttz) {
302
0
      if (getTLI()->isCheapToSpeculateCttz())
303
0
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
14
307
14
    if (IID == Intrinsic::ctlz) {
308
0
      if (getTLI()->isCheapToSpeculateCtlz())
309
0
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
14
313
14
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
14
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
5
                            ArrayRef<Type *> ParamTys) {
301
5
    if (IID == Intrinsic::cttz) {
302
1
      if (getTLI()->isCheapToSpeculateCttz())
303
1
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
4
307
4
    if (IID == Intrinsic::ctlz) {
308
1
      if (getTLI()->isCheapToSpeculateCtlz())
309
1
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
3
313
3
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
3
  }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
16
                            ArrayRef<Type *> ParamTys) {
301
16
    if (IID == Intrinsic::cttz) {
302
0
      if (getTLI()->isCheapToSpeculateCttz())
303
0
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
16
307
16
    if (IID == Intrinsic::ctlz) {
308
0
      if (getTLI()->isCheapToSpeculateCtlz())
309
0
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
16
313
16
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
16
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
59
                            ArrayRef<Type *> ParamTys) {
301
59
    if (IID == Intrinsic::cttz) {
302
1
      if (getTLI()->isCheapToSpeculateCttz())
303
1
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
58
307
58
    if (IID == Intrinsic::ctlz) {
308
1
      if (getTLI()->isCheapToSpeculateCtlz())
309
1
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
57
313
57
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
57
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
20
                            ArrayRef<Type *> ParamTys) {
301
20
    if (IID == Intrinsic::cttz) {
302
0
      if (getTLI()->isCheapToSpeculateCttz())
303
0
        return TargetTransformInfo::TCC_Basic;
304
0
      return TargetTransformInfo::TCC_Expensive;
305
0
    }
306
20
307
20
    if (IID == Intrinsic::ctlz) {
308
0
      if (getTLI()->isCheapToSpeculateCtlz())
309
0
        return TargetTransformInfo::TCC_Basic;
310
0
      return TargetTransformInfo::TCC_Expensive;
311
0
    }
312
20
313
20
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
20
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
Line
Count
Source
300
116k
                            ArrayRef<Type *> ParamTys) {
301
116k
    if (IID == Intrinsic::cttz) {
302
4.10k
      if (getTLI()->isCheapToSpeculateCttz())
303
1.02k
        return TargetTransformInfo::TCC_Basic;
304
3.08k
      return TargetTransformInfo::TCC_Expensive;
305
3.08k
    }
306
112k
307
112k
    if (IID == Intrinsic::ctlz) {
308
4.48k
      if (getTLI()->isCheapToSpeculateCtlz())
309
1.02k
        return TargetTransformInfo::TCC_Basic;
310
3.45k
      return TargetTransformInfo::TCC_Expensive;
311
3.45k
    }
312
107k
313
107k
    return BaseT::getIntrinsicCost(IID, RetTy, ParamTys);
314
107k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getIntrinsicCost(llvm::Intrinsic::ID, llvm::Type*, llvm::ArrayRef<llvm::Type*>)
315
316
  unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI,
317
30.1k
                                            unsigned &JumpTableSize) {
318
30.1k
    /// Try to find the estimated number of clusters. Note that the number of
319
30.1k
    /// clusters identified in this function could be different from the actural
320
30.1k
    /// numbers found in lowering. This function ignore switches that are
321
30.1k
    /// lowered with a mix of jump table / bit test / BTree. This function was
322
30.1k
    /// initially intended to be used when estimating the cost of switch in
323
30.1k
    /// inline cost heuristic, but it's a generic cost model to be used in other
324
30.1k
    /// places (e.g., in loop unrolling).
325
30.1k
    unsigned N = SI.getNumCases();
326
30.1k
    const TargetLoweringBase *TLI = getTLI();
327
30.1k
    const DataLayout &DL = this->getDataLayout();
328
30.1k
329
30.1k
    JumpTableSize = 0;
330
30.1k
    bool IsJTAllowed = TLI->areJTsAllowed(SI.getParent()->getParent());
331
30.1k
332
30.1k
    // Early exit if both a jump table and bit test are not allowed.
333
30.1k
    if (N < 1 || (!IsJTAllowed && 
DL.getIndexSizeInBits(0u) < N0
))
334
0
      return N;
335
30.1k
336
30.1k
    APInt MaxCaseVal = SI.case_begin()->getCaseValue()->getValue();
337
30.1k
    APInt MinCaseVal = MaxCaseVal;
338
299k
    for (auto CI : SI.cases()) {
339
299k
      const APInt &CaseVal = CI.getCaseValue()->getValue();
340
299k
      if (CaseVal.sgt(MaxCaseVal))
341
57.9k
        MaxCaseVal = CaseVal;
342
299k
      if (CaseVal.slt(MinCaseVal))
343
29.2k
        MinCaseVal = CaseVal;
344
299k
    }
345
30.1k
346
30.1k
    // Check if suitable for a bit test
347
30.1k
    if (N <= DL.getIndexSizeInBits(0u)) {
348
29.5k
      SmallPtrSet<const BasicBlock *, 4> Dests;
349
29.5k
      for (auto I : SI.cases())
350
192k
        Dests.insert(I.getCaseSuccessor());
351
29.5k
352
29.5k
      if (TLI->isSuitableForBitTests(Dests.size(), N, MinCaseVal, MaxCaseVal,
353
29.5k
                                     DL))
354
3.29k
        return 1;
355
26.8k
    }
356
26.8k
357
26.8k
    // Check if suitable for a jump table.
358
26.8k
    if (IsJTAllowed) {
359
26.8k
      if (N < 2 || N < TLI->getMinimumJumpTableEntries())
360
16.4k
        return N;
361
10.4k
      uint64_t Range =
362
10.4k
          (MaxCaseVal - MinCaseVal)
363
10.4k
              .getLimitedValue(std::numeric_limits<uint64_t>::max() - 1) + 1;
364
10.4k
      // Check whether a range of clusters is dense enough for a jump table
365
10.4k
      if (TLI->isSuitableForJumpTable(&SI, N, Range)) {
366
8.52k
        JumpTableSize = Range;
367
8.52k
        return 1;
368
8.52k
      }
369
1.90k
    }
370
1.90k
    return N;
371
1.90k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Line
Count
Source
317
23.4k
                                            unsigned &JumpTableSize) {
318
23.4k
    /// Try to find the estimated number of clusters. Note that the number of
319
23.4k
    /// clusters identified in this function could be different from the actural
320
23.4k
    /// numbers found in lowering. This function ignore switches that are
321
23.4k
    /// lowered with a mix of jump table / bit test / BTree. This function was
322
23.4k
    /// initially intended to be used when estimating the cost of switch in
323
23.4k
    /// inline cost heuristic, but it's a generic cost model to be used in other
324
23.4k
    /// places (e.g., in loop unrolling).
325
23.4k
    unsigned N = SI.getNumCases();
326
23.4k
    const TargetLoweringBase *TLI = getTLI();
327
23.4k
    const DataLayout &DL = this->getDataLayout();
328
23.4k
329
23.4k
    JumpTableSize = 0;
330
23.4k
    bool IsJTAllowed = TLI->areJTsAllowed(SI.getParent()->getParent());
331
23.4k
332
23.4k
    // Early exit if both a jump table and bit test are not allowed.
333
23.4k
    if (N < 1 || (!IsJTAllowed && 
DL.getIndexSizeInBits(0u) < N0
))
334
0
      return N;
335
23.4k
336
23.4k
    APInt MaxCaseVal = SI.case_begin()->getCaseValue()->getValue();
337
23.4k
    APInt MinCaseVal = MaxCaseVal;
338
269k
    for (auto CI : SI.cases()) {
339
269k
      const APInt &CaseVal = CI.getCaseValue()->getValue();
340
269k
      if (CaseVal.sgt(MaxCaseVal))
341
42.5k
        MaxCaseVal = CaseVal;
342
269k
      if (CaseVal.slt(MinCaseVal))
343
25.1k
        MinCaseVal = CaseVal;
344
269k
    }
345
23.4k
346
23.4k
    // Check if suitable for a bit test
347
23.4k
    if (N <= DL.getIndexSizeInBits(0u)) {
348
22.8k
      SmallPtrSet<const BasicBlock *, 4> Dests;
349
22.8k
      for (auto I : SI.cases())
350
163k
        Dests.insert(I.getCaseSuccessor());
351
22.8k
352
22.8k
      if (TLI->isSuitableForBitTests(Dests.size(), N, MinCaseVal, MaxCaseVal,
353
22.8k
                                     DL))
354
2.10k
        return 1;
355
21.3k
    }
356
21.3k
357
21.3k
    // Check if suitable for a jump table.
358
21.3k
    if (IsJTAllowed) {
359
21.3k
      if (N < 2 || N < TLI->getMinimumJumpTableEntries())
360
13.2k
        return N;
361
8.15k
      uint64_t Range =
362
8.15k
          (MaxCaseVal - MinCaseVal)
363
8.15k
              .getLimitedValue(std::numeric_limits<uint64_t>::max() - 1) + 1;
364
8.15k
      // Check whether a range of clusters is dense enough for a jump table
365
8.15k
      if (TLI->isSuitableForJumpTable(&SI, N, Range)) {
366
6.65k
        JumpTableSize = Range;
367
6.65k
        return 1;
368
6.65k
      }
369
1.49k
    }
370
1.49k
    return N;
371
1.49k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Line
Count
Source
317
1.53k
                                            unsigned &JumpTableSize) {
318
1.53k
    /// Try to find the estimated number of clusters. Note that the number of
319
1.53k
    /// clusters identified in this function could be different from the actural
320
1.53k
    /// numbers found in lowering. This function ignore switches that are
321
1.53k
    /// lowered with a mix of jump table / bit test / BTree. This function was
322
1.53k
    /// initially intended to be used when estimating the cost of switch in
323
1.53k
    /// inline cost heuristic, but it's a generic cost model to be used in other
324
1.53k
    /// places (e.g., in loop unrolling).
325
1.53k
    unsigned N = SI.getNumCases();
326
1.53k
    const TargetLoweringBase *TLI = getTLI();
327
1.53k
    const DataLayout &DL = this->getDataLayout();
328
1.53k
329
1.53k
    JumpTableSize = 0;
330
1.53k
    bool IsJTAllowed = TLI->areJTsAllowed(SI.getParent()->getParent());
331
1.53k
332
1.53k
    // Early exit if both a jump table and bit test are not allowed.
333
1.53k
    if (N < 1 || (!IsJTAllowed && 
DL.getIndexSizeInBits(0u) < N0
))
334
0
      return N;
335
1.53k
336
1.53k
    APInt MaxCaseVal = SI.case_begin()->getCaseValue()->getValue();
337
1.53k
    APInt MinCaseVal = MaxCaseVal;
338
6.87k
    for (auto CI : SI.cases()) {
339
6.87k
      const APInt &CaseVal = CI.getCaseValue()->getValue();
340
6.87k
      if (CaseVal.sgt(MaxCaseVal))
341
3.35k
        MaxCaseVal = CaseVal;
342
6.87k
      if (CaseVal.slt(MinCaseVal))
343
1.03k
        MinCaseVal = CaseVal;
344
6.87k
    }
345
1.53k
346
1.53k
    // Check if suitable for a bit test
347
1.53k
    if (N <= DL.getIndexSizeInBits(0u)) {
348
1.53k
      SmallPtrSet<const BasicBlock *, 4> Dests;
349
1.53k
      for (auto I : SI.cases())
350
6.87k
        Dests.insert(I.getCaseSuccessor());
351
1.53k
352
1.53k
      if (TLI->isSuitableForBitTests(Dests.size(), N, MinCaseVal, MaxCaseVal,
353
1.53k
                                     DL))
354
78
        return 1;
355
1.46k
    }
356
1.46k
357
1.46k
    // Check if suitable for a jump table.
358
1.46k
    if (IsJTAllowed) {
359
1.46k
      if (N < 2 || N < TLI->getMinimumJumpTableEntries())
360
792
        return N;
361
669
      uint64_t Range =
362
669
          (MaxCaseVal - MinCaseVal)
363
669
              .getLimitedValue(std::numeric_limits<uint64_t>::max() - 1) + 1;
364
669
      // Check whether a range of clusters is dense enough for a jump table
365
669
      if (TLI->isSuitableForJumpTable(&SI, N, Range)) {
366
546
        JumpTableSize = Range;
367
546
        return 1;
368
546
      }
369
123
    }
370
123
    return N;
371
123
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
Line
Count
Source
317
5.17k
                                            unsigned &JumpTableSize) {
318
5.17k
    /// Try to find the estimated number of clusters. Note that the number of
319
5.17k
    /// clusters identified in this function could be different from the actural
320
5.17k
    /// numbers found in lowering. This function ignore switches that are
321
5.17k
    /// lowered with a mix of jump table / bit test / BTree. This function was
322
5.17k
    /// initially intended to be used when estimating the cost of switch in
323
5.17k
    /// inline cost heuristic, but it's a generic cost model to be used in other
324
5.17k
    /// places (e.g., in loop unrolling).
325
5.17k
    unsigned N = SI.getNumCases();
326
5.17k
    const TargetLoweringBase *TLI = getTLI();
327
5.17k
    const DataLayout &DL = this->getDataLayout();
328
5.17k
329
5.17k
    JumpTableSize = 0;
330
5.17k
    bool IsJTAllowed = TLI->areJTsAllowed(SI.getParent()->getParent());
331
5.17k
332
5.17k
    // Early exit if both a jump table and bit test are not allowed.
333
5.17k
    if (N < 1 || (!IsJTAllowed && 
DL.getIndexSizeInBits(0u) < N0
))
334
0
      return N;
335
5.17k
336
5.17k
    APInt MaxCaseVal = SI.case_begin()->getCaseValue()->getValue();
337
5.17k
    APInt MinCaseVal = MaxCaseVal;
338
22.9k
    for (auto CI : SI.cases()) {
339
22.9k
      const APInt &CaseVal = CI.getCaseValue()->getValue();
340
22.9k
      if (CaseVal.sgt(MaxCaseVal))
341
12.0k
        MaxCaseVal = CaseVal;
342
22.9k
      if (CaseVal.slt(MinCaseVal))
343
3.02k
        MinCaseVal = CaseVal;
344
22.9k
    }
345
5.17k
346
5.17k
    // Check if suitable for a bit test
347
5.17k
    if (N <= DL.getIndexSizeInBits(0u)) {
348
5.17k
      SmallPtrSet<const BasicBlock *, 4> Dests;
349
5.17k
      for (auto I : SI.cases())
350
22.9k
        Dests.insert(I.getCaseSuccessor());
351
5.17k
352
5.17k
      if (TLI->isSuitableForBitTests(Dests.size(), N, MinCaseVal, MaxCaseVal,
353
5.17k
                                     DL))
354
1.11k
        return 1;
355
4.05k
    }
356
4.05k
357
4.05k
    // Check if suitable for a jump table.
358
4.05k
    if (IsJTAllowed) {
359
4.05k
      if (N < 2 || N < TLI->getMinimumJumpTableEntries())
360
2.44k
        return N;
361
1.61k
      uint64_t Range =
362
1.61k
          (MaxCaseVal - MinCaseVal)
363
1.61k
              .getLimitedValue(std::numeric_limits<uint64_t>::max() - 1) + 1;
364
1.61k
      // Check whether a range of clusters is dense enough for a jump table
365
1.61k
      if (TLI->isSuitableForJumpTable(&SI, N, Range)) {
366
1.32k
        JumpTableSize = Range;
367
1.32k
        return 1;
368
1.32k
      }
369
284
    }
370
284
    return N;
371
284
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getEstimatedNumberOfCaseClusters(llvm::SwitchInst const&, unsigned int&)
372
373
0
  unsigned getJumpBufAlignment() { return getTLI()->getJumpBufAlignment(); }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getJumpBufAlignment()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getJumpBufAlignment()
374
375
0
  unsigned getJumpBufSize() { return getTLI()->getJumpBufSize(); }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getJumpBufSize()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getJumpBufSize()
376
377
61.0k
  bool shouldBuildLookupTables() {
378
61.0k
    const TargetLoweringBase *TLI = getTLI();
379
61.0k
    return TLI->isOperationLegalOrCustom(ISD::BR_JT, MVT::Other) ||
380
61.0k
           
TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other)2.41k
;
381
61.0k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::shouldBuildLookupTables()
Line
Count
Source
377
57.5k
  bool shouldBuildLookupTables() {
378
57.5k
    const TargetLoweringBase *TLI = getTLI();
379
57.5k
    return TLI->isOperationLegalOrCustom(ISD::BR_JT, MVT::Other) ||
380
57.5k
           
TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other)0
;
381
57.5k
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::shouldBuildLookupTables()
Line
Count
Source
377
6
  bool shouldBuildLookupTables() {
378
6
    const TargetLoweringBase *TLI = getTLI();
379
6
    return TLI->isOperationLegalOrCustom(ISD::BR_JT, MVT::Other) ||
380
6
           TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other);
381
6
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::shouldBuildLookupTables()
Line
Count
Source
377
6
  bool shouldBuildLookupTables() {
378
6
    const TargetLoweringBase *TLI = getTLI();
379
6
    return TLI->isOperationLegalOrCustom(ISD::BR_JT, MVT::Other) ||
380
6
           TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other);
381
6
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::shouldBuildLookupTables()
Line
Count
Source
377
1.06k
  bool shouldBuildLookupTables() {
378
1.06k
    const TargetLoweringBase *TLI = getTLI();
379
1.06k
    return TLI->isOperationLegalOrCustom(ISD::BR_JT, MVT::Other) ||
380
1.06k
           
TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other)0
;
381
1.06k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::shouldBuildLookupTables()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::shouldBuildLookupTables()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::shouldBuildLookupTables()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::shouldBuildLookupTables()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::shouldBuildLookupTables()
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::shouldBuildLookupTables()
Line
Count
Source
377
2.40k
  bool shouldBuildLookupTables() {
378
2.40k
    const TargetLoweringBase *TLI = getTLI();
379
2.40k
    return TLI->isOperationLegalOrCustom(ISD::BR_JT, MVT::Other) ||
380
2.40k
           TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other);
381
2.40k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::shouldBuildLookupTables()
382
383
50
  bool haveFastSqrt(Type *Ty) {
384
50
    const TargetLoweringBase *TLI = getTLI();
385
50
    EVT VT = TLI->getValueType(DL, Ty);
386
50
    return TLI->isTypeLegal(VT) &&
387
50
           
TLI->isOperationLegalOrCustom(ISD::FSQRT, VT)48
;
388
50
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::haveFastSqrt(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::haveFastSqrt(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::haveFastSqrt(llvm::Type*)
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::haveFastSqrt(llvm::Type*)
Line
Count
Source
383
2
  bool haveFastSqrt(Type *Ty) {
384
2
    const TargetLoweringBase *TLI = getTLI();
385
2
    EVT VT = TLI->getValueType(DL, Ty);
386
2
    return TLI->isTypeLegal(VT) &&
387
2
           
TLI->isOperationLegalOrCustom(ISD::FSQRT, VT)0
;
388
2
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::haveFastSqrt(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::haveFastSqrt(llvm::Type*)
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::haveFastSqrt(llvm::Type*)
Line
Count
Source
383
14
  bool haveFastSqrt(Type *Ty) {
384
14
    const TargetLoweringBase *TLI = getTLI();
385
14
    EVT VT = TLI->getValueType(DL, Ty);
386
14
    return TLI->isTypeLegal(VT) &&
387
14
           TLI->isOperationLegalOrCustom(ISD::FSQRT, VT);
388
14
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::haveFastSqrt(llvm::Type*)
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::haveFastSqrt(llvm::Type*)
Line
Count
Source
383
4
  bool haveFastSqrt(Type *Ty) {
384
4
    const TargetLoweringBase *TLI = getTLI();
385
4
    EVT VT = TLI->getValueType(DL, Ty);
386
4
    return TLI->isTypeLegal(VT) &&
387
4
           TLI->isOperationLegalOrCustom(ISD::FSQRT, VT);
388
4
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::haveFastSqrt(llvm::Type*)
Line
Count
Source
383
4
  bool haveFastSqrt(Type *Ty) {
384
4
    const TargetLoweringBase *TLI = getTLI();
385
4
    EVT VT = TLI->getValueType(DL, Ty);
386
4
    return TLI->isTypeLegal(VT) &&
387
4
           TLI->isOperationLegalOrCustom(ISD::FSQRT, VT);
388
4
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::haveFastSqrt(llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::haveFastSqrt(llvm::Type*)
Line
Count
Source
383
26
  bool haveFastSqrt(Type *Ty) {
384
26
    const TargetLoweringBase *TLI = getTLI();
385
26
    EVT VT = TLI->getValueType(DL, Ty);
386
26
    return TLI->isTypeLegal(VT) &&
387
26
           TLI->isOperationLegalOrCustom(ISD::FSQRT, VT);
388
26
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::haveFastSqrt(llvm::Type*)
389
390
22
  bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) {
391
22
    return true;
392
22
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Line
Count
Source
390
14
  bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) {
391
14
    return true;
392
14
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Line
Count
Source
390
4
  bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) {
391
4
    return true;
392
4
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Line
Count
Source
390
4
  bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) {
391
4
    return true;
392
4
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::isFCmpOrdCheaperThanFCmpZero(llvm::Type*)
393
394
382k
  unsigned getFPOpCost(Type *Ty) {
395
382k
    // Check whether FADD is available, as a proxy for floating-point in
396
382k
    // general.
397
382k
    const TargetLoweringBase *TLI = getTLI();
398
382k
    EVT VT = TLI->getValueType(DL, Ty);
399
382k
    if (TLI->isOperationLegalOrCustomOrPromote(ISD::FADD, VT))
400
381k
      return TargetTransformInfo::TCC_Basic;
401
1.24k
    return TargetTransformInfo::TCC_Expensive;
402
1.24k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getFPOpCost(llvm::Type*)
Line
Count
Source
394
381k
  unsigned getFPOpCost(Type *Ty) {
395
381k
    // Check whether FADD is available, as a proxy for floating-point in
396
381k
    // general.
397
381k
    const TargetLoweringBase *TLI = getTLI();
398
381k
    EVT VT = TLI->getValueType(DL, Ty);
399
381k
    if (TLI->isOperationLegalOrCustomOrPromote(ISD::FADD, VT))
400
379k
      return TargetTransformInfo::TCC_Basic;
401
1.07k
    return TargetTransformInfo::TCC_Expensive;
402
1.07k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getFPOpCost(llvm::Type*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getFPOpCost(llvm::Type*)
Line
Count
Source
394
12
  unsigned getFPOpCost(Type *Ty) {
395
12
    // Check whether FADD is available, as a proxy for floating-point in
396
12
    // general.
397
12
    const TargetLoweringBase *TLI = getTLI();
398
12
    EVT VT = TLI->getValueType(DL, Ty);
399
12
    if (TLI->isOperationLegalOrCustomOrPromote(ISD::FADD, VT))
400
12
      return TargetTransformInfo::TCC_Basic;
401
0
    return TargetTransformInfo::TCC_Expensive;
402
0
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getFPOpCost(llvm::Type*)
Line
Count
Source
394
282
  unsigned getFPOpCost(Type *Ty) {
395
282
    // Check whether FADD is available, as a proxy for floating-point in
396
282
    // general.
397
282
    const TargetLoweringBase *TLI = getTLI();
398
282
    EVT VT = TLI->getValueType(DL, Ty);
399
282
    if (TLI->isOperationLegalOrCustomOrPromote(ISD::FADD, VT))
400
114
      return TargetTransformInfo::TCC_Basic;
401
168
    return TargetTransformInfo::TCC_Expensive;
402
168
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getFPOpCost(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getFPOpCost(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getFPOpCost(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getFPOpCost(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getFPOpCost(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getFPOpCost(llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getFPOpCost(llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getFPOpCost(llvm::Type*)
Line
Count
Source
394
1.44k
  unsigned getFPOpCost(Type *Ty) {
395
1.44k
    // Check whether FADD is available, as a proxy for floating-point in
396
1.44k
    // general.
397
1.44k
    const TargetLoweringBase *TLI = getTLI();
398
1.44k
    EVT VT = TLI->getValueType(DL, Ty);
399
1.44k
    if (TLI->isOperationLegalOrCustomOrPromote(ISD::FADD, VT))
400
1.44k
      return TargetTransformInfo::TCC_Basic;
401
0
    return TargetTransformInfo::TCC_Expensive;
402
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getFPOpCost(llvm::Type*)
403
404
25.9M
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
25.9M
    const TargetLoweringBase *TLI = getTLI();
406
25.9M
    switch (Opcode) {
407
25.9M
    
default: break25.2M
;
408
25.9M
    case Instruction::Trunc:
409
698k
      if (TLI->isTruncateFree(OpTy, Ty))
410
652k
        return TargetTransformInfo::TCC_Free;
411
45.8k
      return TargetTransformInfo::TCC_Basic;
412
45.8k
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
25.2M
    }
417
25.2M
418
25.2M
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
25.2M
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
24.0M
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
24.0M
    const TargetLoweringBase *TLI = getTLI();
406
24.0M
    switch (Opcode) {
407
24.0M
    
default: break23.3M
;
408
24.0M
    case Instruction::Trunc:
409
649k
      if (TLI->isTruncateFree(OpTy, Ty))
410
606k
        return TargetTransformInfo::TCC_Free;
411
42.6k
      return TargetTransformInfo::TCC_Basic;
412
42.6k
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
23.3M
    }
417
23.3M
418
23.3M
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
23.3M
  }
llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
314
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
314
    const TargetLoweringBase *TLI = getTLI();
406
314
    switch (Opcode) {
407
314
    default: break;
408
314
    case Instruction::Trunc:
409
0
      if (TLI->isTruncateFree(OpTy, Ty))
410
0
        return TargetTransformInfo::TCC_Free;
411
0
      return TargetTransformInfo::TCC_Basic;
412
0
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
314
    }
417
314
418
314
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
314
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
5.46k
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
5.46k
    const TargetLoweringBase *TLI = getTLI();
406
5.46k
    switch (Opcode) {
407
5.46k
    
default: break5.43k
;
408
5.46k
    case Instruction::Trunc:
409
39
      if (TLI->isTruncateFree(OpTy, Ty))
410
33
        return TargetTransformInfo::TCC_Free;
411
6
      return TargetTransformInfo::TCC_Basic;
412
6
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
5.43k
    }
417
5.43k
418
5.43k
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
5.43k
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
467k
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
467k
    const TargetLoweringBase *TLI = getTLI();
406
467k
    switch (Opcode) {
407
467k
    
default: break459k
;
408
467k
    case Instruction::Trunc:
409
8.40k
      if (TLI->isTruncateFree(OpTy, Ty))
410
5.36k
        return TargetTransformInfo::TCC_Free;
411
3.04k
      return TargetTransformInfo::TCC_Basic;
412
3.04k
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
459k
    }
417
459k
418
459k
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
459k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
197
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
197
    const TargetLoweringBase *TLI = getTLI();
406
197
    switch (Opcode) {
407
197
    
default: break185
;
408
197
    case Instruction::Trunc:
409
12
      if (TLI->isTruncateFree(OpTy, Ty))
410
1
        return TargetTransformInfo::TCC_Free;
411
11
      return TargetTransformInfo::TCC_Basic;
412
11
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
185
    }
417
185
418
185
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
185
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
102
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
102
    const TargetLoweringBase *TLI = getTLI();
406
102
    switch (Opcode) {
407
102
    default: break;
408
102
    case Instruction::Trunc:
409
0
      if (TLI->isTruncateFree(OpTy, Ty))
410
0
        return TargetTransformInfo::TCC_Free;
411
0
      return TargetTransformInfo::TCC_Basic;
412
0
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
102
    }
417
102
418
102
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
102
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
5.13k
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
5.13k
    const TargetLoweringBase *TLI = getTLI();
406
5.13k
    switch (Opcode) {
407
5.13k
    
default: break4.98k
;
408
5.13k
    case Instruction::Trunc:
409
154
      if (TLI->isTruncateFree(OpTy, Ty))
410
101
        return TargetTransformInfo::TCC_Free;
411
53
      return TargetTransformInfo::TCC_Basic;
412
53
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
4.98k
    }
417
4.98k
418
4.98k
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
4.98k
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
1.06k
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
1.06k
    const TargetLoweringBase *TLI = getTLI();
406
1.06k
    switch (Opcode) {
407
1.06k
    
default: break1.04k
;
408
1.06k
    case Instruction::Trunc:
409
18
      if (TLI->isTruncateFree(OpTy, Ty))
410
15
        return TargetTransformInfo::TCC_Free;
411
3
      return TargetTransformInfo::TCC_Basic;
412
3
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
1.04k
    }
417
1.04k
418
1.04k
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
1.04k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
Line
Count
Source
404
1.47M
  unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
405
1.47M
    const TargetLoweringBase *TLI = getTLI();
406
1.47M
    switch (Opcode) {
407
1.47M
    
default: break1.42M
;
408
1.47M
    case Instruction::Trunc:
409
41.0k
      if (TLI->isTruncateFree(OpTy, Ty))
410
40.8k
        return TargetTransformInfo::TCC_Free;
411
102
      return TargetTransformInfo::TCC_Basic;
412
102
    case Instruction::ZExt:
413
0
      if (TLI->isZExtFree(OpTy, Ty))
414
0
        return TargetTransformInfo::TCC_Free;
415
0
      return TargetTransformInfo::TCC_Basic;
416
1.42M
    }
417
1.42M
418
1.42M
    return BaseT::getOperationCost(Opcode, Ty, OpTy);
419
1.42M
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getOperationCost(unsigned int, llvm::Type*, llvm::Type*)
420
421
751k
  unsigned getInliningThresholdMultiplier() { return 1; }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getInliningThresholdMultiplier()
Line
Count
Source
421
522k
  unsigned getInliningThresholdMultiplier() { return 1; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getInliningThresholdMultiplier()
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getInliningThresholdMultiplier()
Line
Count
Source
421
50.1k
  unsigned getInliningThresholdMultiplier() { return 1; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getInliningThresholdMultiplier()
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getInliningThresholdMultiplier()
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getInliningThresholdMultiplier()
Line
Count
Source
421
7
  unsigned getInliningThresholdMultiplier() { return 1; }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getInliningThresholdMultiplier()
Line
Count
Source
421
17
  unsigned getInliningThresholdMultiplier() { return 1; }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getInliningThresholdMultiplier()
Line
Count
Source
421
4
  unsigned getInliningThresholdMultiplier() { return 1; }
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getInliningThresholdMultiplier()
Line
Count
Source
421
178k
  unsigned getInliningThresholdMultiplier() { return 1; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getInliningThresholdMultiplier()
422
423
  void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
424
387k
                               TTI::UnrollingPreferences &UP) {
425
387k
    // This unrolling functionality is target independent, but to provide some
426
387k
    // motivation for its intended use, for x86:
427
387k
428
387k
    // According to the Intel 64 and IA-32 Architectures Optimization Reference
429
387k
    // Manual, Intel Core models and later have a loop stream detector (and
430
387k
    // associated uop queue) that can benefit from partial unrolling.
431
387k
    // The relevant requirements are:
432
387k
    //  - The loop must have no more than 4 (8 for Nehalem and later) branches
433
387k
    //    taken, and none of them may be calls.
434
387k
    //  - The loop can have no more than 18 (28 for Nehalem and later) uops.
435
387k
436
387k
    // According to the Software Optimization Guide for AMD Family 15h
437
387k
    // Processors, models 30h-4fh (Steamroller and later) have a loop predictor
438
387k
    // and loop buffer which can benefit from partial unrolling.
439
387k
    // The relevant requirements are:
440
387k
    //  - The loop must have fewer than 16 branches
441
387k
    //  - The loop must have less than 40 uops in all executed loop branches
442
387k
443
387k
    // The number of taken branches in a loop is hard to estimate here, and
444
387k
    // benchmarking has revealed that it is better not to be conservative when
445
387k
    // estimating the branch count. As a result, we'll ignore the branch limits
446
387k
    // until someone finds a case where it matters in practice.
447
387k
448
387k
    unsigned MaxOps;
449
387k
    const TargetSubtargetInfo *ST = getST();
450
387k
    if (PartialUnrollingThreshold.getNumOccurrences() > 0)
451
0
      MaxOps = PartialUnrollingThreshold;
452
387k
    else if (ST->getSchedModel().LoopMicroOpBufferSize > 0)
453
21.4k
      MaxOps = ST->getSchedModel().LoopMicroOpBufferSize;
454
365k
    else
455
365k
      return;
456
21.4k
457
21.4k
    // Scan the loop: don't unroll loops with calls.
458
64.6k
    
for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); 21.4k
I != E;
459
52.9k
         
++I43.2k
) {
460
52.9k
      BasicBlock *BB = *I;
461
52.9k
462
354k
      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; 
++J301k
)
463
311k
        if (isa<CallInst>(J) || 
isa<InvokeInst>(J)296k
) {
464
14.6k
          ImmutableCallSite CS(&*J);
465
14.6k
          if (const Function *F = CS.getCalledFunction()) {
466
13.3k
            if (!static_cast<T *>(this)->isLoweredToCall(F))
467
5.00k
              continue;
468
9.67k
          }
469
9.67k
470
9.67k
          return;
471
9.67k
        }
472
52.9k
    }
473
21.4k
474
21.4k
    // Enable runtime and partial unrolling up to the specified size.
475
21.4k
    // Enable using trip count upper bound to unroll loops.
476
21.4k
    UP.Partial = UP.Runtime = UP.UpperBound = true;
477
11.7k
    UP.PartialThreshold = MaxOps;
478
11.7k
479
11.7k
    // Avoid unrolling when optimizing for size.
480
11.7k
    UP.OptSizeThreshold = 0;
481
11.7k
    UP.PartialOptSizeThreshold = 0;
482
11.7k
483
11.7k
    // Set number of instructions optimized when "back edge"
484
11.7k
    // becomes "fall through" to default value of 2.
485
11.7k
    UP.BEInsns = 2;
486
11.7k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
Line
Count
Source
424
358k
                               TTI::UnrollingPreferences &UP) {
425
358k
    // This unrolling functionality is target independent, but to provide some
426
358k
    // motivation for its intended use, for x86:
427
358k
428
358k
    // According to the Intel 64 and IA-32 Architectures Optimization Reference
429
358k
    // Manual, Intel Core models and later have a loop stream detector (and
430
358k
    // associated uop queue) that can benefit from partial unrolling.
431
358k
    // The relevant requirements are:
432
358k
    //  - The loop must have no more than 4 (8 for Nehalem and later) branches
433
358k
    //    taken, and none of them may be calls.
434
358k
    //  - The loop can have no more than 18 (28 for Nehalem and later) uops.
435
358k
436
358k
    // According to the Software Optimization Guide for AMD Family 15h
437
358k
    // Processors, models 30h-4fh (Steamroller and later) have a loop predictor
438
358k
    // and loop buffer which can benefit from partial unrolling.
439
358k
    // The relevant requirements are:
440
358k
    //  - The loop must have fewer than 16 branches
441
358k
    //  - The loop must have less than 40 uops in all executed loop branches
442
358k
443
358k
    // The number of taken branches in a loop is hard to estimate here, and
444
358k
    // benchmarking has revealed that it is better not to be conservative when
445
358k
    // estimating the branch count. As a result, we'll ignore the branch limits
446
358k
    // until someone finds a case where it matters in practice.
447
358k
448
358k
    unsigned MaxOps;
449
358k
    const TargetSubtargetInfo *ST = getST();
450
358k
    if (PartialUnrollingThreshold.getNumOccurrences() > 0)
451
0
      MaxOps = PartialUnrollingThreshold;
452
358k
    else if (ST->getSchedModel().LoopMicroOpBufferSize > 0)
453
16
      MaxOps = ST->getSchedModel().LoopMicroOpBufferSize;
454
358k
    else
455
358k
      return;
456
16
457
16
    // Scan the loop: don't unroll loops with calls.
458
44
    
for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); 16
I != E;
459
28
         ++I) {
460
28
      BasicBlock *BB = *I;
461
28
462
219
      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; 
++J191
)
463
191
        if (isa<CallInst>(J) || 
isa<InvokeInst>(J)185
) {
464
6
          ImmutableCallSite CS(&*J);
465
6
          if (const Function *F = CS.getCalledFunction()) {
466
6
            if (!static_cast<T *>(this)->isLoweredToCall(F))
467
6
              continue;
468
0
          }
469
0
470
0
          return;
471
0
        }
472
28
    }
473
16
474
16
    // Enable runtime and partial unrolling up to the specified size.
475
16
    // Enable using trip count upper bound to unroll loops.
476
16
    UP.Partial = UP.Runtime = UP.UpperBound = true;
477
16
    UP.PartialThreshold = MaxOps;
478
16
479
16
    // Avoid unrolling when optimizing for size.
480
16
    UP.OptSizeThreshold = 0;
481
16
    UP.PartialOptSizeThreshold = 0;
482
16
483
16
    // Set number of instructions optimized when "back edge"
484
16
    // becomes "fall through" to default value of 2.
485
16
    UP.BEInsns = 2;
486
16
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
Line
Count
Source
424
6.81k
                               TTI::UnrollingPreferences &UP) {
425
6.81k
    // This unrolling functionality is target independent, but to provide some
426
6.81k
    // motivation for its intended use, for x86:
427
6.81k
428
6.81k
    // According to the Intel 64 and IA-32 Architectures Optimization Reference
429
6.81k
    // Manual, Intel Core models and later have a loop stream detector (and
430
6.81k
    // associated uop queue) that can benefit from partial unrolling.
431
6.81k
    // The relevant requirements are:
432
6.81k
    //  - The loop must have no more than 4 (8 for Nehalem and later) branches
433
6.81k
    //    taken, and none of them may be calls.
434
6.81k
    //  - The loop can have no more than 18 (28 for Nehalem and later) uops.
435
6.81k
436
6.81k
    // According to the Software Optimization Guide for AMD Family 15h
437
6.81k
    // Processors, models 30h-4fh (Steamroller and later) have a loop predictor
438
6.81k
    // and loop buffer which can benefit from partial unrolling.
439
6.81k
    // The relevant requirements are:
440
6.81k
    //  - The loop must have fewer than 16 branches
441
6.81k
    //  - The loop must have less than 40 uops in all executed loop branches
442
6.81k
443
6.81k
    // The number of taken branches in a loop is hard to estimate here, and
444
6.81k
    // benchmarking has revealed that it is better not to be conservative when
445
6.81k
    // estimating the branch count. As a result, we'll ignore the branch limits
446
6.81k
    // until someone finds a case where it matters in practice.
447
6.81k
448
6.81k
    unsigned MaxOps;
449
6.81k
    const TargetSubtargetInfo *ST = getST();
450
6.81k
    if (PartialUnrollingThreshold.getNumOccurrences() > 0)
451
0
      MaxOps = PartialUnrollingThreshold;
452
6.81k
    else if (ST->getSchedModel().LoopMicroOpBufferSize > 0)
453
21
      MaxOps = ST->getSchedModel().LoopMicroOpBufferSize;
454
6.79k
    else
455
6.79k
      return;
456
21
457
21
    // Scan the loop: don't unroll loops with calls.
458
45
    
for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); 21
I != E;
459
27
         
++I24
) {
460
27
      BasicBlock *BB = *I;
461
27
462
261
      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; 
++J234
)
463
237
        if (isa<CallInst>(J) || 
isa<InvokeInst>(J)228
) {
464
9
          ImmutableCallSite CS(&*J);
465
9
          if (const Function *F = CS.getCalledFunction()) {
466
9
            if (!static_cast<T *>(this)->isLoweredToCall(F))
467
6
              continue;
468
3
          }
469
3
470
3
          return;
471
3
        }
472
27
    }
473
21
474
21
    // Enable runtime and partial unrolling up to the specified size.
475
21
    // Enable using trip count upper bound to unroll loops.
476
21
    UP.Partial = UP.Runtime = UP.UpperBound = true;
477
18
    UP.PartialThreshold = MaxOps;
478
18
479
18
    // Avoid unrolling when optimizing for size.
480
18
    UP.OptSizeThreshold = 0;
481
18
    UP.PartialOptSizeThreshold = 0;
482
18
483
18
    // Set number of instructions optimized when "back edge"
484
18
    // becomes "fall through" to default value of 2.
485
18
    UP.BEInsns = 2;
486
18
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
Line
Count
Source
424
2
                               TTI::UnrollingPreferences &UP) {
425
2
    // This unrolling functionality is target independent, but to provide some
426
2
    // motivation for its intended use, for x86:
427
2
428
2
    // According to the Intel 64 and IA-32 Architectures Optimization Reference
429
2
    // Manual, Intel Core models and later have a loop stream detector (and
430
2
    // associated uop queue) that can benefit from partial unrolling.
431
2
    // The relevant requirements are:
432
2
    //  - The loop must have no more than 4 (8 for Nehalem and later) branches
433
2
    //    taken, and none of them may be calls.
434
2
    //  - The loop can have no more than 18 (28 for Nehalem and later) uops.
435
2
436
2
    // According to the Software Optimization Guide for AMD Family 15h
437
2
    // Processors, models 30h-4fh (Steamroller and later) have a loop predictor
438
2
    // and loop buffer which can benefit from partial unrolling.
439
2
    // The relevant requirements are:
440
2
    //  - The loop must have fewer than 16 branches
441
2
    //  - The loop must have less than 40 uops in all executed loop branches
442
2
443
2
    // The number of taken branches in a loop is hard to estimate here, and
444
2
    // benchmarking has revealed that it is better not to be conservative when
445
2
    // estimating the branch count. As a result, we'll ignore the branch limits
446
2
    // until someone finds a case where it matters in practice.
447
2
448
2
    unsigned MaxOps;
449
2
    const TargetSubtargetInfo *ST = getST();
450
2
    if (PartialUnrollingThreshold.getNumOccurrences() > 0)
451
0
      MaxOps = PartialUnrollingThreshold;
452
2
    else if (ST->getSchedModel().LoopMicroOpBufferSize > 0)
453
0
      MaxOps = ST->getSchedModel().LoopMicroOpBufferSize;
454
2
    else
455
2
      return;
456
0
457
0
    // Scan the loop: don't unroll loops with calls.
458
0
    for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); I != E;
459
0
         ++I) {
460
0
      BasicBlock *BB = *I;
461
0
462
0
      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; ++J)
463
0
        if (isa<CallInst>(J) || isa<InvokeInst>(J)) {
464
0
          ImmutableCallSite CS(&*J);
465
0
          if (const Function *F = CS.getCalledFunction()) {
466
0
            if (!static_cast<T *>(this)->isLoweredToCall(F))
467
0
              continue;
468
0
          }
469
0
470
0
          return;
471
0
        }
472
0
    }
473
0
474
0
    // Enable runtime and partial unrolling up to the specified size.
475
0
    // Enable using trip count upper bound to unroll loops.
476
0
    UP.Partial = UP.Runtime = UP.UpperBound = true;
477
0
    UP.PartialThreshold = MaxOps;
478
0
479
0
    // Avoid unrolling when optimizing for size.
480
0
    UP.OptSizeThreshold = 0;
481
0
    UP.PartialOptSizeThreshold = 0;
482
0
483
0
    // Set number of instructions optimized when "back edge"
484
0
    // becomes "fall through" to default value of 2.
485
0
    UP.BEInsns = 2;
486
0
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
Line
Count
Source
424
11
                               TTI::UnrollingPreferences &UP) {
425
11
    // This unrolling functionality is target independent, but to provide some
426
11
    // motivation for its intended use, for x86:
427
11
428
11
    // According to the Intel 64 and IA-32 Architectures Optimization Reference
429
11
    // Manual, Intel Core models and later have a loop stream detector (and
430
11
    // associated uop queue) that can benefit from partial unrolling.
431
11
    // The relevant requirements are:
432
11
    //  - The loop must have no more than 4 (8 for Nehalem and later) branches
433
11
    //    taken, and none of them may be calls.
434
11
    //  - The loop can have no more than 18 (28 for Nehalem and later) uops.
435
11
436
11
    // According to the Software Optimization Guide for AMD Family 15h
437
11
    // Processors, models 30h-4fh (Steamroller and later) have a loop predictor
438
11
    // and loop buffer which can benefit from partial unrolling.
439
11
    // The relevant requirements are:
440
11
    //  - The loop must have fewer than 16 branches
441
11
    //  - The loop must have less than 40 uops in all executed loop branches
442
11
443
11
    // The number of taken branches in a loop is hard to estimate here, and
444
11
    // benchmarking has revealed that it is better not to be conservative when
445
11
    // estimating the branch count. As a result, we'll ignore the branch limits
446
11
    // until someone finds a case where it matters in practice.
447
11
448
11
    unsigned MaxOps;
449
11
    const TargetSubtargetInfo *ST = getST();
450
11
    if (PartialUnrollingThreshold.getNumOccurrences() > 0)
451
0
      MaxOps = PartialUnrollingThreshold;
452
11
    else if (ST->getSchedModel().LoopMicroOpBufferSize > 0)
453
5
      MaxOps = ST->getSchedModel().LoopMicroOpBufferSize;
454
6
    else
455
6
      return;
456
5
457
5
    // Scan the loop: don't unroll loops with calls.
458
10
    
for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); 5
I != E;
459
5
         ++I) {
460
5
      BasicBlock *BB = *I;
461
5
462
57
      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; 
++J52
)
463
52
        if (isa<CallInst>(J) || isa<InvokeInst>(J)) {
464
0
          ImmutableCallSite CS(&*J);
465
0
          if (const Function *F = CS.getCalledFunction()) {
466
0
            if (!static_cast<T *>(this)->isLoweredToCall(F))
467
0
              continue;
468
0
          }
469
0
470
0
          return;
471
0
        }
472
5
    }
473
5
474
5
    // Enable runtime and partial unrolling up to the specified size.
475
5
    // Enable using trip count upper bound to unroll loops.
476
5
    UP.Partial = UP.Runtime = UP.UpperBound = true;
477
5
    UP.PartialThreshold = MaxOps;
478
5
479
5
    // Avoid unrolling when optimizing for size.
480
5
    UP.OptSizeThreshold = 0;
481
5
    UP.PartialOptSizeThreshold = 0;
482
5
483
5
    // Set number of instructions optimized when "back edge"
484
5
    // becomes "fall through" to default value of 2.
485
5
    UP.BEInsns = 2;
486
5
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
Line
Count
Source
424
21.5k
                               TTI::UnrollingPreferences &UP) {
425
21.5k
    // This unrolling functionality is target independent, but to provide some
426
21.5k
    // motivation for its intended use, for x86:
427
21.5k
428
21.5k
    // According to the Intel 64 and IA-32 Architectures Optimization Reference
429
21.5k
    // Manual, Intel Core models and later have a loop stream detector (and
430
21.5k
    // associated uop queue) that can benefit from partial unrolling.
431
21.5k
    // The relevant requirements are:
432
21.5k
    //  - The loop must have no more than 4 (8 for Nehalem and later) branches
433
21.5k
    //    taken, and none of them may be calls.
434
21.5k
    //  - The loop can have no more than 18 (28 for Nehalem and later) uops.
435
21.5k
436
21.5k
    // According to the Software Optimization Guide for AMD Family 15h
437
21.5k
    // Processors, models 30h-4fh (Steamroller and later) have a loop predictor
438
21.5k
    // and loop buffer which can benefit from partial unrolling.
439
21.5k
    // The relevant requirements are:
440
21.5k
    //  - The loop must have fewer than 16 branches
441
21.5k
    //  - The loop must have less than 40 uops in all executed loop branches
442
21.5k
443
21.5k
    // The number of taken branches in a loop is hard to estimate here, and
444
21.5k
    // benchmarking has revealed that it is better not to be conservative when
445
21.5k
    // estimating the branch count. As a result, we'll ignore the branch limits
446
21.5k
    // until someone finds a case where it matters in practice.
447
21.5k
448
21.5k
    unsigned MaxOps;
449
21.5k
    const TargetSubtargetInfo *ST = getST();
450
21.5k
    if (PartialUnrollingThreshold.getNumOccurrences() > 0)
451
0
      MaxOps = PartialUnrollingThreshold;
452
21.5k
    else if (ST->getSchedModel().LoopMicroOpBufferSize > 0)
453
21.3k
      MaxOps = ST->getSchedModel().LoopMicroOpBufferSize;
454
155
    else
455
155
      return;
456
21.3k
457
21.3k
    // Scan the loop: don't unroll loops with calls.
458
64.5k
    
for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); 21.3k
I != E;
459
52.8k
         
++I43.1k
) {
460
52.8k
      BasicBlock *BB = *I;
461
52.8k
462
354k
      for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; 
++J301k
)
463
310k
        if (isa<CallInst>(J) || 
isa<InvokeInst>(J)296k
) {
464
14.6k
          ImmutableCallSite CS(&*J);
465
14.6k
          if (const Function *F = CS.getCalledFunction()) {
466
13.3k
            if (!static_cast<T *>(this)->isLoweredToCall(F))
467
4.99k
              continue;
468
9.67k
          }
469
9.67k
470
9.67k
          return;
471
9.67k
        }
472
52.8k
    }
473
21.3k
474
21.3k
    // Enable runtime and partial unrolling up to the specified size.
475
21.3k
    // Enable using trip count upper bound to unroll loops.
476
21.3k
    UP.Partial = UP.Runtime = UP.UpperBound = true;
477
11.7k
    UP.PartialThreshold = MaxOps;
478
11.7k
479
11.7k
    // Avoid unrolling when optimizing for size.
480
11.7k
    UP.OptSizeThreshold = 0;
481
11.7k
    UP.PartialOptSizeThreshold = 0;
482
11.7k
483
11.7k
    // Set number of instructions optimized when "back edge"
484
11.7k
    // becomes "fall through" to default value of 2.
485
11.7k
    UP.BEInsns = 2;
486
11.7k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getUnrollingPreferences(llvm::Loop*, llvm::ScalarEvolution&, llvm::TargetTransformInfo::UnrollingPreferences&)
487
488
119
  int getInstructionLatency(const Instruction *I) {
489
119
    if (isa<LoadInst>(I))
490
41
      return getST()->getSchedModel().DefaultLoadLatency;
491
78
492
78
    return BaseT::getInstructionLatency(I);
493
78
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getInstructionLatency(llvm::Instruction const*)
Line
Count
Source
488
108
  int getInstructionLatency(const Instruction *I) {
489
108
    if (isa<LoadInst>(I))
490
40
      return getST()->getSchedModel().DefaultLoadLatency;
491
68
492
68
    return BaseT::getInstructionLatency(I);
493
68
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getInstructionLatency(llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getInstructionLatency(llvm::Instruction const*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getInstructionLatency(llvm::Instruction const*)
Line
Count
Source
488
11
  int getInstructionLatency(const Instruction *I) {
489
11
    if (isa<LoadInst>(I))
490
1
      return getST()->getSchedModel().DefaultLoadLatency;
491
10
492
10
    return BaseT::getInstructionLatency(I);
493
10
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getInstructionLatency(llvm::Instruction const*)
494
495
  /// @}
496
497
  /// \name Vector TTI Implementations
498
  /// @{
499
500
813
  unsigned getNumberOfRegisters(bool Vector) { return Vector ? 
0262
:
1551
; }
llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getNumberOfRegisters(bool)
Line
Count
Source
500
56
  unsigned getNumberOfRegisters(bool Vector) { return Vector ? 
00
: 1; }
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getNumberOfRegisters(bool)
Line
Count
Source
500
327
  unsigned getNumberOfRegisters(bool Vector) { return Vector ? 
052
:
1275
; }
llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getNumberOfRegisters(bool)
Line
Count
Source
500
430
  unsigned getNumberOfRegisters(bool Vector) { return Vector ? 
0210
:
1220
; }
501
502
0
  unsigned getRegisterBitWidth(bool Vector) const { return 32; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getRegisterBitWidth(bool) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getRegisterBitWidth(bool) const
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getRegisterBitWidth(bool) const
503
504
  /// Estimate the overhead of scalarizing an instruction. Insert and Extract
505
  /// are set if the result needs to be inserted and/or extracted from vectors.
506
82.6k
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
82.6k
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
82.6k
    unsigned Cost = 0;
509
82.6k
510
358k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i275k
) {
511
275k
      if (Insert)
512
150k
        Cost += static_cast<T *>(this)
513
150k
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
275k
      if (Extract)
515
128k
        Cost += static_cast<T *>(this)
516
128k
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
275k
    }
518
82.6k
519
82.6k
    return Cost;
520
82.6k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
67.6k
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
67.6k
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
67.6k
    unsigned Cost = 0;
509
67.6k
510
247k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i180k
) {
511
180k
      if (Insert)
512
102k
        Cost += static_cast<T *>(this)
513
102k
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
180k
      if (Extract)
515
77.7k
        Cost += static_cast<T *>(this)
516
77.7k
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
180k
    }
518
67.6k
519
67.6k
    return Cost;
520
67.6k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
233
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
233
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
233
    unsigned Cost = 0;
509
233
510
968
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i735
) {
511
735
      if (Insert)
512
534
        Cost += static_cast<T *>(this)
513
534
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
735
      if (Extract)
515
205
        Cost += static_cast<T *>(this)
516
205
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
735
    }
518
233
519
233
    return Cost;
520
233
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
2.83k
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
2.83k
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
2.83k
    unsigned Cost = 0;
509
2.83k
510
9.81k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i6.97k
) {
511
6.97k
      if (Insert)
512
2.60k
        Cost += static_cast<T *>(this)
513
2.60k
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
6.97k
      if (Extract)
515
4.60k
        Cost += static_cast<T *>(this)
516
4.60k
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
6.97k
    }
518
2.83k
519
2.83k
    return Cost;
520
2.83k
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
23
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
23
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
23
    unsigned Cost = 0;
509
23
510
311
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i288
) {
511
288
      if (Insert)
512
124
        Cost += static_cast<T *>(this)
513
124
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
288
      if (Extract)
515
164
        Cost += static_cast<T *>(this)
516
164
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
288
    }
518
23
519
23
    return Cost;
520
23
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
4
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
4
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
4
    unsigned Cost = 0;
509
4
510
12
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i8
) {
511
8
      if (Insert)
512
4
        Cost += static_cast<T *>(this)
513
4
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
8
      if (Extract)
515
4
        Cost += static_cast<T *>(this)
516
4
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
8
    }
518
4
519
4
    return Cost;
520
4
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
27
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
27
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
27
    unsigned Cost = 0;
509
27
510
112
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i85
) {
511
85
      if (Insert)
512
75
        Cost += static_cast<T *>(this)
513
75
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
85
      if (Extract)
515
10
        Cost += static_cast<T *>(this)
516
10
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
85
    }
518
27
519
27
    return Cost;
520
27
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
458
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
458
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
458
    unsigned Cost = 0;
509
458
510
3.29k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i2.83k
) {
511
2.83k
      if (Insert)
512
1.35k
        Cost += static_cast<T *>(this)
513
1.35k
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
2.83k
      if (Extract)
515
1.25k
        Cost += static_cast<T *>(this)
516
1.25k
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
2.83k
    }
518
458
519
458
    return Cost;
520
458
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
Line
Count
Source
506
11.4k
  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) {
507
11.4k
    assert(Ty->isVectorTy() && "Can only scalarize vectors");
508
11.4k
    unsigned Cost = 0;
509
11.4k
510
95.8k
    for (int i = 0, e = Ty->getVectorNumElements(); i < e; 
++i84.4k
) {
511
84.4k
      if (Insert)
512
43.2k
        Cost += static_cast<T *>(this)
513
43.2k
                    ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
514
84.4k
      if (Extract)
515
44.8k
        Cost += static_cast<T *>(this)
516
44.8k
                    ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
517
84.4k
    }
518
11.4k
519
11.4k
    return Cost;
520
11.4k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getScalarizationOverhead(llvm::Type*, bool, bool)
521
522
  /// Estimate the overhead of scalarizing an instructions unique
523
  /// non-constant operands. The types of the arguments are ordinarily
524
  /// scalar, in which case the costs are multiplied with VF.
525
  unsigned getOperandsScalarizationOverhead(ArrayRef<const Value *> Args,
526
22.6k
                                            unsigned VF) {
527
22.6k
    unsigned Cost = 0;
528
22.6k
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
32.0k
    for (const Value *A : Args) {
530
32.0k
      if (!isa<Constant>(A) && 
UniqueOperands.insert(A).second26.8k
) {
531
26.8k
        Type *VecTy = nullptr;
532
26.8k
        if (A->getType()->isVectorTy()) {
533
822
          VecTy = A->getType();
534
822
          // If A is a vector operand, VF should be 1 or correspond to A.
535
822
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
822
                 "Vector argument does not match VF");
537
822
        }
538
26.0k
        else
539
26.0k
          VecTy = VectorType::get(A->getType(), VF);
540
26.8k
541
26.8k
        Cost += getScalarizationOverhead(VecTy, false, true);
542
26.8k
      }
543
32.0k
    }
544
22.6k
545
22.6k
    return Cost;
546
22.6k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
17.0k
                                            unsigned VF) {
527
17.0k
    unsigned Cost = 0;
528
17.0k
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
22.3k
    for (const Value *A : Args) {
530
22.3k
      if (!isa<Constant>(A) && 
UniqueOperands.insert(A).second21.0k
) {
531
21.0k
        Type *VecTy = nullptr;
532
21.0k
        if (A->getType()->isVectorTy()) {
533
5
          VecTy = A->getType();
534
5
          // If A is a vector operand, VF should be 1 or correspond to A.
535
5
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
5
                 "Vector argument does not match VF");
537
5
        }
538
21.0k
        else
539
21.0k
          VecTy = VectorType::get(A->getType(), VF);
540
21.0k
541
21.0k
        Cost += getScalarizationOverhead(VecTy, false, true);
542
21.0k
      }
543
22.3k
    }
544
17.0k
545
17.0k
    return Cost;
546
17.0k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
18
                                            unsigned VF) {
527
18
    unsigned Cost = 0;
528
18
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
30
    for (const Value *A : Args) {
530
30
      if (!isa<Constant>(A) && UniqueOperands.insert(A).second) {
531
30
        Type *VecTy = nullptr;
532
30
        if (A->getType()->isVectorTy()) {
533
6
          VecTy = A->getType();
534
6
          // If A is a vector operand, VF should be 1 or correspond to A.
535
6
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
6
                 "Vector argument does not match VF");
537
6
        }
538
24
        else
539
24
          VecTy = VectorType::get(A->getType(), VF);
540
30
541
30
        Cost += getScalarizationOverhead(VecTy, false, true);
542
30
      }
543
30
    }
544
18
545
18
    return Cost;
546
18
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
613
                                            unsigned VF) {
527
613
    unsigned Cost = 0;
528
613
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
1.09k
    for (const Value *A : Args) {
530
1.09k
      if (!isa<Constant>(A) && 
UniqueOperands.insert(A).second844
) {
531
844
        Type *VecTy = nullptr;
532
844
        if (A->getType()->isVectorTy()) {
533
0
          VecTy = A->getType();
534
0
          // If A is a vector operand, VF should be 1 or correspond to A.
535
0
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
0
                 "Vector argument does not match VF");
537
0
        }
538
844
        else
539
844
          VecTy = VectorType::get(A->getType(), VF);
540
844
541
844
        Cost += getScalarizationOverhead(VecTy, false, true);
542
844
      }
543
1.09k
    }
544
613
545
613
    return Cost;
546
613
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
5
                                            unsigned VF) {
527
5
    unsigned Cost = 0;
528
5
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
10
    for (const Value *A : Args) {
530
10
      if (!isa<Constant>(A) && UniqueOperands.insert(A).second) {
531
10
        Type *VecTy = nullptr;
532
10
        if (A->getType()->isVectorTy()) {
533
0
          VecTy = A->getType();
534
0
          // If A is a vector operand, VF should be 1 or correspond to A.
535
0
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
0
                 "Vector argument does not match VF");
537
0
        }
538
10
        else
539
10
          VecTy = VectorType::get(A->getType(), VF);
540
10
541
10
        Cost += getScalarizationOverhead(VecTy, false, true);
542
10
      }
543
10
    }
544
5
545
5
    return Cost;
546
5
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
3
                                            unsigned VF) {
527
3
    unsigned Cost = 0;
528
3
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
3
    for (const Value *A : Args) {
530
3
      if (!isa<Constant>(A) && UniqueOperands.insert(A).second) {
531
3
        Type *VecTy = nullptr;
532
3
        if (A->getType()->isVectorTy()) {
533
1
          VecTy = A->getType();
534
1
          // If A is a vector operand, VF should be 1 or correspond to A.
535
1
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
1
                 "Vector argument does not match VF");
537
1
        }
538
2
        else
539
2
          VecTy = VectorType::get(A->getType(), VF);
540
3
541
3
        Cost += getScalarizationOverhead(VecTy, false, true);
542
3
      }
543
3
    }
544
3
545
3
    return Cost;
546
3
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
72
                                            unsigned VF) {
527
72
    unsigned Cost = 0;
528
72
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
144
    for (const Value *A : Args) {
530
144
      if (!isa<Constant>(A) && 
UniqueOperands.insert(A).second60
) {
531
60
        Type *VecTy = nullptr;
532
60
        if (A->getType()->isVectorTy()) {
533
60
          VecTy = A->getType();
534
60
          // If A is a vector operand, VF should be 1 or correspond to A.
535
60
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
60
                 "Vector argument does not match VF");
537
60
        }
538
0
        else
539
0
          VecTy = VectorType::get(A->getType(), VF);
540
60
541
60
        Cost += getScalarizationOverhead(VecTy, false, true);
542
60
      }
543
144
    }
544
72
545
72
    return Cost;
546
72
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
Line
Count
Source
526
4.90k
                                            unsigned VF) {
527
4.90k
    unsigned Cost = 0;
528
4.90k
    SmallPtrSet<const Value*, 4> UniqueOperands;
529
8.37k
    for (const Value *A : Args) {
530
8.37k
      if (!isa<Constant>(A) && 
UniqueOperands.insert(A).second4.84k
) {
531
4.84k
        Type *VecTy = nullptr;
532
4.84k
        if (A->getType()->isVectorTy()) {
533
750
          VecTy = A->getType();
534
750
          // If A is a vector operand, VF should be 1 or correspond to A.
535
750
          assert((VF == 1 || VF == VecTy->getVectorNumElements()) &&
536
750
                 "Vector argument does not match VF");
537
750
        }
538
4.09k
        else
539
4.09k
          VecTy = VectorType::get(A->getType(), VF);
540
4.84k
541
4.84k
        Cost += getScalarizationOverhead(VecTy, false, true);
542
4.84k
      }
543
8.37k
    }
544
4.90k
545
4.90k
    return Cost;
546
4.90k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getOperandsScalarizationOverhead(llvm::ArrayRef<llvm::Value const*>, unsigned int)
547
548
5.66k
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
5.66k
    assert(VecTy->isVectorTy());
550
5.66k
551
5.66k
    unsigned Cost = 0;
552
5.66k
553
5.66k
    Cost += getScalarizationOverhead(VecTy, true, false);
554
5.66k
    if (!Args.empty())
555
64
      Cost += getOperandsScalarizationOverhead(Args,
556
64
                                               VecTy->getVectorNumElements());
557
5.60k
    else
558
5.60k
      // When no information on arguments is provided, we add the cost
559
5.60k
      // associated with one argument as a heuristic.
560
5.60k
      Cost += getScalarizationOverhead(VecTy, false, true);
561
5.66k
562
5.66k
    return Cost;
563
5.66k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
548
4.81k
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
4.81k
    assert(VecTy->isVectorTy());
550
4.81k
551
4.81k
    unsigned Cost = 0;
552
4.81k
553
4.81k
    Cost += getScalarizationOverhead(VecTy, true, false);
554
4.81k
    if (!Args.empty())
555
0
      Cost += getOperandsScalarizationOverhead(Args,
556
0
                                               VecTy->getVectorNumElements());
557
4.81k
    else
558
4.81k
      // When no information on arguments is provided, we add the cost
559
4.81k
      // associated with one argument as a heuristic.
560
4.81k
      Cost += getScalarizationOverhead(VecTy, false, true);
561
4.81k
562
4.81k
    return Cost;
563
4.81k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
548
30
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
30
    assert(VecTy->isVectorTy());
550
30
551
30
    unsigned Cost = 0;
552
30
553
30
    Cost += getScalarizationOverhead(VecTy, true, false);
554
30
    if (!Args.empty())
555
0
      Cost += getOperandsScalarizationOverhead(Args,
556
0
                                               VecTy->getVectorNumElements());
557
30
    else
558
30
      // When no information on arguments is provided, we add the cost
559
30
      // associated with one argument as a heuristic.
560
30
      Cost += getScalarizationOverhead(VecTy, false, true);
561
30
562
30
    return Cost;
563
30
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
548
694
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
694
    assert(VecTy->isVectorTy());
550
694
551
694
    unsigned Cost = 0;
552
694
553
694
    Cost += getScalarizationOverhead(VecTy, true, false);
554
694
    if (!Args.empty())
555
0
      Cost += getOperandsScalarizationOverhead(Args,
556
0
                                               VecTy->getVectorNumElements());
557
694
    else
558
694
      // When no information on arguments is provided, we add the cost
559
694
      // associated with one argument as a heuristic.
560
694
      Cost += getScalarizationOverhead(VecTy, false, true);
561
694
562
694
    return Cost;
563
694
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
548
2
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
2
    assert(VecTy->isVectorTy());
550
2
551
2
    unsigned Cost = 0;
552
2
553
2
    Cost += getScalarizationOverhead(VecTy, true, false);
554
2
    if (!Args.empty())
555
0
      Cost += getOperandsScalarizationOverhead(Args,
556
0
                                               VecTy->getVectorNumElements());
557
2
    else
558
2
      // When no information on arguments is provided, we add the cost
559
2
      // associated with one argument as a heuristic.
560
2
      Cost += getScalarizationOverhead(VecTy, false, true);
561
2
562
2
    return Cost;
563
2
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
548
64
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
64
    assert(VecTy->isVectorTy());
550
64
551
64
    unsigned Cost = 0;
552
64
553
64
    Cost += getScalarizationOverhead(VecTy, true, false);
554
64
    if (!Args.empty())
555
64
      Cost += getOperandsScalarizationOverhead(Args,
556
64
                                               VecTy->getVectorNumElements());
557
0
    else
558
0
      // When no information on arguments is provided, we add the cost
559
0
      // associated with one argument as a heuristic.
560
0
      Cost += getScalarizationOverhead(VecTy, false, true);
561
64
562
64
    return Cost;
563
64
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
548
60
  unsigned getScalarizationOverhead(Type *VecTy, ArrayRef<const Value *> Args) {
549
60
    assert(VecTy->isVectorTy());
550
60
551
60
    unsigned Cost = 0;
552
60
553
60
    Cost += getScalarizationOverhead(VecTy, true, false);
554
60
    if (!Args.empty())
555
0
      Cost += getOperandsScalarizationOverhead(Args,
556
0
                                               VecTy->getVectorNumElements());
557
60
    else
558
60
      // When no information on arguments is provided, we add the cost
559
60
      // associated with one argument as a heuristic.
560
60
      Cost += getScalarizationOverhead(VecTy, false, true);
561
60
562
60
    return Cost;
563
60
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getScalarizationOverhead(llvm::Type*, llvm::ArrayRef<llvm::Value const*>)
564
565
66
  unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getMaxInterleaveFactor(unsigned int)
llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getMaxInterleaveFactor(unsigned int)
Line
Count
Source
565
42
  unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getMaxInterleaveFactor(unsigned int)
Line
Count
Source
565
1
  unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getMaxInterleaveFactor(unsigned int)
Line
Count
Source
565
22
  unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getMaxInterleaveFactor(unsigned int)
llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getMaxInterleaveFactor(unsigned int)
Line
Count
Source
565
1
  unsigned getMaxInterleaveFactor(unsigned VF) { return 1; }
566
567
  unsigned getArithmeticInstrCost(
568
      unsigned Opcode, Type *Ty,
569
      TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
570
      TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
571
      TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
572
      TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
573
511k
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
511k
    // Check if any of the operands are vector operands.
575
511k
    const TargetLoweringBase *TLI = getTLI();
576
511k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
511k
    assert(ISD && "Invalid opcode");
578
511k
579
511k
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
511k
581
511k
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
511k
    // Assume that floating point arithmetic operations cost twice as much as
583
511k
    // integer operations.
584
511k
    unsigned OpCost = (IsFloat ? 
2267k
:
1244k
);
585
511k
586
511k
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
455k
      // The operation is legal. Assume it costs 1.
588
455k
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
455k
      return LT.first * OpCost;
590
455k
    }
591
56.3k
592
56.3k
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
47.6k
      // If the operation is custom lowered, then assume that the code is twice
594
47.6k
      // as expensive.
595
47.6k
      return LT.first * 2 * OpCost;
596
47.6k
    }
597
8.74k
598
8.74k
    // Else, assume that we need to scalarize this op.
599
8.74k
    // TODO: If one of the types get legalized by splitting, handle this
600
8.74k
    // similarly to what getCastInstrCost() does.
601
8.74k
    if (Ty->isVectorTy()) {
602
5.62k
      unsigned Num = Ty->getVectorNumElements();
603
5.62k
      unsigned Cost = static_cast<T *>(this)
604
5.62k
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
5.62k
      // Return the cost of multiple scalar invocation plus the cost of
606
5.62k
      // inserting and extracting the values.
607
5.62k
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
5.62k
    }
609
3.12k
610
3.12k
    // We don't know anything about this scalar instruction.
611
3.12k
    return OpCost;
612
3.12k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
417k
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
417k
    // Check if any of the operands are vector operands.
575
417k
    const TargetLoweringBase *TLI = getTLI();
576
417k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
417k
    assert(ISD && "Invalid opcode");
578
417k
579
417k
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
417k
581
417k
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
417k
    // Assume that floating point arithmetic operations cost twice as much as
583
417k
    // integer operations.
584
417k
    unsigned OpCost = (IsFloat ? 
2262k
:
1154k
);
585
417k
586
417k
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
364k
      // The operation is legal. Assume it costs 1.
588
364k
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
364k
      return LT.first * OpCost;
590
364k
    }
591
52.3k
592
52.3k
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
46.6k
      // If the operation is custom lowered, then assume that the code is twice
594
46.6k
      // as expensive.
595
46.6k
      return LT.first * 2 * OpCost;
596
46.6k
    }
597
5.68k
598
5.68k
    // Else, assume that we need to scalarize this op.
599
5.68k
    // TODO: If one of the types get legalized by splitting, handle this
600
5.68k
    // similarly to what getCastInstrCost() does.
601
5.68k
    if (Ty->isVectorTy()) {
602
4.81k
      unsigned Num = Ty->getVectorNumElements();
603
4.81k
      unsigned Cost = static_cast<T *>(this)
604
4.81k
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
4.81k
      // Return the cost of multiple scalar invocation plus the cost of
606
4.81k
      // inserting and extracting the values.
607
4.81k
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
4.81k
    }
609
870
610
870
    // We don't know anything about this scalar instruction.
611
870
    return OpCost;
612
870
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
31
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
31
    // Check if any of the operands are vector operands.
575
31
    const TargetLoweringBase *TLI = getTLI();
576
31
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
31
    assert(ISD && "Invalid opcode");
578
31
579
31
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
31
581
31
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
31
    // Assume that floating point arithmetic operations cost twice as much as
583
31
    // integer operations.
584
31
    unsigned OpCost = (IsFloat ? 
224
:
17
);
585
31
586
31
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
1
      // The operation is legal. Assume it costs 1.
588
1
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
1
      return LT.first * OpCost;
590
1
    }
591
30
592
30
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
0
      // If the operation is custom lowered, then assume that the code is twice
594
0
      // as expensive.
595
0
      return LT.first * 2 * OpCost;
596
0
    }
597
30
598
30
    // Else, assume that we need to scalarize this op.
599
30
    // TODO: If one of the types get legalized by splitting, handle this
600
30
    // similarly to what getCastInstrCost() does.
601
30
    if (Ty->isVectorTy()) {
602
30
      unsigned Num = Ty->getVectorNumElements();
603
30
      unsigned Cost = static_cast<T *>(this)
604
30
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
30
      // Return the cost of multiple scalar invocation plus the cost of
606
30
      // inserting and extracting the values.
607
30
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
30
    }
609
0
610
0
    // We don't know anything about this scalar instruction.
611
0
    return OpCost;
612
0
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
15.1k
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
15.1k
    // Check if any of the operands are vector operands.
575
15.1k
    const TargetLoweringBase *TLI = getTLI();
576
15.1k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
15.1k
    assert(ISD && "Invalid opcode");
578
15.1k
579
15.1k
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
15.1k
581
15.1k
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
15.1k
    // Assume that floating point arithmetic operations cost twice as much as
583
15.1k
    // integer operations.
584
15.1k
    unsigned OpCost = (IsFloat ? 
22.93k
:
112.1k
);
585
15.1k
586
15.1k
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
13.4k
      // The operation is legal. Assume it costs 1.
588
13.4k
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
13.4k
      return LT.first * OpCost;
590
13.4k
    }
591
1.70k
592
1.70k
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
991
      // If the operation is custom lowered, then assume that the code is twice
594
991
      // as expensive.
595
991
      return LT.first * 2 * OpCost;
596
991
    }
597
712
598
712
    // Else, assume that we need to scalarize this op.
599
712
    // TODO: If one of the types get legalized by splitting, handle this
600
712
    // similarly to what getCastInstrCost() does.
601
712
    if (Ty->isVectorTy()) {
602
694
      unsigned Num = Ty->getVectorNumElements();
603
694
      unsigned Cost = static_cast<T *>(this)
604
694
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
694
      // Return the cost of multiple scalar invocation plus the cost of
606
694
      // inserting and extracting the values.
607
694
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
694
    }
609
18
610
18
    // We don't know anything about this scalar instruction.
611
18
    return OpCost;
612
18
  }
llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
42
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
42
    // Check if any of the operands are vector operands.
575
42
    const TargetLoweringBase *TLI = getTLI();
576
42
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
42
    assert(ISD && "Invalid opcode");
578
42
579
42
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
42
581
42
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
42
    // Assume that floating point arithmetic operations cost twice as much as
583
42
    // integer operations.
584
42
    unsigned OpCost = (IsFloat ? 
20
: 1);
585
42
586
42
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
42
      // The operation is legal. Assume it costs 1.
588
42
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
42
      return LT.first * OpCost;
590
42
    }
591
0
592
0
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
0
      // If the operation is custom lowered, then assume that the code is twice
594
0
      // as expensive.
595
0
      return LT.first * 2 * OpCost;
596
0
    }
597
0
598
0
    // Else, assume that we need to scalarize this op.
599
0
    // TODO: If one of the types get legalized by splitting, handle this
600
0
    // similarly to what getCastInstrCost() does.
601
0
    if (Ty->isVectorTy()) {
602
0
      unsigned Num = Ty->getVectorNumElements();
603
0
      unsigned Cost = static_cast<T *>(this)
604
0
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
0
      // Return the cost of multiple scalar invocation plus the cost of
606
0
      // inserting and extracting the values.
607
0
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
0
    }
609
0
610
0
    // We don't know anything about this scalar instruction.
611
0
    return OpCost;
612
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
13
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
13
    // Check if any of the operands are vector operands.
575
13
    const TargetLoweringBase *TLI = getTLI();
576
13
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
13
    assert(ISD && "Invalid opcode");
578
13
579
13
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
13
581
13
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
13
    // Assume that floating point arithmetic operations cost twice as much as
583
13
    // integer operations.
584
13
    unsigned OpCost = (IsFloat ? 
210
:
13
);
585
13
586
13
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
11
      // The operation is legal. Assume it costs 1.
588
11
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
11
      return LT.first * OpCost;
590
11
    }
591
2
592
2
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
0
      // If the operation is custom lowered, then assume that the code is twice
594
0
      // as expensive.
595
0
      return LT.first * 2 * OpCost;
596
0
    }
597
2
598
2
    // Else, assume that we need to scalarize this op.
599
2
    // TODO: If one of the types get legalized by splitting, handle this
600
2
    // similarly to what getCastInstrCost() does.
601
2
    if (Ty->isVectorTy()) {
602
2
      unsigned Num = Ty->getVectorNumElements();
603
2
      unsigned Cost = static_cast<T *>(this)
604
2
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
2
      // Return the cost of multiple scalar invocation plus the cost of
606
2
      // inserting and extracting the values.
607
2
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
2
    }
609
0
610
0
    // We don't know anything about this scalar instruction.
611
0
    return OpCost;
612
0
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
124
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
124
    // Check if any of the operands are vector operands.
575
124
    const TargetLoweringBase *TLI = getTLI();
576
124
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
124
    assert(ISD && "Invalid opcode");
578
124
579
124
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
124
581
124
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
124
    // Assume that floating point arithmetic operations cost twice as much as
583
124
    // integer operations.
584
124
    unsigned OpCost = (IsFloat ? 
270
:
154
);
585
124
586
124
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
124
      // The operation is legal. Assume it costs 1.
588
124
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
124
      return LT.first * OpCost;
590
124
    }
591
0
592
0
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
0
      // If the operation is custom lowered, then assume that the code is twice
594
0
      // as expensive.
595
0
      return LT.first * 2 * OpCost;
596
0
    }
597
0
598
0
    // Else, assume that we need to scalarize this op.
599
0
    // TODO: If one of the types get legalized by splitting, handle this
600
0
    // similarly to what getCastInstrCost() does.
601
0
    if (Ty->isVectorTy()) {
602
0
      unsigned Num = Ty->getVectorNumElements();
603
0
      unsigned Cost = static_cast<T *>(this)
604
0
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
0
      // Return the cost of multiple scalar invocation plus the cost of
606
0
      // inserting and extracting the values.
607
0
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
0
    }
609
0
610
0
    // We don't know anything about this scalar instruction.
611
0
    return OpCost;
612
0
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
354
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
354
    // Check if any of the operands are vector operands.
575
354
    const TargetLoweringBase *TLI = getTLI();
576
354
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
354
    assert(ISD && "Invalid opcode");
578
354
579
354
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
354
581
354
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
354
    // Assume that floating point arithmetic operations cost twice as much as
583
354
    // integer operations.
584
354
    unsigned OpCost = (IsFloat ? 
20
: 1);
585
354
586
354
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
334
      // The operation is legal. Assume it costs 1.
588
334
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
334
      return LT.first * OpCost;
590
334
    }
591
20
592
20
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
0
      // If the operation is custom lowered, then assume that the code is twice
594
0
      // as expensive.
595
0
      return LT.first * 2 * OpCost;
596
0
    }
597
20
598
20
    // Else, assume that we need to scalarize this op.
599
20
    // TODO: If one of the types get legalized by splitting, handle this
600
20
    // similarly to what getCastInstrCost() does.
601
20
    if (Ty->isVectorTy()) {
602
20
      unsigned Num = Ty->getVectorNumElements();
603
20
      unsigned Cost = static_cast<T *>(this)
604
20
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
20
      // Return the cost of multiple scalar invocation plus the cost of
606
20
      // inserting and extracting the values.
607
20
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
20
    }
609
0
610
0
    // We don't know anything about this scalar instruction.
611
0
    return OpCost;
612
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
Line
Count
Source
573
78.4k
      ArrayRef<const Value *> Args = ArrayRef<const Value *>()) {
574
78.4k
    // Check if any of the operands are vector operands.
575
78.4k
    const TargetLoweringBase *TLI = getTLI();
576
78.4k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
577
78.4k
    assert(ISD && "Invalid opcode");
578
78.4k
579
78.4k
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
580
78.4k
581
78.4k
    bool IsFloat = Ty->isFPOrFPVectorTy();
582
78.4k
    // Assume that floating point arithmetic operations cost twice as much as
583
78.4k
    // integer operations.
584
78.4k
    unsigned OpCost = (IsFloat ? 
21.04k
:
177.4k
);
585
78.4k
586
78.4k
    if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
587
76.1k
      // The operation is legal. Assume it costs 1.
588
76.1k
      // TODO: Once we have extract/insert subvector cost we need to use them.
589
76.1k
      return LT.first * OpCost;
590
76.1k
    }
591
2.29k
592
2.29k
    if (!TLI->isOperationExpand(ISD, LT.second)) {
593
0
      // If the operation is custom lowered, then assume that the code is twice
594
0
      // as expensive.
595
0
      return LT.first * 2 * OpCost;
596
0
    }
597
2.29k
598
2.29k
    // Else, assume that we need to scalarize this op.
599
2.29k
    // TODO: If one of the types get legalized by splitting, handle this
600
2.29k
    // similarly to what getCastInstrCost() does.
601
2.29k
    if (Ty->isVectorTy()) {
602
60
      unsigned Num = Ty->getVectorNumElements();
603
60
      unsigned Cost = static_cast<T *>(this)
604
60
                          ->getArithmeticInstrCost(Opcode, Ty->getScalarType());
605
60
      // Return the cost of multiple scalar invocation plus the cost of
606
60
      // inserting and extracting the values.
607
60
      return getScalarizationOverhead(Ty, Args) + Num * Cost;
608
60
    }
609
2.23k
610
2.23k
    // We don't know anything about this scalar instruction.
611
2.23k
    return OpCost;
612
2.23k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueKind, llvm::TargetTransformInfo::OperandValueProperties, llvm::TargetTransformInfo::OperandValueProperties, llvm::ArrayRef<llvm::Value const*>)
613
614
  unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
615
7.65k
                          Type *SubTp) {
616
7.65k
    switch (Kind) {
617
7.65k
    case TTI::SK_Broadcast:
618
45
      return getBroadcastShuffleOverhead(Tp);
619
7.65k
    case TTI::SK_Select:
620
3.64k
    case TTI::SK_Reverse:
621
3.64k
    case TTI::SK_Transpose:
622
3.64k
    case TTI::SK_PermuteSingleSrc:
623
3.64k
    case TTI::SK_PermuteTwoSrc:
624
3.64k
      return getPermuteShuffleOverhead(Tp);
625
3.93k
    case TTI::SK_ExtractSubvector:
626
3.93k
      return getExtractSubvectorOverhead(Tp, Index, SubTp);
627
3.64k
    case TTI::SK_InsertSubvector:
628
39
      return getInsertSubvectorOverhead(Tp, Index, SubTp);
629
0
    }
630
0
    llvm_unreachable("Unknown TTI::ShuffleKind");
631
0
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Line
Count
Source
615
6.91k
                          Type *SubTp) {
616
6.91k
    switch (Kind) {
617
6.91k
    case TTI::SK_Broadcast:
618
2
      return getBroadcastShuffleOverhead(Tp);
619
6.91k
    case TTI::SK_Select:
620
3.01k
    case TTI::SK_Reverse:
621
3.01k
    case TTI::SK_Transpose:
622
3.01k
    case TTI::SK_PermuteSingleSrc:
623
3.01k
    case TTI::SK_PermuteTwoSrc:
624
3.01k
      return getPermuteShuffleOverhead(Tp);
625
3.89k
    case TTI::SK_ExtractSubvector:
626
3.89k
      return getExtractSubvectorOverhead(Tp, Index, SubTp);
627
3.01k
    case TTI::SK_InsertSubvector:
628
0
      return getInsertSubvectorOverhead(Tp, Index, SubTp);
629
0
    }
630
0
    llvm_unreachable("Unknown TTI::ShuffleKind");
631
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Line
Count
Source
615
81
                          Type *SubTp) {
616
81
    switch (Kind) {
617
81
    case TTI::SK_Broadcast:
618
2
      return getBroadcastShuffleOverhead(Tp);
619
81
    case TTI::SK_Select:
620
54
    case TTI::SK_Reverse:
621
54
    case TTI::SK_Transpose:
622
54
    case TTI::SK_PermuteSingleSrc:
623
54
    case TTI::SK_PermuteTwoSrc:
624
54
      return getPermuteShuffleOverhead(Tp);
625
54
    case TTI::SK_ExtractSubvector:
626
25
      return getExtractSubvectorOverhead(Tp, Index, SubTp);
627
54
    case TTI::SK_InsertSubvector:
628
0
      return getInsertSubvectorOverhead(Tp, Index, SubTp);
629
0
    }
630
0
    llvm_unreachable("Unknown TTI::ShuffleKind");
631
0
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Line
Count
Source
615
96
                          Type *SubTp) {
616
96
    switch (Kind) {
617
96
    case TTI::SK_Broadcast:
618
0
      return getBroadcastShuffleOverhead(Tp);
619
96
    case TTI::SK_Select:
620
96
    case TTI::SK_Reverse:
621
96
    case TTI::SK_Transpose:
622
96
    case TTI::SK_PermuteSingleSrc:
623
96
    case TTI::SK_PermuteTwoSrc:
624
96
      return getPermuteShuffleOverhead(Tp);
625
96
    case TTI::SK_ExtractSubvector:
626
0
      return getExtractSubvectorOverhead(Tp, Index, SubTp);
627
96
    case TTI::SK_InsertSubvector:
628
0
      return getInsertSubvectorOverhead(Tp, Index, SubTp);
629
0
    }
630
0
    llvm_unreachable("Unknown TTI::ShuffleKind");
631
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
Line
Count
Source
615
570
                          Type *SubTp) {
616
570
    switch (Kind) {
617
570
    case TTI::SK_Broadcast:
618
41
      return getBroadcastShuffleOverhead(Tp);
619
570
    case TTI::SK_Select:
620
478
    case TTI::SK_Reverse:
621
478
    case TTI::SK_Transpose:
622
478
    case TTI::SK_PermuteSingleSrc:
623
478
    case TTI::SK_PermuteTwoSrc:
624
478
      return getPermuteShuffleOverhead(Tp);
625
478
    case TTI::SK_ExtractSubvector:
626
12
      return getExtractSubvectorOverhead(Tp, Index, SubTp);
627
478
    case TTI::SK_InsertSubvector:
628
39
      return getInsertSubvectorOverhead(Tp, Index, SubTp);
629
0
    }
630
0
    llvm_unreachable("Unknown TTI::ShuffleKind");
631
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::Type*, int, llvm::Type*)
632
633
  unsigned getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
634
117k
                            const Instruction *I = nullptr) {
635
117k
    const TargetLoweringBase *TLI = getTLI();
636
117k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
117k
    assert(ISD && "Invalid opcode");
638
117k
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
117k
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
117k
641
117k
    // Check for NOOP conversions.
642
117k
    if (SrcLT.first == DstLT.first &&
643
117k
        
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()112k
) {
644
41.1k
645
41.1k
      // Bitcast between types that are legalized to the same type are free.
646
41.1k
      if (Opcode == Instruction::BitCast || 
Opcode == Instruction::Trunc29.6k
)
647
13.7k
        return 0;
648
103k
    }
649
103k
650
103k
    if (Opcode == Instruction::Trunc &&
651
103k
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)43.0k
)
652
24.0k
      return 0;
653
79.2k
654
79.2k
    if (Opcode == Instruction::ZExt &&
655
79.2k
        
TLI->isZExtFree(SrcLT.second, DstLT.second)18.7k
)
656
4.08k
      return 0;
657
75.1k
658
75.1k
    if (Opcode == Instruction::AddrSpaceCast &&
659
75.1k
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
12
                                 Dst->getPointerAddressSpace()))
661
3
      return 0;
662
75.1k
663
75.1k
    // If this is a zext/sext of a load, return 0 if the corresponding
664
75.1k
    // extending load exists on target.
665
75.1k
    if ((Opcode == Instruction::ZExt || 
Opcode == Instruction::SExt60.4k
) &&
666
75.1k
        
I28.6k
&&
isa<LoadInst>(I->getOperand(0))2.93k
) {
667
748
        EVT ExtVT = EVT::getEVT(Dst);
668
748
        EVT LoadVT = EVT::getEVT(Src);
669
748
        unsigned LType =
670
748
          ((Opcode == Instruction::ZExt) ? 
ISD::ZEXTLOAD483
:
ISD::SEXTLOAD265
);
671
748
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
547
          return 0;
673
74.5k
    }
674
74.5k
675
74.5k
    // If the cast is marked as legal (or promote) then assume low cost.
676
74.5k
    if (SrcLT.first == DstLT.first &&
677
74.5k
        
TLI->isOperationLegalOrPromote(ISD, DstLT.second)69.6k
)
678
65.2k
      return 1;
679
9.35k
680
9.35k
    // Handle scalar conversions.
681
9.35k
    if (!Src->isVectorTy() && 
!Dst->isVectorTy()2.95k
) {
682
2.95k
      // Scalar bitcasts are usually free.
683
2.95k
      if (Opcode == Instruction::BitCast)
684
95
        return 0;
685
2.85k
686
2.85k
      // Just check the op cost. If the operation is legal then assume it costs
687
2.85k
      // 1.
688
2.85k
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
2.55k
        return 1;
690
298
691
298
      // Assume that illegal scalar instruction are expensive.
692
298
      return 4;
693
298
    }
694
6.40k
695
6.40k
    // Check vector-to-vector casts.
696
6.40k
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
6.40k
      // If the cast is between same-sized registers, then the check is simple.
698
6.40k
      if (SrcLT.first == DstLT.first &&
699
6.40k
          
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()2.49k
) {
700
2.13k
701
2.13k
        // Assume that Zext is done using AND.
702
2.13k
        if (Opcode == Instruction::ZExt)
703
987
          return 1;
704
1.15k
705
1.15k
        // Assume that sext is done using SHL and SRA.
706
1.15k
        if (Opcode == Instruction::SExt)
707
256
          return 2;
708
895
709
895
        // Just check the op cost. If the operation is legal then assume it
710
895
        // costs
711
895
        // 1 and multiply by the type-legalization overhead.
712
895
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
36
          return SrcLT.first * 1;
714
5.12k
      }
715
5.12k
716
5.12k
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
5.12k
      // of casting the original vector twice. We also need to factor in the
718
5.12k
      // cost of the split itself. Count that as 1, to be consistent with
719
5.12k
      // TLI->getTypeLegalizationCost().
720
5.12k
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
5.12k
           TargetLowering::TypeSplitVector) ||
722
5.12k
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
3.63k
           TargetLowering::TypeSplitVector)) {
724
3.63k
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
3.63k
                                         Dst->getVectorNumElements() / 2);
726
3.63k
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
3.63k
                                         Src->getVectorNumElements() / 2);
728
3.63k
        T *TTI = static_cast<T *>(this);
729
3.63k
        return TTI->getVectorSplitCost() +
730
3.63k
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
3.63k
      }
732
1.49k
733
1.49k
      // In other cases where the source or destination are illegal, assume
734
1.49k
      // the operation will get scalarized.
735
1.49k
      unsigned Num = Dst->getVectorNumElements();
736
1.49k
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
1.49k
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
1.49k
739
1.49k
      // Return the cost of multiple scalar invocation plus the cost of
740
1.49k
      // inserting and extracting the values.
741
1.49k
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
1.49k
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Line
Count
Source
634
102k
                            const Instruction *I = nullptr) {
635
102k
    const TargetLoweringBase *TLI = getTLI();
636
102k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
102k
    assert(ISD && "Invalid opcode");
638
102k
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
102k
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
102k
641
102k
    // Check for NOOP conversions.
642
102k
    if (SrcLT.first == DstLT.first &&
643
102k
        
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()100k
) {
644
34.2k
645
34.2k
      // Bitcast between types that are legalized to the same type are free.
646
34.2k
      if (Opcode == Instruction::BitCast || 
Opcode == Instruction::Trunc24.0k
)
647
11.9k
        return 0;
648
90.5k
    }
649
90.5k
650
90.5k
    if (Opcode == Instruction::Trunc &&
651
90.5k
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)40.2k
)
652
23.4k
      return 0;
653
67.0k
654
67.0k
    if (Opcode == Instruction::ZExt &&
655
67.0k
        
TLI->isZExtFree(SrcLT.second, DstLT.second)16.0k
)
656
3.85k
      return 0;
657
63.2k
658
63.2k
    if (Opcode == Instruction::AddrSpaceCast &&
659
63.2k
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
0
                                 Dst->getPointerAddressSpace()))
661
0
      return 0;
662
63.2k
663
63.2k
    // If this is a zext/sext of a load, return 0 if the corresponding
664
63.2k
    // extending load exists on target.
665
63.2k
    if ((Opcode == Instruction::ZExt || 
Opcode == Instruction::SExt50.9k
) &&
666
63.2k
        
I25.2k
&&
isa<LoadInst>(I->getOperand(0))0
) {
667
0
        EVT ExtVT = EVT::getEVT(Dst);
668
0
        EVT LoadVT = EVT::getEVT(Src);
669
0
        unsigned LType =
670
0
          ((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD);
671
0
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
0
          return 0;
673
63.2k
    }
674
63.2k
675
63.2k
    // If the cast is marked as legal (or promote) then assume low cost.
676
63.2k
    if (SrcLT.first == DstLT.first &&
677
63.2k
        
TLI->isOperationLegalOrPromote(ISD, DstLT.second)61.6k
)
678
60.5k
      return 1;
679
2.65k
680
2.65k
    // Handle scalar conversions.
681
2.65k
    if (!Src->isVectorTy() && 
!Dst->isVectorTy()1.18k
) {
682
1.18k
      // Scalar bitcasts are usually free.
683
1.18k
      if (Opcode == Instruction::BitCast)
684
0
        return 0;
685
1.18k
686
1.18k
      // Just check the op cost. If the operation is legal then assume it costs
687
1.18k
      // 1.
688
1.18k
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
1.18k
        return 1;
690
0
691
0
      // Assume that illegal scalar instruction are expensive.
692
0
      return 4;
693
0
    }
694
1.46k
695
1.46k
    // Check vector-to-vector casts.
696
1.46k
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
1.46k
      // If the cast is between same-sized registers, then the check is simple.
698
1.46k
      if (SrcLT.first == DstLT.first &&
699
1.46k
          
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()0
) {
700
0
701
0
        // Assume that Zext is done using AND.
702
0
        if (Opcode == Instruction::ZExt)
703
0
          return 1;
704
0
705
0
        // Assume that sext is done using SHL and SRA.
706
0
        if (Opcode == Instruction::SExt)
707
0
          return 2;
708
0
709
0
        // Just check the op cost. If the operation is legal then assume it
710
0
        // costs
711
0
        // 1 and multiply by the type-legalization overhead.
712
0
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
0
          return SrcLT.first * 1;
714
1.46k
      }
715
1.46k
716
1.46k
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
1.46k
      // of casting the original vector twice. We also need to factor in the
718
1.46k
      // cost of the split itself. Count that as 1, to be consistent with
719
1.46k
      // TLI->getTypeLegalizationCost().
720
1.46k
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
1.46k
           TargetLowering::TypeSplitVector) ||
722
1.46k
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
1.43k
           TargetLowering::TypeSplitVector)) {
724
1.43k
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
1.43k
                                         Dst->getVectorNumElements() / 2);
726
1.43k
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
1.43k
                                         Src->getVectorNumElements() / 2);
728
1.43k
        T *TTI = static_cast<T *>(this);
729
1.43k
        return TTI->getVectorSplitCost() +
730
1.43k
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
1.43k
      }
732
34
733
34
      // In other cases where the source or destination are illegal, assume
734
34
      // the operation will get scalarized.
735
34
      unsigned Num = Dst->getVectorNumElements();
736
34
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
34
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
34
739
34
      // Return the cost of multiple scalar invocation plus the cost of
740
34
      // inserting and extracting the values.
741
34
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
34
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Line
Count
Source
634
14
                            const Instruction *I = nullptr) {
635
14
    const TargetLoweringBase *TLI = getTLI();
636
14
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
14
    assert(ISD && "Invalid opcode");
638
14
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
14
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
14
641
14
    // Check for NOOP conversions.
642
14
    if (SrcLT.first == DstLT.first &&
643
14
        SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
644
12
645
12
      // Bitcast between types that are legalized to the same type are free.
646
12
      if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
647
0
        return 0;
648
14
    }
649
14
650
14
    if (Opcode == Instruction::Trunc &&
651
14
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)0
)
652
0
      return 0;
653
14
654
14
    if (Opcode == Instruction::ZExt &&
655
14
        
TLI->isZExtFree(SrcLT.second, DstLT.second)2
)
656
2
      return 0;
657
12
658
12
    if (Opcode == Instruction::AddrSpaceCast &&
659
12
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
12
                                 Dst->getPointerAddressSpace()))
661
3
      return 0;
662
9
663
9
    // If this is a zext/sext of a load, return 0 if the corresponding
664
9
    // extending load exists on target.
665
9
    if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
666
9
        
I0
&&
isa<LoadInst>(I->getOperand(0))0
) {
667
0
        EVT ExtVT = EVT::getEVT(Dst);
668
0
        EVT LoadVT = EVT::getEVT(Src);
669
0
        unsigned LType =
670
0
          ((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD);
671
0
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
0
          return 0;
673
9
    }
674
9
675
9
    // If the cast is marked as legal (or promote) then assume low cost.
676
9
    if (SrcLT.first == DstLT.first &&
677
9
        TLI->isOperationLegalOrPromote(ISD, DstLT.second))
678
0
      return 1;
679
9
680
9
    // Handle scalar conversions.
681
9
    if (!Src->isVectorTy() && 
!Dst->isVectorTy()3
) {
682
3
      // Scalar bitcasts are usually free.
683
3
      if (Opcode == Instruction::BitCast)
684
0
        return 0;
685
3
686
3
      // Just check the op cost. If the operation is legal then assume it costs
687
3
      // 1.
688
3
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
3
        return 1;
690
0
691
0
      // Assume that illegal scalar instruction are expensive.
692
0
      return 4;
693
0
    }
694
6
695
6
    // Check vector-to-vector casts.
696
6
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
6
      // If the cast is between same-sized registers, then the check is simple.
698
6
      if (SrcLT.first == DstLT.first &&
699
6
          SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
700
6
701
6
        // Assume that Zext is done using AND.
702
6
        if (Opcode == Instruction::ZExt)
703
0
          return 1;
704
6
705
6
        // Assume that sext is done using SHL and SRA.
706
6
        if (Opcode == Instruction::SExt)
707
0
          return 2;
708
6
709
6
        // Just check the op cost. If the operation is legal then assume it
710
6
        // costs
711
6
        // 1 and multiply by the type-legalization overhead.
712
6
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
0
          return SrcLT.first * 1;
714
6
      }
715
6
716
6
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
6
      // of casting the original vector twice. We also need to factor in the
718
6
      // cost of the split itself. Count that as 1, to be consistent with
719
6
      // TLI->getTypeLegalizationCost().
720
6
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
6
           TargetLowering::TypeSplitVector) ||
722
6
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
4
           TargetLowering::TypeSplitVector)) {
724
4
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
4
                                         Dst->getVectorNumElements() / 2);
726
4
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
4
                                         Src->getVectorNumElements() / 2);
728
4
        T *TTI = static_cast<T *>(this);
729
4
        return TTI->getVectorSplitCost() +
730
4
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
4
      }
732
2
733
2
      // In other cases where the source or destination are illegal, assume
734
2
      // the operation will get scalarized.
735
2
      unsigned Num = Dst->getVectorNumElements();
736
2
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
2
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
2
739
2
      // Return the cost of multiple scalar invocation plus the cost of
740
2
      // inserting and extracting the values.
741
2
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
2
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Line
Count
Source
634
1.20k
                            const Instruction *I = nullptr) {
635
1.20k
    const TargetLoweringBase *TLI = getTLI();
636
1.20k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
1.20k
    assert(ISD && "Invalid opcode");
638
1.20k
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
1.20k
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
1.20k
641
1.20k
    // Check for NOOP conversions.
642
1.20k
    if (SrcLT.first == DstLT.first &&
643
1.20k
        
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()856
) {
644
606
645
606
      // Bitcast between types that are legalized to the same type are free.
646
606
      if (Opcode == Instruction::BitCast || 
Opcode == Instruction::Trunc278
)
647
340
        return 0;
648
867
    }
649
867
650
867
    if (Opcode == Instruction::Trunc &&
651
867
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)168
)
652
0
      return 0;
653
867
654
867
    if (Opcode == Instruction::ZExt &&
655
867
        
TLI->isZExtFree(SrcLT.second, DstLT.second)236
)
656
0
      return 0;
657
867
658
867
    if (Opcode == Instruction::AddrSpaceCast &&
659
867
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
0
                                 Dst->getPointerAddressSpace()))
661
0
      return 0;
662
867
663
867
    // If this is a zext/sext of a load, return 0 if the corresponding
664
867
    // extending load exists on target.
665
867
    if ((Opcode == Instruction::ZExt || 
Opcode == Instruction::SExt631
) &&
666
867
        
I313
&&
isa<LoadInst>(I->getOperand(0))0
) {
667
0
        EVT ExtVT = EVT::getEVT(Dst);
668
0
        EVT LoadVT = EVT::getEVT(Src);
669
0
        unsigned LType =
670
0
          ((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD);
671
0
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
0
          return 0;
673
867
    }
674
867
675
867
    // If the cast is marked as legal (or promote) then assume low cost.
676
867
    if (SrcLT.first == DstLT.first &&
677
867
        
TLI->isOperationLegalOrPromote(ISD, DstLT.second)516
)
678
372
      return 1;
679
495
680
495
    // Handle scalar conversions.
681
495
    if (!Src->isVectorTy() && 
!Dst->isVectorTy()141
) {
682
141
      // Scalar bitcasts are usually free.
683
141
      if (Opcode == Instruction::BitCast)
684
82
        return 0;
685
59
686
59
      // Just check the op cost. If the operation is legal then assume it costs
687
59
      // 1.
688
59
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
59
        return 1;
690
0
691
0
      // Assume that illegal scalar instruction are expensive.
692
0
      return 4;
693
0
    }
694
354
695
354
    // Check vector-to-vector casts.
696
354
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
354
      // If the cast is between same-sized registers, then the check is simple.
698
354
      if (SrcLT.first == DstLT.first &&
699
354
          
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()144
) {
700
66
701
66
        // Assume that Zext is done using AND.
702
66
        if (Opcode == Instruction::ZExt)
703
0
          return 1;
704
66
705
66
        // Assume that sext is done using SHL and SRA.
706
66
        if (Opcode == Instruction::SExt)
707
0
          return 2;
708
66
709
66
        // Just check the op cost. If the operation is legal then assume it
710
66
        // costs
711
66
        // 1 and multiply by the type-legalization overhead.
712
66
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
12
          return SrcLT.first * 1;
714
342
      }
715
342
716
342
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
342
      // of casting the original vector twice. We also need to factor in the
718
342
      // cost of the split itself. Count that as 1, to be consistent with
719
342
      // TLI->getTypeLegalizationCost().
720
342
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
342
           TargetLowering::TypeSplitVector) ||
722
342
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
228
           TargetLowering::TypeSplitVector)) {
724
228
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
228
                                         Dst->getVectorNumElements() / 2);
726
228
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
228
                                         Src->getVectorNumElements() / 2);
728
228
        T *TTI = static_cast<T *>(this);
729
228
        return TTI->getVectorSplitCost() +
730
228
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
228
      }
732
114
733
114
      // In other cases where the source or destination are illegal, assume
734
114
      // the operation will get scalarized.
735
114
      unsigned Num = Dst->getVectorNumElements();
736
114
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
114
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
114
739
114
      // Return the cost of multiple scalar invocation plus the cost of
740
114
      // inserting and extracting the values.
741
114
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
114
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Line
Count
Source
634
47
                            const Instruction *I = nullptr) {
635
47
    const TargetLoweringBase *TLI = getTLI();
636
47
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
47
    assert(ISD && "Invalid opcode");
638
47
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
47
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
47
641
47
    // Check for NOOP conversions.
642
47
    if (SrcLT.first == DstLT.first &&
643
47
        
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()46
) {
644
31
645
31
      // Bitcast between types that are legalized to the same type are free.
646
31
      if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
647
0
        return 0;
648
47
    }
649
47
650
47
    if (Opcode == Instruction::Trunc &&
651
47
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)8
)
652
8
      return 0;
653
39
654
39
    if (Opcode == Instruction::ZExt &&
655
39
        
TLI->isZExtFree(SrcLT.second, DstLT.second)18
)
656
0
      return 0;
657
39
658
39
    if (Opcode == Instruction::AddrSpaceCast &&
659
39
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
0
                                 Dst->getPointerAddressSpace()))
661
0
      return 0;
662
39
663
39
    // If this is a zext/sext of a load, return 0 if the corresponding
664
39
    // extending load exists on target.
665
39
    if ((Opcode == Instruction::ZExt || 
Opcode == Instruction::SExt21
) &&
666
39
        
I23
&&
isa<LoadInst>(I->getOperand(0))0
) {
667
0
        EVT ExtVT = EVT::getEVT(Dst);
668
0
        EVT LoadVT = EVT::getEVT(Src);
669
0
        unsigned LType =
670
0
          ((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD);
671
0
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
0
          return 0;
673
39
    }
674
39
675
39
    // If the cast is marked as legal (or promote) then assume low cost.
676
39
    if (SrcLT.first == DstLT.first &&
677
39
        
TLI->isOperationLegalOrPromote(ISD, DstLT.second)38
)
678
38
      return 1;
679
1
680
1
    // Handle scalar conversions.
681
1
    if (!Src->isVectorTy() && 
!Dst->isVectorTy()0
) {
682
0
      // Scalar bitcasts are usually free.
683
0
      if (Opcode == Instruction::BitCast)
684
0
        return 0;
685
0
686
0
      // Just check the op cost. If the operation is legal then assume it costs
687
0
      // 1.
688
0
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
0
        return 1;
690
0
691
0
      // Assume that illegal scalar instruction are expensive.
692
0
      return 4;
693
0
    }
694
1
695
1
    // Check vector-to-vector casts.
696
1
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
1
      // If the cast is between same-sized registers, then the check is simple.
698
1
      if (SrcLT.first == DstLT.first &&
699
1
          
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()0
) {
700
0
701
0
        // Assume that Zext is done using AND.
702
0
        if (Opcode == Instruction::ZExt)
703
0
          return 1;
704
0
705
0
        // Assume that sext is done using SHL and SRA.
706
0
        if (Opcode == Instruction::SExt)
707
0
          return 2;
708
0
709
0
        // Just check the op cost. If the operation is legal then assume it
710
0
        // costs
711
0
        // 1 and multiply by the type-legalization overhead.
712
0
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
0
          return SrcLT.first * 1;
714
1
      }
715
1
716
1
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
1
      // of casting the original vector twice. We also need to factor in the
718
1
      // cost of the split itself. Count that as 1, to be consistent with
719
1
      // TLI->getTypeLegalizationCost().
720
1
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
1
           TargetLowering::TypeSplitVector) ||
722
1
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
1
           TargetLowering::TypeSplitVector)) {
724
1
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
1
                                         Dst->getVectorNumElements() / 2);
726
1
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
1
                                         Src->getVectorNumElements() / 2);
728
1
        T *TTI = static_cast<T *>(this);
729
1
        return TTI->getVectorSplitCost() +
730
1
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
1
      }
732
0
733
0
      // In other cases where the source or destination are illegal, assume
734
0
      // the operation will get scalarized.
735
0
      unsigned Num = Dst->getVectorNumElements();
736
0
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
0
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
0
739
0
      // Return the cost of multiple scalar invocation plus the cost of
740
0
      // inserting and extracting the values.
741
0
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
0
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Line
Count
Source
634
249
                            const Instruction *I = nullptr) {
635
249
    const TargetLoweringBase *TLI = getTLI();
636
249
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
249
    assert(ISD && "Invalid opcode");
638
249
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
249
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
249
641
249
    // Check for NOOP conversions.
642
249
    if (SrcLT.first == DstLT.first &&
643
249
        SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
644
80
645
80
      // Bitcast between types that are legalized to the same type are free.
646
80
      if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
647
10
        return 0;
648
239
    }
649
239
650
239
    if (Opcode == Instruction::Trunc &&
651
239
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)41
)
652
41
      return 0;
653
198
654
198
    if (Opcode == Instruction::ZExt &&
655
198
        
TLI->isZExtFree(SrcLT.second, DstLT.second)22
)
656
0
      return 0;
657
198
658
198
    if (Opcode == Instruction::AddrSpaceCast &&
659
198
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
0
                                 Dst->getPointerAddressSpace()))
661
0
      return 0;
662
198
663
198
    // If this is a zext/sext of a load, return 0 if the corresponding
664
198
    // extending load exists on target.
665
198
    if ((Opcode == Instruction::ZExt || 
Opcode == Instruction::SExt176
) &&
666
198
        
I88
&&
isa<LoadInst>(I->getOperand(0))88
) {
667
76
        EVT ExtVT = EVT::getEVT(Dst);
668
76
        EVT LoadVT = EVT::getEVT(Src);
669
76
        unsigned LType =
670
76
          ((Opcode == Instruction::ZExt) ? 
ISD::ZEXTLOAD16
:
ISD::SEXTLOAD60
);
671
76
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
76
          return 0;
673
122
    }
674
122
675
122
    // If the cast is marked as legal (or promote) then assume low cost.
676
122
    if (SrcLT.first == DstLT.first &&
677
122
        TLI->isOperationLegalOrPromote(ISD, DstLT.second))
678
122
      return 1;
679
0
680
0
    // Handle scalar conversions.
681
0
    if (!Src->isVectorTy() && !Dst->isVectorTy()) {
682
0
      // Scalar bitcasts are usually free.
683
0
      if (Opcode == Instruction::BitCast)
684
0
        return 0;
685
0
686
0
      // Just check the op cost. If the operation is legal then assume it costs
687
0
      // 1.
688
0
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
0
        return 1;
690
0
691
0
      // Assume that illegal scalar instruction are expensive.
692
0
      return 4;
693
0
    }
694
0
695
0
    // Check vector-to-vector casts.
696
0
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
0
      // If the cast is between same-sized registers, then the check is simple.
698
0
      if (SrcLT.first == DstLT.first &&
699
0
          SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
700
0
701
0
        // Assume that Zext is done using AND.
702
0
        if (Opcode == Instruction::ZExt)
703
0
          return 1;
704
0
705
0
        // Assume that sext is done using SHL and SRA.
706
0
        if (Opcode == Instruction::SExt)
707
0
          return 2;
708
0
709
0
        // Just check the op cost. If the operation is legal then assume it
710
0
        // costs
711
0
        // 1 and multiply by the type-legalization overhead.
712
0
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
0
          return SrcLT.first * 1;
714
0
      }
715
0
716
0
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
0
      // of casting the original vector twice. We also need to factor in the
718
0
      // cost of the split itself. Count that as 1, to be consistent with
719
0
      // TLI->getTypeLegalizationCost().
720
0
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
0
           TargetLowering::TypeSplitVector) ||
722
0
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
0
           TargetLowering::TypeSplitVector)) {
724
0
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
0
                                         Dst->getVectorNumElements() / 2);
726
0
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
0
                                         Src->getVectorNumElements() / 2);
728
0
        T *TTI = static_cast<T *>(this);
729
0
        return TTI->getVectorSplitCost() +
730
0
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
0
      }
732
0
733
0
      // In other cases where the source or destination are illegal, assume
734
0
      // the operation will get scalarized.
735
0
      unsigned Num = Dst->getVectorNumElements();
736
0
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
0
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
0
739
0
      // Return the cost of multiple scalar invocation plus the cost of
740
0
      // inserting and extracting the values.
741
0
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
0
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
Line
Count
Source
634
13.0k
                            const Instruction *I = nullptr) {
635
13.0k
    const TargetLoweringBase *TLI = getTLI();
636
13.0k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
637
13.0k
    assert(ISD && "Invalid opcode");
638
13.0k
    std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
639
13.0k
    std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
640
13.0k
641
13.0k
    // Check for NOOP conversions.
642
13.0k
    if (SrcLT.first == DstLT.first &&
643
13.0k
        
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()9.91k
) {
644
6.14k
645
6.14k
      // Bitcast between types that are legalized to the same type are free.
646
6.14k
      if (Opcode == Instruction::BitCast || 
Opcode == Instruction::Trunc5.23k
)
647
1.43k
        return 0;
648
11.6k
    }
649
11.6k
650
11.6k
    if (Opcode == Instruction::Trunc &&
651
11.6k
        
TLI->isTruncateFree(SrcLT.second, DstLT.second)2.50k
)
652
591
      return 0;
653
11.0k
654
11.0k
    if (Opcode == Instruction::ZExt &&
655
11.0k
        
TLI->isZExtFree(SrcLT.second, DstLT.second)2.40k
)
656
221
      return 0;
657
10.7k
658
10.7k
    if (Opcode == Instruction::AddrSpaceCast &&
659
10.7k
        TLI->isNoopAddrSpaceCast(Src->getPointerAddressSpace(),
660
0
                                 Dst->getPointerAddressSpace()))
661
0
      return 0;
662
10.7k
663
10.7k
    // If this is a zext/sext of a load, return 0 if the corresponding
664
10.7k
    // extending load exists on target.
665
10.7k
    if ((Opcode == Instruction::ZExt || 
Opcode == Instruction::SExt8.61k
) &&
666
10.7k
        
I2.96k
&&
isa<LoadInst>(I->getOperand(0))2.84k
) {
667
672
        EVT ExtVT = EVT::getEVT(Dst);
668
672
        EVT LoadVT = EVT::getEVT(Src);
669
672
        unsigned LType =
670
672
          ((Opcode == Instruction::ZExt) ? 
ISD::ZEXTLOAD467
:
ISD::SEXTLOAD205
);
671
672
        if (TLI->isLoadExtLegal(LType, ExtVT, LoadVT))
672
471
          return 0;
673
10.3k
    }
674
10.3k
675
10.3k
    // If the cast is marked as legal (or promote) then assume low cost.
676
10.3k
    if (SrcLT.first == DstLT.first &&
677
10.3k
        
TLI->isOperationLegalOrPromote(ISD, DstLT.second)7.28k
)
678
4.12k
      return 1;
679
6.19k
680
6.19k
    // Handle scalar conversions.
681
6.19k
    if (!Src->isVectorTy() && 
!Dst->isVectorTy()1.62k
) {
682
1.62k
      // Scalar bitcasts are usually free.
683
1.62k
      if (Opcode == Instruction::BitCast)
684
13
        return 0;
685
1.61k
686
1.61k
      // Just check the op cost. If the operation is legal then assume it costs
687
1.61k
      // 1.
688
1.61k
      if (!TLI->isOperationExpand(ISD, DstLT.second))
689
1.31k
        return 1;
690
298
691
298
      // Assume that illegal scalar instruction are expensive.
692
298
      return 4;
693
298
    }
694
4.57k
695
4.57k
    // Check vector-to-vector casts.
696
4.57k
    if (Dst->isVectorTy() && Src->isVectorTy()) {
697
4.57k
      // If the cast is between same-sized registers, then the check is simple.
698
4.57k
      if (SrcLT.first == DstLT.first &&
699
4.57k
          
SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()2.34k
) {
700
2.06k
701
2.06k
        // Assume that Zext is done using AND.
702
2.06k
        if (Opcode == Instruction::ZExt)
703
987
          return 1;
704
1.07k
705
1.07k
        // Assume that sext is done using SHL and SRA.
706
1.07k
        if (Opcode == Instruction::SExt)
707
256
          return 2;
708
823
709
823
        // Just check the op cost. If the operation is legal then assume it
710
823
        // costs
711
823
        // 1 and multiply by the type-legalization overhead.
712
823
        if (!TLI->isOperationExpand(ISD, DstLT.second))
713
24
          return SrcLT.first * 1;
714
3.30k
      }
715
3.30k
716
3.30k
      // If we are legalizing by splitting, query the concrete TTI for the cost
717
3.30k
      // of casting the original vector twice. We also need to factor in the
718
3.30k
      // cost of the split itself. Count that as 1, to be consistent with
719
3.30k
      // TLI->getTypeLegalizationCost().
720
3.30k
      if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
721
3.30k
           TargetLowering::TypeSplitVector) ||
722
3.30k
          (TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
723
1.96k
           TargetLowering::TypeSplitVector)) {
724
1.96k
        Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
725
1.96k
                                         Dst->getVectorNumElements() / 2);
726
1.96k
        Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
727
1.96k
                                         Src->getVectorNumElements() / 2);
728
1.96k
        T *TTI = static_cast<T *>(this);
729
1.96k
        return TTI->getVectorSplitCost() +
730
1.96k
               (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc, I));
731
1.96k
      }
732
1.34k
733
1.34k
      // In other cases where the source or destination are illegal, assume
734
1.34k
      // the operation will get scalarized.
735
1.34k
      unsigned Num = Dst->getVectorNumElements();
736
1.34k
      unsigned Cost = static_cast<T *>(this)->getCastInstrCost(
737
1.34k
          Opcode, Dst->getScalarType(), Src->getScalarType(), I);
738
1.34k
739
1.34k
      // Return the cost of multiple scalar invocation plus the cost of
740
1.34k
      // inserting and extracting the values.
741
1.34k
      return getScalarizationOverhead(Dst, true, true) + Num * Cost;
742
1.34k
    }
743
0
744
0
    // We already handled vector-to-vector and scalar-to-scalar conversions.
745
0
    // This
746
0
    // is where we handle bitcast between vectors and scalars. We need to assume
747
0
    //  that the conversion is scalarized in one way or another.
748
0
    if (Opcode == Instruction::BitCast)
749
0
      // Illegal bitcasts are done by storing and loading from a stack slot.
750
0
      return (Src->isVectorTy() ? getScalarizationOverhead(Src, false, true)
751
0
                                : 0) +
752
0
             (Dst->isVectorTy() ? getScalarizationOverhead(Dst, true, false)
753
0
                                : 0);
754
0
755
0
    llvm_unreachable("Unhandled cast");
756
0
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getCastInstrCost(unsigned int, llvm::Type*, llvm::Type*, llvm::Instruction const*)
757
758
  unsigned getExtractWithExtendCost(unsigned Opcode, Type *Dst,
759
8
                                    VectorType *VecTy, unsigned Index) {
760
8
    return static_cast<T *>(this)->getVectorInstrCost(
761
8
               Instruction::ExtractElement, VecTy, Index) +
762
8
           static_cast<T *>(this)->getCastInstrCost(Opcode, Dst,
763
8
                                                    VecTy->getElementType());
764
8
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::HexagonTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
Line
Count
Source
759
8
                                    VectorType *VecTy, unsigned Index) {
760
8
    return static_cast<T *>(this)->getVectorInstrCost(
761
8
               Instruction::ExtractElement, VecTy, Index) +
762
8
           static_cast<T *>(this)->getCastInstrCost(Opcode, Dst,
763
8
                                                    VecTy->getElementType());
764
8
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getExtractWithExtendCost(unsigned int, llvm::Type*, llvm::VectorType*, unsigned int)
765
766
130k
  unsigned getCFInstrCost(unsigned Opcode) {
767
130k
    // Branches are assumed to be predicted.
768
130k
    return 0;
769
130k
  }
llvm::BasicTTIImplBase<llvm::AArch64TTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
109k
  unsigned getCFInstrCost(unsigned Opcode) {
767
109k
    // Branches are assumed to be predicted.
768
109k
    return 0;
769
109k
  }
llvm::BasicTTIImplBase<llvm::GCNTTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
15
  unsigned getCFInstrCost(unsigned Opcode) {
767
15
    // Branches are assumed to be predicted.
768
15
    return 0;
769
15
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::R600TTIImpl>::getCFInstrCost(unsigned int)
llvm::BasicTTIImplBase<llvm::ARMTTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
3.02k
  unsigned getCFInstrCost(unsigned Opcode) {
767
3.02k
    // Branches are assumed to be predicted.
768
3.02k
    return 0;
769
3.02k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::LanaiTTIImpl>::getCFInstrCost(unsigned int)
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::BasicTTIImpl>::getCFInstrCost(unsigned int)
llvm::BasicTTIImplBase<llvm::NVPTXTTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
6
  unsigned getCFInstrCost(unsigned Opcode) {
767
6
    // Branches are assumed to be predicted.
768
6
    return 0;
769
6
  }
llvm::BasicTTIImplBase<llvm::PPCTTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
155
  unsigned getCFInstrCost(unsigned Opcode) {
767
155
    // Branches are assumed to be predicted.
768
155
    return 0;
769
155
  }
llvm::BasicTTIImplBase<llvm::SystemZTTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
933
  unsigned getCFInstrCost(unsigned Opcode) {
767
933
    // Branches are assumed to be predicted.
768
933
    return 0;
769
933
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::WebAssemblyTTIImpl>::getCFInstrCost(unsigned int)
llvm::BasicTTIImplBase<llvm::X86TTIImpl>::getCFInstrCost(unsigned int)
Line
Count
Source
766
16.7k
  unsigned getCFInstrCost(unsigned Opcode) {
767
16.7k
    // Branches are assumed to be predicted.
768
16.7k
    return 0;
769
16.7k
  }
Unexecuted instantiation: llvm::BasicTTIImplBase<llvm::XCoreTTIImpl>::getCFInstrCost(unsigned int)
770
771
  unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
772
187k
                              const Instruction *I) {
773
187k
    const TargetLoweringBase *TLI = getTLI();
774
187k
    int ISD = TLI->InstructionOpcodeToISD(Opcode);
775
187k
    assert(ISD && "Invalid opcode");
776
187k
777
187k
    // Selects on vectors are actually vector selects.
778
187k
    if (ISD == ISD::SELECT) {
779
69.0k
      assert(CondTy && "CondTy must exist");
780
69.0k
      if (CondTy->isVectorTy())
781
25.5k
        ISD = ISD::VSELECT;
782
69.0k
    }
783
187k
    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, ValTy);
784
187k
785
187k
    if (!(ValTy->isVectorTy() && 
!LT.second.isVector()59.2k
) &&
786
187k
        
!TLI->isOperationExpand(ISD, LT.second)186k
) {
787
160k
      // The operation is legal. Assume it costs 1. Multiply
788
160k
      // by the type-legalization overhead.
789
160k
      return LT.first * 1;
790
160k
    }
791
26.6k
792
26.6k
    // Otherwise, assume that the cast is scalarized.