[llvm] [InstCombine] Fix profile propagation in intrinsic-select.ll (PR #228295)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 18:11:23 PDT 2026


================
@@ -3367,7 +3367,10 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
                            : (isa<Constant>(TVal) && isa<Constant>(FVal))) {
         CallInst *AbsT = Builder.CreateCall(II->getCalledFunction(), {TVal});
         CallInst *AbsF = Builder.CreateCall(II->getCalledFunction(), {FVal});
-        SelectInst *SI = SelectInst::Create(Cond, AbsT, AbsF);
+        // Given the condition is the same, we pull metadata (particularly
+        // profile metadata) from the original select instruction.
+        SelectInst *SI = SelectInst::Create(Cond, AbsT, AbsF, "", nullptr,
+                                            cast<Instruction>(Arg));
----------------
mtrofin wrote:

Ablation?

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


More information about the llvm-commits mailing list