Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit c5e1c37

Browse files
committed
fix typos; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260130 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4ebe058 commit c5e1c37

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/Transforms/Utils/LoopUnrollRuntime.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void ConnectProlog(Loop *L, Value *BECount, unsigned Count,
110110
}
111111
}
112112

113-
// Create a branch around the orignal loop, which is taken if there are no
113+
// Create a branch around the original loop, which is taken if there are no
114114
// iterations remaining to be executed after running the prologue.
115115
Instruction *InsertPt = PrologEnd->getTerminator();
116116
IRBuilder<> B(InsertPt);
@@ -281,7 +281,7 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count,
281281
bool AllowExpensiveTripCount, LoopInfo *LI,
282282
ScalarEvolution *SE, DominatorTree *DT,
283283
bool PreserveLCSSA) {
284-
// for now, only unroll loops that contain a single exit
284+
// For now, only unroll loops that contain a single exit.
285285
if (!L->getExitingBlock())
286286
return false;
287287

@@ -290,21 +290,21 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count,
290290
if (!L->isLoopSimplifyForm() || !L->getUniqueExitBlock())
291291
return false;
292292

293-
// Use Scalar Evolution to compute the trip count. This allows more
294-
// loops to be unrolled than relying on induction var simplification
293+
// Use Scalar Evolution to compute the trip count. This allows more loops to
294+
// be unrolled than relying on induction var simplification.
295295
if (!SE)
296296
return false;
297297

298-
// Only unroll loops with a computable trip count and the trip count needs
299-
// to be an int value (allowing a pointer type is a TODO item)
298+
// Only unroll loops with a computable trip count, and the trip count needs
299+
// to be an int value (allowing a pointer type is a TODO item).
300300
const SCEV *BECountSC = SE->getBackedgeTakenCount(L);
301301
if (isa<SCEVCouldNotCompute>(BECountSC) ||
302302
!BECountSC->getType()->isIntegerTy())
303303
return false;
304304

305305
unsigned BEWidth = cast<IntegerType>(BECountSC->getType())->getBitWidth();
306306

307-
// Add 1 since the backedge count doesn't include the first loop iteration
307+
// Add 1 since the backedge count doesn't include the first loop iteration.
308308
const SCEV *TripCountSC =
309309
SE->getAddExpr(BECountSC, SE->getConstant(BECountSC->getType(), 1));
310310
if (isa<SCEVCouldNotCompute>(TripCountSC))
@@ -326,15 +326,15 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count,
326326
if (Log2_32(Count) > BEWidth)
327327
return false;
328328

329-
// If this loop is nested, then the loop unroller changes the code in
330-
// parent loop, so the Scalar Evolution pass needs to be run again
329+
// If this loop is nested, then the loop unroller changes the code in the
330+
// parent loop, so the Scalar Evolution pass needs to be run again.
331331
if (Loop *ParentLoop = L->getParentLoop())
332332
SE->forgetLoop(ParentLoop);
333333

334334
BasicBlock *PH = L->getLoopPreheader();
335335
BasicBlock *Latch = L->getLoopLatch();
336-
// It helps to splits the original preheader twice, one for the end of the
337-
// prolog code and one for a new loop preheader
336+
// It helps to split the original preheader twice, one for the end of the
337+
// prolog code and one for a new loop preheader.
338338
BasicBlock *PEnd = SplitEdge(PH, Header, DT, LI);
339339
BasicBlock *NewPH = SplitBlock(PEnd, PEnd->getTerminator(), DT, LI);
340340
BranchInst *PreHeaderBR = cast<BranchInst>(PH->getTerminator());
@@ -350,9 +350,9 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count,
350350
Value *ModVal = B.CreateAnd(TripCount, Count - 1, "xtraiter");
351351

352352
// If ModVal is zero, we know that either
353-
// 1. there are no iteration to be run in the prologue loop
353+
// 1. There are no iterations to be run in the prologue loop.
354354
// OR
355-
// 2. the addition computing TripCount overflowed
355+
// 2. The addition computing TripCount overflowed.
356356
//
357357
// If (2) is true, we know that TripCount really is (1 << BEWidth) and so the
358358
// number of iterations that remain to be run in the original loop is a
@@ -361,16 +361,16 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count,
361361

362362
Value *BranchVal = B.CreateIsNotNull(ModVal, "lcmp.mod");
363363

364-
// Branch to either the extra iterations or the cloned/unrolled loop
365-
// We will fix up the true branch label when adding loop body copies
364+
// Branch to either the extra iterations or the cloned/unrolled loop.
365+
// We will fix up the true branch label when adding loop body copies.
366366
B.CreateCondBr(BranchVal, PEnd, PEnd);
367367
assert(PreHeaderBR->isUnconditional() &&
368368
PreHeaderBR->getSuccessor(0) == PEnd &&
369369
"CFG edges in Preheader are not correct");
370370
PreHeaderBR->eraseFromParent();
371371
Function *F = Header->getParent();
372372
// Get an ordered list of blocks in the loop to help with the ordering of the
373-
// cloned blocks in the prolog code
373+
// cloned blocks in the prolog code.
374374
LoopBlocksDFS LoopBlocks(L);
375375
LoopBlocks.perform(LI);
376376

@@ -390,7 +390,7 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count,
390390
CloneLoopBlocks(L, ModVal, UnrollPrologue, PH, PEnd, NewBlocks, LoopBlocks,
391391
VMap, LI);
392392

393-
// Insert the cloned blocks into function just before the original loop
393+
// Insert the cloned blocks into the function just before the original loop.
394394
F->getBasicBlockList().splice(PEnd->getIterator(), F->getBasicBlockList(),
395395
NewBlocks[0]->getIterator(), F->end());
396396

0 commit comments

Comments
 (0)