@@ -1483,14 +1483,7 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
1483
1483
if (!Weights && CGM.getCodeGenOpts ().OptimizationLevel )
1484
1484
BoolCondVal = emitCondLikelihoodViaExpectIntrinsic (
1485
1485
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);
1494
1487
1495
1488
if (ExitBlock != LoopExit.getBlock ()) {
1496
1489
EmitBlock (ExitBlock);
@@ -1516,10 +1509,6 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
1516
1509
EmitStmt (S.getBody ());
1517
1510
}
1518
1511
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
-
1523
1512
EmitStopPoint (&S);
1524
1513
// If there is an increment, emit it next.
1525
1514
EmitBlock (Continue.getBlock ());
@@ -1543,10 +1532,6 @@ CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
1543
1532
1544
1533
if (CGM.shouldEmitConvergenceTokens ())
1545
1534
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 );
1550
1535
}
1551
1536
1552
1537
void CodeGenFunction::EmitReturnOfRValue (RValue RV, QualType Ty) {
0 commit comments