[llvm-branch-commits] [clang] [KeyInstr][Clang] Do stmt atom (PR #134644)

Jeremy Morse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 22 16:31:24 PDT 2025


================
@@ -1242,9 +1242,17 @@ void CodeGenFunction::EmitDoStmt(const DoStmt &S,
   // As long as the condition is true, iterate the loop.
   if (EmitBoolCondBranch) {
     uint64_t BackedgeCount = getProfileCount(S.getBody()) - ParentCount;
-    Builder.CreateCondBr(
+    auto *I = Builder.CreateCondBr(
         BoolCondVal, LoopBody, LoopExit.getBlock(),
         createProfileWeightsForLoop(S.getCond(), BackedgeCount));
+
+    // Key Instructions: Emit the condition and branch as separate atoms to
+    // match existing loop stepping behaviour. FIXME: We could have the branch
----------------
jmorse wrote:

IMO "existing" should be expanded into what the stepping actually is, as this comment could unexpectedly go out of date.

https://github.com/llvm/llvm-project/pull/134644


More information about the llvm-branch-commits mailing list