[llvm] [licm] clone metadata when hoisting conditional branch (PR #152232)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 14:50:04 PDT 2025
================
@@ -857,9 +857,19 @@ class ControlFlowHoister {
}
// Now finally clone BI.
- ReplaceInstWithInst(
- HoistTarget->getTerminator(),
- BranchInst::Create(HoistTrueDest, HoistFalseDest, BI->getCondition()));
+ auto *NewBI =
+ BranchInst::Create(HoistTrueDest, HoistFalseDest, BI->getCondition(),
+ HoistTarget->getTerminator()->getIterator());
+ HoistTarget->getTerminator()->eraseFromParent();
+ // Handle "performance-related" metadata. In particular:
----------------
snehasish wrote:
nit: Simplify the comment now that we only handle md prof in this patch? E.g. "Handle md_prof: it should also come ..."
https://github.com/llvm/llvm-project/pull/152232
More information about the llvm-commits
mailing list