[llvm-branch-commits] [llvm] [InstCombine][profcheck] Propogate profile metadata when transforming br (X && !Y) to br (!X || Y) (PR #175939)
Mircea Trofin via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jan 14 10:46:02 PST 2026
================
@@ -4233,6 +4234,17 @@ Instruction *InstCombinerImpl::visitBranchInst(BranchInst &BI) {
m_OneUse(m_LogicalAnd(m_Value(X), m_OneUse(m_Not(m_Value(Y))))))) {
Value *NotX = Builder.CreateNot(X, "not." + X->getName());
Value *Or = Builder.CreateLogicalOr(NotX, Y);
+ if (!ProfcheckDisableMetadataFixes) {
+ if (auto *OrInst = dyn_cast<Instruction>(Or)) {
+ if (auto *CondInst = dyn_cast<Instruction>(Cond)) {
+ SmallVector<uint32_t> Weights;
+ if (extractBranchWeights(*CondInst, Weights) && Weights.size() == 2) {
----------------
mtrofin wrote:
`assert(Weights.size() == 2)`? (like why would it not be 2)
https://github.com/llvm/llvm-project/pull/175939
More information about the llvm-branch-commits
mailing list