[llvm] [slp][profcheck] Mark `select`s as having unknown profile (PR #162960)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 11 00:59:48 PDT 2025


================
@@ -1002,6 +1003,18 @@ CallInst *IRBuilderBase::CreateConstrainedFPCall(
   return C;
 }
 
+Value *IRBuilderBase::CreateSelectWithUnknownProfile(Value *C, Value *True,
+                                                     Value *False,
+                                                     StringRef PassName,
+                                                     const Twine &Name) {
+  Value *Ret = CreateSelectFMF(C, True, False, {}, Name);
+  if (auto *SI = dyn_cast<SelectInst>(Ret)) {
+    setExplicitlyUnknownBranchWeightsIfProfiled(
+        *SI, *SI->getParent()->getParent(), PassName);
+  }
+  return Ret;
----------------
nikic wrote:

Could use this in https://github.com/llvm/llvm-project/commit/01e19e850ff40c2642da811c4dde58f323b1af1a as well -- the tradeoff being having to pass the pass name, but getting to keep IRBuilder usage. The pass name requirement is annoying.

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


More information about the llvm-commits mailing list