[llvm-branch-commits] [clang] [KeyInstr][Clang] While stmt atom (PR #134645)
Jeremy Morse via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 22 16:42:23 PDT 2025
================
@@ -1130,7 +1130,14 @@ void CodeGenFunction::EmitWhileStmt(const WhileStmt &S,
if (!Weights && CGM.getCodeGenOpts().OptimizationLevel)
BoolCondVal = emitCondLikelihoodViaExpectIntrinsic(
BoolCondVal, Stmt::getLikelihood(S.getBody()));
- Builder.CreateCondBr(BoolCondVal, LoopBody, ExitBlock, Weights);
+ auto *I = Builder.CreateCondBr(BoolCondVal, LoopBody, ExitBlock, Weights);
+ // Key Instructions: Emit the condition and branch as separate atoms to
+ // match existing loop stepping behaviour. FIXME: We could have the branch
+ // as the backup location for the condition, which would probably be a
+ // better experience. Explore this later.
+ if (auto *I = dyn_cast<llvm::Instruction>(BoolCondVal))
+ addInstToNewSourceAtom(I, nullptr);
----------------
jmorse wrote:
Rename inner `I` to avoid shadowing the outer one?
https://github.com/llvm/llvm-project/pull/134645
More information about the llvm-branch-commits
mailing list