Skip to content

Commit 36efd64

Browse files
authored
Revert "[KeyInstr][Clang] For range stmt atoms (#134647)"
This reverts commit 1002436.
1 parent 52cf598 commit 36efd64

File tree

2 files changed

+1
-103
lines changed

2 files changed

+1
-103
lines changed

clang/lib/CodeGen/CGStmt.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,14 +1483,7 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
14831483
if (!Weights && CGM.getCodeGenOpts().OptimizationLevel)
14841484
BoolCondVal = emitCondLikelihoodViaExpectIntrinsic(
14851485
BoolCondVal, Stmt::getLikelihood(S.getBody()));
1486-
auto *I = Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights);
1487-
// Key Instructions: Emit the condition and branch as separate atoms to
1488-
// match existing loop stepping behaviour. FIXME: We could have the branch as
1489-
// the backup location for the condition, which would probably be a better
1490-
// experience.
1491-
if (auto *CondI = dyn_cast<llvm::Instruction>(BoolCondVal))
1492-
addInstToNewSourceAtom(CondI, nullptr);
1493-
addInstToNewSourceAtom(I, nullptr);
1486+
Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights);
14941487

14951488
if (ExitBlock != LoopExit.getBlock()) {
14961489
EmitBlock(ExitBlock);
@@ -1516,10 +1509,6 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
15161509
EmitStmt(S.getBody());
15171510
}
15181511

1519-
// The last block in the loop's body (which unconditionally branches to the
1520-
// `inc` block if there is one).
1521-
auto *FinalBodyBB = Builder.GetInsertBlock();
1522-
15231512
EmitStopPoint(&S);
15241513
// If there is an increment, emit it next.
15251514
EmitBlock(Continue.getBlock());
@@ -1543,10 +1532,6 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
15431532

15441533
if (CGM.shouldEmitConvergenceTokens())
15451534
ConvergenceTokenStack.pop_back();
1546-
1547-
// We want the for closing brace to be step-able on to match existing
1548-
// behaviour.
1549-
addInstToNewSourceAtom(FinalBodyBB->getTerminator(), nullptr);
15501535
}
15511536

15521537
void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) {

clang/test/DebugInfo/KeyInstructions/for-range.cpp

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)