[llvm] [NFC][InstCombine] Make use of `unknown` profile info clear in the API name (PR #162766)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 10 00:49:50 PDT 2025
================
@@ -470,15 +470,24 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
Value *simplifyNonNullOperand(Value *V, bool HasDereferenceable,
unsigned Depth = 0);
+ /// Create `select C, S1, S2` and copy metadata from MDFrom.
SelectInst *createSelectInst(Value *C, Value *S1, Value *S2,
+ const Instruction &MDFrom,
const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr,
- Instruction *MDFrom = nullptr) {
- SelectInst *SI =
- SelectInst::Create(C, S1, S2, NameStr, InsertBefore, MDFrom);
- if (!MDFrom)
- setExplicitlyUnknownBranchWeightsIfProfiled(*SI, F, DEBUG_TYPE);
- return SI;
+ InsertPosition InsertBefore = nullptr) {
+ return SelectInst::Create(C, S1, S2, NameStr, InsertBefore, &MDFrom);
+ }
----------------
nikic wrote:
I don't think we need this variant at all, can just use `SelectInst::Create` directly.
https://github.com/llvm/llvm-project/pull/162766
More information about the llvm-commits
mailing list