[llvm] [InstCombine][profcheck] More fixes for missing branch data in InstCombineCompares.cpp (PR #178084)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 04:51:20 PST 2026


================
@@ -7833,12 +7833,16 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
       // Check whether comparison of TrueValues can be simplified
       if (Value *Res = simplifyICmpInst(Pred, A, C, SQ)) {
         Value *NewICMP = Builder.CreateICmp(Pred, B, D);
-        return SelectInst::Create(Cond, Res, NewICMP);
+        return SelectInst::Create(
+            Cond, Res, NewICMP, /*NameStr=*/"", /*InsertBefore=*/nullptr,
+            ProfcheckDisableMetadataFixes ? nullptr : cast<Instruction>(Op0));
----------------
dtcxzyw wrote:

`match(Op0, m_Select` guarantees that `Op0` is always a SelectInst.

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


More information about the llvm-commits mailing list