summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ThreadSafetyTIL.cpp
diff options
context:
space:
mode:
authorAaron Puchert <aaronpuchert@alice-dsl.net>2018-09-22 21:56:16 +0000
committerAaron Puchert <aaronpuchert@alice-dsl.net>2018-09-22 21:56:16 +0000
commit88d8536566a8aff2f200986643c16587f2c077ba (patch)
treed10a0e2afa0d7a107301a98d7df18170c11663a0 /clang/lib/Analysis/ThreadSafetyTIL.cpp
parent95530082c4f3d271e8e442b4025af38add6de4e7 (diff)
downloadbcm5719-llvm-88d8536566a8aff2f200986643c16587f2c077ba.tar.gz
bcm5719-llvm-88d8536566a8aff2f200986643c16587f2c077ba.zip
Eliminate some unneeded signed/unsigned conversions
No functional change is intended, but generally this should be a bit more safe. llvm-svn: 342823
Diffstat (limited to 'clang/lib/Analysis/ThreadSafetyTIL.cpp')
-rw-r--r--clang/lib/Analysis/ThreadSafetyTIL.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Analysis/ThreadSafetyTIL.cpp b/clang/lib/Analysis/ThreadSafetyTIL.cpp
index 798bbfb29d7..11f7afbd229 100644
--- a/clang/lib/Analysis/ThreadSafetyTIL.cpp
+++ b/clang/lib/Analysis/ThreadSafetyTIL.cpp
@@ -150,7 +150,7 @@ void til::simplifyIncompleteArg(til::Phi *Ph) {
}
// Renumbers the arguments and instructions to have unique, sequential IDs.
-int BasicBlock::renumberInstrs(int ID) {
+unsigned BasicBlock::renumberInstrs(unsigned ID) {
for (auto *Arg : Args)
Arg->setID(this, ID++);
for (auto *Instr : Instrs)
@@ -163,7 +163,8 @@ int BasicBlock::renumberInstrs(int ID) {
// Each block will be written into the Blocks array in order, and its BlockID
// will be set to the index in the array. Sorting should start from the entry
// block, and ID should be the total number of blocks.
-int BasicBlock::topologicalSort(SimpleArray<BasicBlock *> &Blocks, int ID) {
+unsigned BasicBlock::topologicalSort(SimpleArray<BasicBlock *> &Blocks,
+ unsigned ID) {
if (Visited) return ID;
Visited = true;
for (auto *Block : successors())
@@ -186,7 +187,8 @@ int BasicBlock::topologicalSort(SimpleArray<BasicBlock *> &Blocks, int ID) {
// critical edges, and (3) the entry block is reachable from the exit block
// and no blocks are accessible via traversal of back-edges from the exit that
// weren't accessible via forward edges from the entry.
-int BasicBlock::topologicalFinalSort(SimpleArray<BasicBlock*>& Blocks, int ID) {
+unsigned BasicBlock::topologicalFinalSort(SimpleArray<BasicBlock *> &Blocks,
+ unsigned ID) {
// Visited is assumed to have been set by the topologicalSort. This pass
// assumes !Visited means that we've visited this node before.
if (!Visited) return ID;
@@ -257,7 +259,7 @@ void BasicBlock::computePostDominator() {
// Renumber instructions in all blocks
void SCFG::renumberInstrs() {
- int InstrID = 0;
+ unsigned InstrID = 0;
for (auto *Block : Blocks)
InstrID = Block->renumberInstrs(InstrID);
}
@@ -288,11 +290,11 @@ static inline void computeNodeID(BasicBlock *B,
// 3) Topologically sorting the blocks into the "Blocks" array.
void SCFG::computeNormalForm() {
// Topologically sort the blocks starting from the entry block.
- int NumUnreachableBlocks = Entry->topologicalSort(Blocks, Blocks.size());
+ unsigned NumUnreachableBlocks = Entry->topologicalSort(Blocks, Blocks.size());
if (NumUnreachableBlocks > 0) {
// If there were unreachable blocks shift everything down, and delete them.
- for (size_t I = NumUnreachableBlocks, E = Blocks.size(); I < E; ++I) {
- size_t NI = I - NumUnreachableBlocks;
+ for (unsigned I = NumUnreachableBlocks, E = Blocks.size(); I < E; ++I) {
+ unsigned NI = I - NumUnreachableBlocks;
Blocks[NI] = Blocks[I];
Blocks[NI]->BlockID = NI;
// FIXME: clean up predecessor pointers to unreachable blocks?
@@ -305,7 +307,7 @@ void SCFG::computeNormalForm() {
Block->computeDominator();
// Once dominators have been computed, the final sort may be performed.
- int NumBlocks = Exit->topologicalFinalSort(Blocks, 0);
+ unsigned NumBlocks = Exit->topologicalFinalSort(Blocks, 0);
assert(static_cast<size_t>(NumBlocks) == Blocks.size());
(void) NumBlocks;
OpenPOWER on IntegriCloud