[llvm] [InstCombine] Set !prof metadata on Selects identified by add.ll test (PR #158743)

Alan Zhao via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 17:06:03 PDT 2025


================
@@ -1735,7 +1736,8 @@ Instruction *InstCombinerImpl::foldBinopOfSextBoolToSelect(BinaryOperator &BO) {
   Constant *Zero = ConstantInt::getNullValue(BO.getType());
   Value *TVal = Builder.CreateBinOp(BO.getOpcode(), Ones, C);
   Value *FVal = Builder.CreateBinOp(BO.getOpcode(), Zero, C);
-  return SelectInst::Create(X, TVal, FVal);
+  return createSelectInstMaybeWithUnknownBranchWeights(X, TVal, FVal,
+                                                       BO.getFunction());
----------------
alanzhao1 wrote:

Done (but I decided to just call this `createSelectInst(...)` as the function is usable when unknown branch weights are not appropriate).

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


More information about the llvm-commits mailing list