Skip to content

Commit a2c0874

Browse files
committed
typo fixes
Signed-off-by: Nathan Gauër <[email protected]>
1 parent 9245c3c commit a2c0874

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,8 @@ static void processBlockAddr(MachineFunction &MF, SPIRVGlobalRegistry *GR,
816816
}
817817

818818
// For each instruction to fix, we replace all the G_BLOCK_ADDR operands by
819-
// the actual MBB it references. Once those references updated, we can cleanup
820-
// remaining G_BLOCK_ADDR references.
819+
// the actual MBB it references. Once those references have been updated, we
820+
// can cleanup remaining G_BLOCK_ADDR references.
821821
SmallPtrSet<MachineBasicBlock *, 8> ClearAddressTaken;
822822
SmallPtrSet<MachineInstr *, 8> ToEraseMI;
823823
MachineRegisterInfo &MRI = MF.getRegInfo();

llvm/lib/Target/SPIRV/SPIRVStructurizer.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const ConvergenceRegion *getRegionForHeader(const ConvergenceRegion *Node,
220220
}
221221

222222
// Returns the single BasicBlock exiting the convergence region `CR`,
223-
// nullptr if no such exit exists. F must be the function CR belongs to.
223+
// nullptr if no such exit exists.
224224
BasicBlock *getExitFor(const ConvergenceRegion *CR) {
225225
std::unordered_set<BasicBlock *> ExitTargets;
226226
for (BasicBlock *Exit : CR->Exits) {
@@ -285,7 +285,7 @@ bool hasLoopMergeInstruction(BasicBlock &BB) {
285285
return false;
286286
}
287287

288-
// Returns truye is I is an OpSelectionMerge or OpLoopMerge instruction, false
288+
// Returns true is I is an OpSelectionMerge or OpLoopMerge instruction, false
289289
// otherwise.
290290
bool isMergeInstruction(Instruction *I) {
291291
return getDesignatedMergeBlock(I) != nullptr;
@@ -413,7 +413,7 @@ void replaceIfBranchTargets(BasicBlock *BB, BasicBlock *OldTarget,
413413
C->destroyConstant();
414414
}
415415

416-
// Replaces the branching instruction destination of |BB| by |NewTarget| if it
416+
// Replaces the target of branch instruction in |BB| with |NewTarget| if it
417417
// was |OldTarget|. This function also fixes the associated merge instruction.
418418
// Note: this function does not simplify branching instructions, it only updates
419419
// targets. See also: simplifyBranches.
@@ -438,7 +438,7 @@ void replaceBranchTargets(BasicBlock *BB, BasicBlock *OldTarget,
438438
}
439439

440440
// Replaces basic bloc operands |OldSrc| or OpPhi instructions in |BB| by
441-
// |NewSrc|. This function does not simplifies the OpPhi instruction once
441+
// |NewSrc|. This function does not simplify the OpPhi instruction once
442442
// transformed.
443443
void replacePhiTargets(BasicBlock *BB, BasicBlock *OldSrc, BasicBlock *NewSrc) {
444444
for (PHINode &Phi : BB->phis()) {
@@ -462,8 +462,8 @@ class SPIRVStructurizer : public FunctionPass {
462462
using ConstructList = std::vector<std::unique_ptr<DivergentConstruct>>;
463463

464464
// Represents a divergent construct in the SPIR-V sense.
465-
// Such construct is represented by a header (entry), a merge block (exit),
466-
// and possible a continue block (back-edge). Each construct can contain other
465+
// Such constructs are represented by a header (entry), a merge block (exit),
466+
// and possibly a continue block (back-edge). A construct can contain other
467467
// constructs, but their boundaries do not cross.
468468
struct DivergentConstruct {
469469
BasicBlock *Header = nullptr;
@@ -491,13 +491,12 @@ class SPIRVStructurizer : public FunctionPass {
491491
DT.recalculate(F);
492492
}
493493

494-
// Returns the list of blocks that belongs to a SPIR-V continue construct.
494+
// Returns the list of blocks that belong to a SPIR-V continue construct.
495495
std::vector<BasicBlock *> getContinueConstructBlocks(BasicBlock *Header,
496496
BasicBlock *Continue) {
497497
std::vector<BasicBlock *> Output;
498498
Loop *L = LI.getLoopFor(Continue);
499-
BasicBlock *BackEdgeBlock = L->getLoopLatch();
500-
assert(BackEdgeBlock);
499+
assert(L->getLoopLatch() != nullptr);
501500

502501
partialOrderVisit(*Continue, [&](BasicBlock *BB) {
503502
if (BB == Header)
@@ -508,7 +507,7 @@ class SPIRVStructurizer : public FunctionPass {
508507
return Output;
509508
}
510509

511-
// Returns the list of blocks that belongs to a SPIR-V loop construct.
510+
// Returns the list of blocks that belong to a SPIR-V loop construct.
512511
std::vector<BasicBlock *> getLoopConstructBlocks(BasicBlock *Header,
513512
BasicBlock *Merge,
514513
BasicBlock *Continue) {
@@ -525,7 +524,7 @@ class SPIRVStructurizer : public FunctionPass {
525524
return Output;
526525
}
527526

528-
// Returns the list of blocks that belongs to a SPIR-V selection construct.
527+
// Returns the list of blocks that belong to a SPIR-V selection construct.
529528
std::vector<BasicBlock *>
530529
getSelectionConstructBlocks(DivergentConstruct *Node) {
531530
assert(DT.dominates(Node->Header, Node->Merge));
@@ -551,7 +550,7 @@ class SPIRVStructurizer : public FunctionPass {
551550
return Output;
552551
}
553552

554-
// Returns the list of blocks that belongs to a SPIR-V switch construct.
553+
// Returns the list of blocks that belong to a SPIR-V switch construct.
555554
std::vector<BasicBlock *> getSwitchConstructBlocks(BasicBlock *Header,
556555
BasicBlock *Merge) {
557556
assert(DT.dominates(Header, Merge));
@@ -571,7 +570,7 @@ class SPIRVStructurizer : public FunctionPass {
571570
return Output;
572571
}
573572

574-
// Returns the list of blocks that belongs to a SPIR-V case construct.
573+
// Returns the list of blocks that belong to a SPIR-V case construct.
575574
std::vector<BasicBlock *> getCaseConstructBlocks(BasicBlock *Target,
576575
BasicBlock *Merge) {
577576
assert(DT.dominates(Target, Merge));
@@ -597,12 +596,12 @@ class SPIRVStructurizer : public FunctionPass {
597596
//
598597
// clang-format off
599598
//
600-
// In SPIR-V, construct must have a single exit/merge.
601-
// Given A, B nodes in the construct, a C a node outside, with the following edges.
599+
// In SPIR-V, constructs must have a single exit/merge.
600+
// Given nodes A and B in the construct, a node C outside, and the following edges.
602601
// A -> C
603602
// B -> C
604603
//
605-
// In such cases, we must create a new exit node D, that belongs to the construct to make is viable:
604+
// In such cases, we must create a new exit node D, that belong to the construct to make is viable:
606605
// A -> D -> C
607606
// B -> D -> C
608607
//
@@ -839,11 +838,11 @@ class SPIRVStructurizer : public FunctionPass {
839838
return Modified;
840839
}
841840

842-
// When a block has multiple OpSelectionMerge/OpLoopMerge, sorts those
843-
// instructions to but the "largest" first. A merge instruction is defined as
844-
// larger than another when its target merge block post-dominates the other
845-
// target's merge block.
846-
// (This ordering should match the nesting ordering of the source HLSL).
841+
// When a block has multiple OpSelectionMerge/OpLoopMerge instructions, sorts
842+
// them to put the "largest" first. A merge instruction is defined as larger
843+
// than another when its target merge block post-dominates the other target's
844+
// merge block. (This ordering should match the nesting ordering of the source
845+
// HLSL).
847846
bool sortSelectionMerge(Function &F, BasicBlock &Block) {
848847
std::vector<Instruction *> MergeInstructions;
849848
for (Instruction &I : Block)
@@ -1159,8 +1158,8 @@ class SPIRVStructurizer : public FunctionPass {
11591158
return Modified;
11601159
}
11611160

1162-
// Makes sure every case target in |F| are unique. If 2 case branch to the
1163-
// same basic block, one of the target is updated so it jumps to a new basic
1161+
// Makes sure every case target in |F| is unique. If 2 cases branch to the
1162+
// same basic block, one of the targets is updated so it jumps to a new basic
11641163
// block ending with a single unconditional branch to the original target.
11651164
bool splitSwitchCases(Function &F) {
11661165
bool Modified = false;

0 commit comments

Comments
 (0)