Skip to content

Commit 16d5675

Browse files
committed
Updates adhering the commit suggestion
1 parent 1563edc commit 16d5675

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ llvm::SplitKnownCriticalEdge(Instruction *TI, unsigned SuccNum,
205205
}
206206
}
207207

208-
unsigned NumSplittedIdenticalEdges = 1;
208+
unsigned NumSplitIdenticalEdges = 1;
209209

210210
// If there are any other edges from TIBB to DestBB, update those to go
211211
// through the split block, making those edges non-critical as well (and
@@ -220,8 +220,8 @@ llvm::SplitKnownCriticalEdge(Instruction *TI, unsigned SuccNum,
220220
// We found another edge to DestBB, go to NewBB instead.
221221
TI->setSuccessor(i, NewBB);
222222

223-
// Record the number of splitted identical edges to DestBB.
224-
NumSplittedIdenticalEdges++;
223+
// Record the number of split identical edges to DestBB.
224+
NumSplitIdenticalEdges++;
225225
}
226226
}
227227

@@ -293,11 +293,11 @@ llvm::SplitKnownCriticalEdge(Instruction *TI, unsigned SuccNum,
293293

294294
// Update LCSSA form in the newly created exit block.
295295
if (Options.PreserveLCSSA) {
296-
// If > 1 identical edges to be splitted, we need to introduce
297-
// the incoming blocks of the same number for the new PHINode.
296+
// If > 1 identical edges to be split, we need to introduce the
297+
// incoming blocks of the same number for the new PHINode.
298298
createPHIsForSplitLoopExit(
299-
SmallVector<BasicBlock *, 4>(NumSplittedIdenticalEdges, TIBB),
300-
NewBB, DestBB);
299+
SmallVector<BasicBlock *, 4>(NumSplitIdenticalEdges, TIBB), NewBB,
300+
DestBB);
301301
}
302302

303303
if (!LoopPreds.empty()) {

llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,15 @@ define void @crit_edge(i1 %cond0, i1 %cond1) {
441441
TEST(BasicBlockUtils, SplitLoopCriticalEdge) {
442442
LLVMContext C;
443443
std::unique_ptr<Module> M = parseIR(C, R"IR(
444-
declare dso_local i1 @predicate(ptr noundef %p)
444+
declare i1 @predicate(ptr %p)
445445
446-
define dso_local ptr @Parse(ptr noundef %gp) {
446+
define ptr @Parse(ptr %gp) {
447447
entry:
448448
br label %for.inc
449449
450450
for.inc:
451451
%phi = phi ptr [ %gp, %entry ], [ %cp, %while.cond ], [ %cp, %while.cond ]
452-
%cond = call i1 @predicate(ptr noundef %phi)
452+
%cond = call i1 @predicate(ptr %phi)
453453
%inc= getelementptr inbounds i8, ptr %phi, i64 1
454454
br i1 %cond, label %while.cond, label %exit
455455
@@ -462,7 +462,7 @@ while.cond:
462462
]
463463
464464
while.body:
465-
%incdec= getelementptr inbounds i8, ptr %cp, i64 1
465+
%incdec = getelementptr inbounds i8, ptr %cp, i64 1
466466
br label %while.cond
467467
468468
exit:
@@ -482,17 +482,17 @@ while.body:
482482
BasicBlock *WhileBB = getBasicBlockByName(*F, "while.cond");
483483
BasicBlock *SplitBB = WhileBB->getTerminator()->getSuccessor(1);
484484
// The only 1 successor of SplitBB is %for.inc
485-
ASSERT_EQ(1u, SplitBB->getTerminator()->getNumSuccessors());
485+
EXPECT_EQ(1u, SplitBB->getTerminator()->getNumSuccessors());
486486
// MergeIdenticalEdges: SplitBB has two identical predecessors, %while.cond.
487-
ASSERT_EQ(WhileBB, SplitBB->getUniquePredecessor());
488-
ASSERT_EQ(true, SplitBB->hasNPredecessors(2));
487+
EXPECT_EQ(WhileBB, SplitBB->getUniquePredecessor());
488+
EXPECT_TRUE(SplitBB->hasNPredecessors(2));
489489

490-
PHINode *PN = dyn_cast<PHINode>(&(SplitBB->front()));
490+
auto *PN = dyn_cast<PHINode>(&SplitBB->front());
491491
// PreserveLCSSA: should insert a PHI node in front of SplitBB
492-
ASSERT_NE(nullptr, PN);
492+
EXPECT_EQ(nullptr, PN);
493493
// The PHI node should have 2 identical incoming blocks.
494-
ASSERT_EQ(2u, PN->getNumIncomingValues());
495-
ASSERT_EQ(PN->getIncomingBlock(0), PN->getIncomingBlock(1));
494+
EXPECT_EQ(2u, PN->getNumIncomingValues());
495+
EXPECT_EQ(PN->getIncomingBlock(0), PN->getIncomingBlock(1));
496496
}
497497

498498
TEST(BasicBlockUtils, SplitIndirectBrCriticalEdgesIgnorePHIs) {

0 commit comments

Comments
 (0)