https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/162726
>From 7be6926500ccb32838fc1ccd1f0909435a968a42 Mon Sep 17 00:00:00 2001 From: Mircea Trofin <[email protected]> Date: Thu, 9 Oct 2025 12:57:39 -0700 Subject: [PATCH] [InstCombine] Mark as unknown the branch weights of packed integer selecting shifts --- .../Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index 127a506e440b7..eb03f16e89e03 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -16,6 +16,7 @@ #include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/PatternMatch.h" +#include "llvm/IR/ProfDataUtils.h" #include "llvm/Support/KnownBits.h" #include "llvm/Transforms/InstCombine/InstCombiner.h" @@ -108,6 +109,11 @@ static Value *simplifyShiftSelectingPackedElement(Instruction *I, IC.Builder.CreateICmpEQ(ShrAmt, Constant::getNullValue(ShrAmt->getType()), ShrAmt->getName() + ".z"); Value *Select = IC.Builder.CreateSelect(ShrAmtZ, Lower, Upper); + // There is no existing !prof metadata we can derive the !prof metadata for + // this select. + if (auto *SI = dyn_cast<SelectInst>(Select)) + setExplicitlyUnknownBranchWeightsIfProfiled( + *SI, *SI->getParent()->getParent(), DEBUG_TYPE); Select->takeName(I); return Select; } _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
