summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-05-03 00:11:03 +0000
committerChandler Carruth <chandlerc@gmail.com>2018-05-03 00:11:03 +0000
commite74c354d125fd21cf5682d8f37d0bbe5950afba8 (patch)
tree9ab0f5b58a2d56db1655a34964c142a9d18f407b /llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
parent7d1b25d0538f52931b0b12d781fe8c1487b01010 (diff)
downloadbcm5719-llvm-e74c354d125fd21cf5682d8f37d0bbe5950afba8.tar.gz
bcm5719-llvm-e74c354d125fd21cf5682d8f37d0bbe5950afba8.zip
[gcov] Switch to an explicit if clunky array to satisfy some compilers
on various build bots that are unhappy with using makeArrayRef with an initializer list. llvm-svn: 331418
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 7447cb8c23c..49f7c330be8 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -908,6 +908,8 @@ Function *GCOVProfiler::insertCounterWriteout(
EmitArcsCallArgsTy->getPointerTo()});
Constant *Zero32 = Builder.getInt32(0);
+ // Build an explicit array of two zeros for use in ConstantExpr GEP building.
+ Constant *TwoZero32s[] = {Zero32, Zero32};
SmallVector<Constant *, 8> FileInfos;
for (int i : llvm::seq<int>(0, CUNodes->getNumOperands())) {
@@ -943,10 +945,8 @@ Function *GCOVProfiler::insertCounterWriteout(
unsigned Arcs = cast<ArrayType>(GV->getValueType())->getNumElements();
EmitArcsCallArgsArray.push_back(ConstantStruct::get(
EmitArcsCallArgsTy,
- {Builder.getInt32(Arcs),
- ConstantExpr::getInBoundsGetElementPtr(
- GV->getValueType(), GV,
- makeArrayRef<Constant *>({Zero32, Zero32}))}));
+ {Builder.getInt32(Arcs), ConstantExpr::getInBoundsGetElementPtr(
+ GV->getValueType(), GV, TwoZero32s)}));
}
// Create global arrays for the two emit calls.
int CountersSize = CountersBySP.size();
@@ -976,12 +976,11 @@ Function *GCOVProfiler::insertCounterWriteout(
FileInfos.push_back(ConstantStruct::get(
FileInfoTy,
{StartFileCallArgs, Builder.getInt32(CountersSize),
+ ConstantExpr::getInBoundsGetElementPtr(EmitFunctionCallArgsArrayTy,
+ EmitFunctionCallArgsArrayGV,
+ TwoZero32s),
ConstantExpr::getInBoundsGetElementPtr(
- EmitFunctionCallArgsArrayTy, EmitFunctionCallArgsArrayGV,
- makeArrayRef<Constant *>({Zero32, Zero32})),
- ConstantExpr::getInBoundsGetElementPtr(
- EmitArcsCallArgsArrayTy, EmitArcsCallArgsArrayGV,
- makeArrayRef<Constant *>({Zero32, Zero32}))}));
+ EmitArcsCallArgsArrayTy, EmitArcsCallArgsArrayGV, TwoZero32s)}));
}
// If we didn't find anything to actually emit, bail on out.
OpenPOWER on IntegriCloud