summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-03-15 02:41:29 +0000
committerTeresa Johnson <tejohnson@google.com>2016-03-15 02:41:29 +0000
commit2794f715751bbda2ca00c146a4867a8a1d7c0f0e (patch)
treeebd2e8a550268c9bb39cd25cb060e442b2cb785a /llvm/lib/Bitcode
parentee00abe5e66be17f601475e4397447f347287f6a (diff)
downloadbcm5719-llvm-2794f715751bbda2ca00c146a4867a8a1d7c0f0e.tar.gz
bcm5719-llvm-2794f715751bbda2ca00c146a4867a8a1d7c0f0e.zip
BitcodeWriter dyn_cast cleanup for r263275 (NFC)
Address review suggestions from dblaikie: change a few dyn_cast to cast and fold a cast into if condition. llvm-svn: 263526
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index de5aa73bd6d..ccffb31f064 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -2973,7 +2973,7 @@ static void WritePerModuleGlobalValueSummary(
assert(FunctionIndex.count(&F) == 1);
WritePerModuleFunctionSummaryRecord(
- NameVals, dyn_cast<FunctionSummary>(FunctionIndex[&F]->summary()),
+ NameVals, cast<FunctionSummary>(FunctionIndex[&F]->summary()),
VE.getValueID(M->getValueSymbolTable().lookup(F.getName())),
FSCallsAbbrev, FSCallsProfileAbbrev, Stream, F);
}
@@ -2987,7 +2987,7 @@ static void WritePerModuleGlobalValueSummary(
assert(FunctionIndex.count(F) == 1);
FunctionSummary *FS =
- dyn_cast<FunctionSummary>(FunctionIndex[F]->summary());
+ cast<FunctionSummary>(FunctionIndex[F]->summary());
// Add the alias to the reference list of aliasee function.
FS->addRefEdge(
VE.getValueID(M->getValueSymbolTable().lookup(A.getName())));
@@ -3001,11 +3001,9 @@ static void WritePerModuleGlobalValueSummary(
// of a function scope.
for (const GlobalVariable &G : M->globals())
WriteModuleLevelReferences(G, VE, NameVals, FSModRefsAbbrev, Stream);
- for (const GlobalAlias &A : M->aliases()) {
- const auto *GV = dyn_cast<GlobalVariable>(A.getBaseObject());
- if (GV)
+ for (const GlobalAlias &A : M->aliases())
+ if (auto *GV = dyn_cast<GlobalVariable>(A.getBaseObject()))
WriteModuleLevelReferences(*GV, VE, NameVals, FSModRefsAbbrev, Stream);
- }
Stream.ExitBlock();
}
@@ -3085,8 +3083,7 @@ static void WriteCombinedGlobalValueSummary(
continue;
}
- auto *FS = dyn_cast<FunctionSummary>(S);
- assert(FS);
+ auto *FS = cast<FunctionSummary>(S);
NameVals.push_back(I.getModuleId(FS->modulePath()));
NameVals.push_back(getEncodedLinkage(FS->linkage()));
NameVals.push_back(FS->instCount());
OpenPOWER on IntegriCloud