Skip to content

Conversation

@mtrofin
Copy link
Member

@mtrofin mtrofin commented Nov 13, 2025

We don't currently support profile metadata on selects where the condition is a vector.

Issue #147390

Copy link
Member Author

mtrofin commented Nov 13, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@mtrofin mtrofin marked this pull request as ready for review November 13, 2025 22:56
@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms labels Nov 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2025

@llvm/pr-subscribers-pgo

Author: Mircea Trofin (mtrofin)

Changes

We don't currently support profile metadata on selects where the condition is a vector.

Issue #147390


Patch is 66.16 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/167973.diff

3 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/ProfileVerify.cpp (+10-6)
  • (modified) llvm/test/Transforms/PGOProfile/profcheck-select.ll (+20-2)
  • (modified) llvm/utils/profcheck-xfail.txt (+649-679)
diff --git a/llvm/lib/Transforms/Utils/ProfileVerify.cpp b/llvm/lib/Transforms/Utils/ProfileVerify.cpp
index c578b4b839258..149c0879edcdd 100644
--- a/llvm/lib/Transforms/Utils/ProfileVerify.cpp
+++ b/llvm/lib/Transforms/Utils/ProfileVerify.cpp
@@ -102,9 +102,11 @@ bool ProfileInjector::inject() {
   for (auto &BB : F) {
     if (AnnotateSelect) {
       for (auto &I : BB) {
-        if (isa<SelectInst>(I) && !I.getMetadata(LLVMContext::MD_prof))
-          setBranchWeights(I, {SelectTrueWeight, SelectFalseWeight},
-                           /*IsExpected=*/false);
+        if (auto *SI = dyn_cast<SelectInst>(&I))
+          if (!SI->getCondition()->getType()->isVectorTy() &&
+              !I.getMetadata(LLVMContext::MD_prof))
+            setBranchWeights(I, {SelectTrueWeight, SelectFalseWeight},
+                             /*IsExpected=*/false);
       }
     }
     auto *Term = getTerminatorBenefitingFromMDProf(BB);
@@ -185,9 +187,11 @@ PreservedAnalyses ProfileVerifierPass::run(Function &F,
   for (const auto &BB : F) {
     if (AnnotateSelect) {
       for (const auto &I : BB)
-        if (isa<SelectInst>(I) && !I.getMetadata(LLVMContext::MD_prof))
-          F.getContext().emitError(
-              "Profile verification failed: select annotation missing");
+        if (auto *SI = dyn_cast<SelectInst>(&I))
+          if (!SI->getCondition()->getType()->isVectorTy() &&
+              !I.getMetadata(LLVMContext::MD_prof))
+            F.getContext().emitError(
+                "Profile verification failed: select annotation missing");
     }
     if (const auto *Term =
             ProfileInjector::getTerminatorBenefitingFromMDProf(BB))
diff --git a/llvm/test/Transforms/PGOProfile/profcheck-select.ll b/llvm/test/Transforms/PGOProfile/profcheck-select.ll
index 74bcb3f52428b..e6b3ddd42fcb0 100644
--- a/llvm/test/Transforms/PGOProfile/profcheck-select.ll
+++ b/llvm/test/Transforms/PGOProfile/profcheck-select.ll
@@ -15,7 +15,11 @@
 ; RUN: not opt -passes=prof-verify %t/verify-missing.ll 2>&1 | FileCheck %t/verify-missing.ll
 
 ; verify we can disable it. It's sufficient to see opt not failing. 
-; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 %t/verify-missing.ll
+; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 --disable-output %t/verify-missing.ll
+
+; verify vector selects without profiles are OK. It's sufficient opt doesn't fail.
+; RUN: opt -passes=prof-verify --disable-output %t/verify-vec.ll
+
 
 ;--- inject.ll
 declare void @foo(i32 %a);
@@ -24,8 +28,16 @@ define void @bar(i1 %c) {
   call void @foo(i32 %v)
   ret void
 }
+
+define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) {
+  %r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2
+  ret <2 x i32> %r
+}
+
 ; CHECK-LABEL: @bar
 ; CHECK: %v = select i1 %c, i32 1, i32 2, !prof !1
+; CHECK-LABEL: @vec
+; CHECK-NOT: select {{.*}} !prof
 ; CHECK: !0 = !{!"function_entry_count", i64 1000}
 ; CHECK: !1 = !{!"branch_weights", i32 2, i32 3}
 
@@ -64,4 +76,10 @@ define void @bar(i1 %c) !prof !0 {
   ret void
 }
 !0 = !{!"function_entry_count", i64 1000}
-; CHECK: Profile verification failed: select annotation missing
\ No newline at end of file
+; CHECK: Profile verification failed: select annotation missing
+
+;--- verify-vec.ll
+define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) !prof !{!"function_entry_count", i32 10} {
+  %r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2
+  ret <2 x i32> %r
+}
diff --git a/llvm/utils/profcheck-xfail.txt b/llvm/utils/profcheck-xfail.txt
index 10a7b62229b8d..04fc387425159 100644
--- a/llvm/utils/profcheck-xfail.txt
+++ b/llvm/utils/profcheck-xfail.txt
@@ -1,679 +1,649 @@
-Bitcode/fcmp-fast.ll
-Bitcode/flags.ll
-CodeGen/AArch64/cgdata-merge-local.ll
-CodeGen/AArch64/llvm-masked-gather-legal-for-sve.ll
-CodeGen/AArch64/llvm-masked-scatter-legal-for-sve.ll
-CodeGen/AArch64/selectopt-cast.ll
-CodeGen/AArch64/selectopt.ll
-CodeGen/ARM/loopvectorize_pr33804.ll
-CodeGen/ARM/sjljeh-swifterror.ll
-CodeGen/Hexagon/autohvx/interleave.ll
-CodeGen/Hexagon/loop-idiom/hexagon-memmove1.ll
-CodeGen/Hexagon/loop-idiom/hexagon-memmove2.ll
-CodeGen/Hexagon/loop-idiom/memmove-rt-check.ll
-CodeGen/Hexagon/masked_gather.ll
-CodeGen/NVPTX/lower-ctor-dtor.ll
-CodeGen/RISCV/zmmul.ll
-CodeGen/WebAssembly/memory-interleave.ll
-CodeGen/X86/AMX/amx-low-intrinsics.ll
-CodeGen/X86/masked_gather_scatter.ll
-CodeGen/X86/nocfivalue.ll
-DebugInfo/AArch64/ir-outliner.ll
-DebugInfo/assignment-tracking/X86/hotcoldsplit.ll
-DebugInfo/Generic/block-asan.ll
-DebugInfo/X86/asan_debug_info.ll
-LTO/X86/diagnostic-handler-remarks-with-hotness.ll
-Other/optimization-remarks-auto.ll
-Other/X86/debugcounter-partiallyinlinelibcalls.ll
-Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll
-Transforms/AtomicExpand/SPARC/partword.ll
-Transforms/Attributor/align.ll
-Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
-Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll
-Transforms/Attributor/ArgumentPromotion/2008-09-07-CGUpdate.ll
-Transforms/Attributor/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll
-Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll
-Transforms/Attributor/ArgumentPromotion/alignment.ll
-Transforms/Attributor/ArgumentPromotion/alloca-as.ll
-Transforms/Attributor/ArgumentPromotion/array.ll
-Transforms/Attributor/ArgumentPromotion/attrs.ll
-Transforms/Attributor/ArgumentPromotion/basictest.ll
-Transforms/Attributor/ArgumentPromotion/byval-2.ll
-Transforms/Attributor/ArgumentPromotion/byval.ll
-Transforms/Attributor/ArgumentPromotion/chained.ll
-Transforms/Attributor/ArgumentPromotion/control-flow2.ll
-Transforms/Attributor/ArgumentPromotion/crash.ll
-Transforms/Attributor/ArgumentPromotion/dbg.ll
-Transforms/Attributor/ArgumentPromotion/fp80.ll
-Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
-Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
-Transforms/Attributor/ArgumentPromotion/nonzero-address-spaces.ll
-Transforms/Attributor/ArgumentPromotion/pr27568.ll
-Transforms/Attributor/ArgumentPromotion/profile.ll
-Transforms/Attributor/ArgumentPromotion/reserve-tbaa.ll
-Transforms/Attributor/ArgumentPromotion/tail.ll
-Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
-Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll
-Transforms/Attributor/callgraph.ll
-Transforms/Attributor/call-simplify-pointer-info.ll
-Transforms/Attributor/internal-noalias.ll
-Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
-Transforms/Attributor/IPConstantProp/recursion.ll
-Transforms/Attributor/IPConstantProp/remove-call-inst.ll
-Transforms/Attributor/liveness.ll
-Transforms/Attributor/memory_locations.ll
-Transforms/Attributor/misc_crash.ll
-Transforms/Attributor/noalias.ll
-Transforms/Attributor/nodelete.ll
-Transforms/Attributor/nofpclass.ll
-Transforms/Attributor/nounwind.ll
-Transforms/Attributor/potential.ll
-Transforms/Attributor/range.ll
-Transforms/Attributor/reduced/clear_cached_analysis_for_deleted_functions.ll
-Transforms/Attributor/reduced/register_benchmark_test.ll
-Transforms/Attributor/undefined_behavior.ll
-Transforms/Attributor/value-simplify-gpu.ll
-Transforms/Attributor/value-simplify.ll
-Transforms/Attributor/value-simplify-local-remote.ll
-Transforms/Attributor/value-simplify-pointer-info.ll
-Transforms/Attributor/value-simplify-reachability.ll
-Transforms/BlockExtractor/extract-blocks.ll
-Transforms/BlockExtractor/extract-blocks-with-groups.ll
-Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
-Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
-Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
-Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
-Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
-Transforms/CodeExtractor/extract-assume.ll
-Transforms/CodeExtractor/input-value-debug.ll
-Transforms/CodeExtractor/LoopExtractor_alloca.ll
-Transforms/CodeExtractor/LoopExtractor_crash.ll
-Transforms/CodeExtractor/LoopExtractor_infinite.ll
-Transforms/CodeExtractor/LoopExtractor.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-constant-numerator.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-not-exact.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll
-Transforms/CodeGenPrepare/X86/vec-shift-inseltpoison.ll
-Transforms/CodeGenPrepare/X86/vec-shift.ll
-Transforms/Coroutines/coro-await-suspend-lower-invoke.ll
-Transforms/Coroutines/coro-await-suspend-lower.ll
-Transforms/Coroutines/coro-byval-param.ll
-Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
-Transforms/Coroutines/coro-debug-coro-frame.ll
-Transforms/Coroutines/coro-debug-dbg.values.ll
-Transforms/Coroutines/coro-debug-dbg.values-not_used_in_frame.ll
-Transforms/Coroutines/coro-debug-frame-variable.ll
-Transforms/Coroutines/coro-debug-O2.ll
-Transforms/Coroutines/coro-debug-spill-dbg.declare.ll
-Transforms/Coroutines/coro-materialize.ll
-Transforms/Coroutines/coro-noop.ll
-Transforms/Coroutines/coro-noop-pacbti.ll
-Transforms/Coroutines/coro-only-destroy-when-complete.ll
-Transforms/Coroutines/coro-spill-suspend.ll
-Transforms/Coroutines/coro-split-00.ll
-Transforms/Coroutines/coro-split-alloc.ll
-Transforms/Coroutines/coro-split-dbg-labels.ll
-Transforms/Coroutines/coro-split-final-suspend.ll
-Transforms/Coroutines/coro-split-hidden.ll
-Transforms/Coroutines/coro-split-musttail10.ll
-Transforms/Coroutines/coro-split-musttail12.ll
-Transforms/Coroutines/coro-split-musttail13.ll
-Transforms/Coroutines/coro-split-musttail1.ll
-Transforms/Coroutines/coro-split-musttail2.ll
-Transforms/Coroutines/coro-split-musttail3.ll
-Transforms/Coroutines/coro-split-musttail4.ll
-Transforms/Coroutines/coro-split-musttail5.ll
-Transforms/Coroutines/coro-split-musttail6.ll
-Transforms/Coroutines/coro-split-musttail7.ll
-Transforms/Coroutines/coro-split-musttail8.ll
-Transforms/Coroutines/coro-split-musttail9.ll
-Transforms/Coroutines/coro-split-musttail-chain-pgo-counter-promo.ll
-Transforms/Coroutines/coro-split-musttail.ll
-Transforms/Coroutines/coro-split-musttail-ppc64le.ll
-Transforms/Coroutines/coro-split-noinline.ll
-Transforms/Coroutines/no-suspend.ll
-Transforms/CorrelatedValuePropagation/cond-at-use.ll
-Transforms/CorrelatedValuePropagation/urem-expansion.ll
-Transforms/CorrelatedValuePropagation/urem.ll
-Transforms/CrossDSOCFI/basic.ll
-Transforms/CrossDSOCFI/cfi_functions.ll
-Transforms/CrossDSOCFI/thumb.ll
-Transforms/ExpandLargeDivRem/X86/sdiv129.ll
-Transforms/ExpandLargeDivRem/X86/srem129.ll
-Transforms/ExpandLargeDivRem/X86/udiv129.ll
-Transforms/ExpandLargeDivRem/X86/urem129.ll
-Transforms/ExpandLargeDivRem/X86/vector.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-fptosi129.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-fptoui129.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-si129tofp.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-ui129tofp.ll
-Transforms/ExpandMemCmp/AArch64/memcmp.ll
-Transforms/ExpandMemCmp/X86/memcmp.ll
-Transforms/ExpandMemCmp/X86/memcmp-x32.ll
-Transforms/ExpandVariadics/expand-va-intrinsic-split-linkage.ll
-Transforms/ExpandVariadics/expand-va-intrinsic-split-simple.ll
-Transforms/ExpandVariadics/intrinsics.ll
-Transforms/FixIrreducible/basic.ll
-Transforms/FixIrreducible/bug45623.ll
-Transforms/FixIrreducible/callbr.ll
-Transforms/FixIrreducible/nested.ll
-Transforms/FixIrreducible/switch.ll
-Transforms/GCOVProfiling/atomic-counter.ll
-Transforms/GCOVProfiling/exit-block.ll
-Transforms/GCOVProfiling/function-numbering.ll
-Transforms/GCOVProfiling/global-ctor.ll
-Transforms/GCOVProfiling/kcfi.ll
-Transforms/GCOVProfiling/kcfi-normalize.ll
-Transforms/GCOVProfiling/linezero.ll
-Transforms/GCOVProfiling/linkagename.ll
-Transforms/GCOVProfiling/module-flags.ll
-Transforms/GCOVProfiling/noprofile.ll
-Transforms/GCOVProfiling/nosanitize.ll
-Transforms/GCOVProfiling/reset.ll
-Transforms/GCOVProfiling/split-indirectbr-critical-edges.ll
-Transforms/GCOVProfiling/three-element-mdnode.ll
-Transforms/GCOVProfiling/version.ll
-Transforms/GlobalOpt/disable-globals-aa.ll
-Transforms/GlobalOpt/global-demotion.ll
-Transforms/GlobalOpt/globalvar-code-model.ll
-Transforms/GlobalOpt/large-int-crash.ll
-Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll
-Transforms/GlobalOpt/shrink-global-to-bool-opaque-ptrs.ll
-Transforms/GVN/debugloc-load-select.ll
-Transforms/GVN/load-through-select-dbg.ll
-Transforms/GVN/masked-load-store.ll
-Transforms/GVN/masked-load-store-no-mem-dep.ll
-Transforms/GVN/opaque-ptr.ll
-Transforms/GVN/pr69301.ll
-Transforms/GVN/pre-invalid-prof-metadata.ll
-Transforms/GVN/PRE/pre-load-through-select.ll
-Transforms/GVN/PRE/pre-loop-load-through-select.ll
-Transforms/HotColdSplit/addr-taken.ll
-Transforms/HotColdSplit/apply-noreturn-bonus.ll
-Transforms/HotColdSplit/assumption-cache-invalidation.ll
-Transforms/HotColdSplit/delete-use-without-def-dbg-val.ll
-Transforms/HotColdSplit/duplicate-phi-preds-crash.ll
-Transforms/HotColdSplit/eh-pads.ll
-Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
-Transforms/HotColdSplit/invalid-dbg-assign.ll
-Transforms/HotColdSplit/lifetime-markers-on-inputs-1.ll
-Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
-Transforms/HotColdSplit/lifetime-markers-on-inputs-3.ll
-Transforms/HotColdSplit/minsize.ll
-Transforms/HotColdSplit/multiple-exits.ll
-Transforms/HotColdSplit/musttail.ll
-Transforms/HotColdSplit/noreturn.ll
-Transforms/HotColdSplit/outline-cold-asm.ll
-Transforms/HotColdSplit/outline-disjoint-diamonds.ll
-Transforms/HotColdSplit/outline-if-then-else.ll
-Transforms/HotColdSplit/outline-inner-region.ll
-Transforms/HotColdSplit/outline-multiple-entry-region.ll
-Transforms/HotColdSplit/outline-outer-region.ll
-Transforms/HotColdSplit/outline-while-loop.ll
-Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
-Transforms/HotColdSplit/region-overlap.ll
-Transforms/HotColdSplit/resume.ll
-Transforms/HotColdSplit/retain-section.ll
-Transforms/HotColdSplit/section-splitting-custom.ll
-Transforms/HotColdSplit/section-splitting-default.ll
-Transforms/HotColdSplit/split-cold-2.ll
-Transforms/HotColdSplit/split-out-dbg-label.ll
-Transforms/HotColdSplit/split-out-dbg-val-of-arg.ll
-Transforms/HotColdSplit/split-phis-in-exit-blocks.ll
-Transforms/HotColdSplit/split-static-profile.ll
-Transforms/HotColdSplit/stale-assume-in-original-func.ll
-Transforms/HotColdSplit/succ-block-with-self-edge.ll
-Transforms/HotColdSplit/swifterror.ll
-Transforms/HotColdSplit/transfer-debug-info.ll
-Transforms/HotColdSplit/unwind.ll
-Transforms/HotColdSplit/update-split-loop-metadata.ll
-Transforms/IndirectBrExpand/basic.ll
-Transforms/IndVarSimplify/debugloc-rem-subst.ll
-Transforms/IndVarSimplify/eliminate-rem.ll
-Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
-Transforms/IndVarSimplify/pr45835.ll
-Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll
-Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
-Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll
-Transforms/InstCombine/AArch64/sve-intrinsic-sel.ll
-Transforms/InstCombine/AArch64/sve-intrinsic-simplify-binop.ll
-Transforms/InstCombine/AArch64/sve-intrinsic-simplify-shift.ll
-Transforms/InstCombine/add-mask.ll
-Transforms/InstCombine/add-shl-mul-umax.ll
-Transforms/InstCombine/and2.ll
-Transforms/InstCombine/and-fcmp.ll
-Transforms/InstCombine/and.ll
-Transforms/InstCombine/and-or-icmps.ll
-Transforms/InstCombine/apint-div1.ll
-Transforms/InstCombine/apint-div2.ll
-Transforms/InstCombine/ashr-demand.ll
-Transforms/InstCombine/atomic.ll
-Transforms/InstCombine/binop-cast.ll
-Transforms/InstCombine/binop-select-cast-of-select-cond.ll
-Transforms/InstCombine/binop-select.ll
-Transforms/InstCombine/bit-checks.ll
-Transforms/InstCombine/bitreverse.ll
-Transforms/InstCombine/branch.ll
-Transforms/InstCombine/builtin-dynamic-object-size.ll
-Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll
-Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll
-Transforms/InstCombine/cast-mul-select.ll
-Transforms/InstCombine/clamp-to-minmax.ll
-Transforms/InstCombine/conditional-negation.ll
-Transforms/InstCombine/cttz.ll
-Transforms/InstCombine/debuginfo-invert.ll
-Transforms/InstCombine/demorgan.ll
-Transforms/InstCombine/div.ll
-Transforms/InstCombine/div-shift.ll
-Transforms/InstCombine/fabs.ll
-Transforms/InstCombine/fcmp-select.ll
-Transforms/InstCombine/ffs-1.ll
-Transforms/InstCombine/ffs-i16.ll
-Transforms/InstCombine/fmul-bool.ll
-Transforms/InstCombine/fmul.ll
-Transforms/InstCombine/fneg.ll
-Transforms/InstCombine/fold-ctpop-of-not.ll
-Transforms/InstCombine/fold-ext-eq-c-with-op.ll
-Transforms/InstCombine/free-inversion.ll
-Transforms/InstCombine/icmp-and-lowbit-mask.ll
-Transforms/InstCombine/icmp.ll
-Transforms/InstCombine/icmp-mul-and.ll
-Transforms/InstCombine/icmp-of-and-x.ll
-Transforms/InstCombine/icmp-of-or-x.ll
-Transforms/InstCombine/icmp-select-implies-common-op.ll
-Transforms/InstCombine/icmp-select.ll
-Transforms/InstCombine/icmp-with-selects.ll
-Transforms/InstCombine/intrinsic-select.ll
-Transforms/InstCombine/ldexp-ext.ll
-Transforms/InstCombine/ldexp.ll
-Transforms/InstCombine/load-bitcast-select.ll
-Transforms/InstCombine/load.ll
-Transforms/InstCombine/load-select.ll
-Transforms/InstCombine/loadstore-metadata.ll
-Transforms/InstCombine/logical-select-inseltpoison.ll
-Transforms/InstCombine/logical-select.ll
-Transforms/InstCombine/lshr.ll
-Transforms/InstCombine/masked_intrinsics-inseltpoison.ll
-Transforms/InstCombine/masked_intrinsics.ll
-Transforms/InstCombine/memchr-11.ll
-Transforms/InstCombine/memchr-2.ll
-Transforms/InstCombine/memchr-3.ll
-Transforms/InstCombine/memchr-6.ll
-Transforms/InstCombine/memchr-7.ll
-Transforms/InstCombine/memchr-9.ll
-Transforms/InstCombine/memchr.ll
-Transforms/InstCombine/mem-gep-zidx.ll
-Transforms/InstCombine/memrchr-3.ll
-Transforms/InstCombine/memrchr-4.ll
-Transforms/InstCombine/minmax-fold.ll
-Transforms/InstCombine/minmax-fp.ll
-Transforms/InstCombine/minmax-intrinsics.ll
-Transforms/InstCombine/mul-inseltpoison.ll
-Transforms/InstCombine/mul.ll
-Transforms/InstCombine/mul-masked-bits.ll
-Transforms/InstCombine/mul-pow2.ll
-Transforms/InstCombine/multiple-uses-load-bitcast-select.ll
-Transforms/InstCombine/narrow.ll
-Transforms/InstCombine/negated-bitmask.ll
-Transforms/InstCombine/nested-select.ll
-Transforms/InstCombine/not.ll
-Transforms/InstCombine/or-bitmask.ll
-Transforms/InstCombine/or-fcmp.ll
-Transforms/InstCombine/or.ll
-Transforms/InstCombine/pow-1.ll
-Transforms/InstCombine/pow-3.ll
-Transforms/InstCombine/pow-sqrt.ll
-Transforms/InstCombine/pull-conditional-binop-through-shift.ll
-Transforms/InstCombine/rem.ll
-Transforms/InstCombine/sdiv-canonicalize.ll
-Transforms/InstCombine/sdiv-guard.ll
-Transforms/InstCombine/select-and-or.ll
-Transforms/InstCombine/select-cmp-br.ll
-Transforms/InstCombine/select-cmp.ll
-Transforms/InstCombine/select-factorize.ll
-Transforms/InstCombine/select_frexp.ll
-Transforms/InstCombine/select.ll
-Transforms/InstCombine/select-min-max.ll
-Transforms/InstCombine/select-of-symmetric-selects.ll
-Transforms/InstCombine/select-select.ll
-Transforms/InstCombine/shift.ll
-Transforms/InstCombine/shuffle-select-narrow-inseltpoison.ll
-Transforms/InstCombine/shuffle-select-narrow.ll
-Transforms/InstCombine/simplify-demanded-fpclass.ll
-Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll
-Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll
-Transforms/InstCombine/sink-not-into-logical-and.ll
-Transforms/InstCombine/sink-not-into-logical-or.ll
-Transforms/InstCombine/strchr-1.ll
-Transforms/InstCombine/strchr-3.ll
-Transforms/InstCombine/strlen-1.ll
-Transforms/InstCombine/strrchr-3.ll
-Transforms/InstCombine/sub-ashr-and-to-icmp-select.ll
-Transforms/InstCombine/sub-ashr-or-to-icmp-select.ll
-Transforms/InstCombine/sub-xor-cmp.ll
-Transforms/InstCombine/truncating-saturate.ll
-Transforms/InstCombine/unordered-fcmp-select.ll
-Transforms/InstCombine/urem-via-cmp-select.ll
-Transforms/InstCombine/vec_sext.ll
-Transforms/InstCombine/vector-urem.ll
-Transforms/InstCombine/wcslen-1.ll
-Transforms/InstCombine/wcslen-3.ll
-Transforms/InstCombine/X86/blend_x86.ll
-Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
-Transforms/InstCombine/X86/x86-avx512.ll
-Transforms/InstCombine/xor-and-or.ll
-Transforms/InstComb...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Mircea Trofin (mtrofin)

Changes

We don't currently support profile metadata on selects where the condition is a vector.

Issue #147390


Patch is 66.16 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/167973.diff

3 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/ProfileVerify.cpp (+10-6)
  • (modified) llvm/test/Transforms/PGOProfile/profcheck-select.ll (+20-2)
  • (modified) llvm/utils/profcheck-xfail.txt (+649-679)
diff --git a/llvm/lib/Transforms/Utils/ProfileVerify.cpp b/llvm/lib/Transforms/Utils/ProfileVerify.cpp
index c578b4b839258..149c0879edcdd 100644
--- a/llvm/lib/Transforms/Utils/ProfileVerify.cpp
+++ b/llvm/lib/Transforms/Utils/ProfileVerify.cpp
@@ -102,9 +102,11 @@ bool ProfileInjector::inject() {
   for (auto &BB : F) {
     if (AnnotateSelect) {
       for (auto &I : BB) {
-        if (isa<SelectInst>(I) && !I.getMetadata(LLVMContext::MD_prof))
-          setBranchWeights(I, {SelectTrueWeight, SelectFalseWeight},
-                           /*IsExpected=*/false);
+        if (auto *SI = dyn_cast<SelectInst>(&I))
+          if (!SI->getCondition()->getType()->isVectorTy() &&
+              !I.getMetadata(LLVMContext::MD_prof))
+            setBranchWeights(I, {SelectTrueWeight, SelectFalseWeight},
+                             /*IsExpected=*/false);
       }
     }
     auto *Term = getTerminatorBenefitingFromMDProf(BB);
@@ -185,9 +187,11 @@ PreservedAnalyses ProfileVerifierPass::run(Function &F,
   for (const auto &BB : F) {
     if (AnnotateSelect) {
       for (const auto &I : BB)
-        if (isa<SelectInst>(I) && !I.getMetadata(LLVMContext::MD_prof))
-          F.getContext().emitError(
-              "Profile verification failed: select annotation missing");
+        if (auto *SI = dyn_cast<SelectInst>(&I))
+          if (!SI->getCondition()->getType()->isVectorTy() &&
+              !I.getMetadata(LLVMContext::MD_prof))
+            F.getContext().emitError(
+                "Profile verification failed: select annotation missing");
     }
     if (const auto *Term =
             ProfileInjector::getTerminatorBenefitingFromMDProf(BB))
diff --git a/llvm/test/Transforms/PGOProfile/profcheck-select.ll b/llvm/test/Transforms/PGOProfile/profcheck-select.ll
index 74bcb3f52428b..e6b3ddd42fcb0 100644
--- a/llvm/test/Transforms/PGOProfile/profcheck-select.ll
+++ b/llvm/test/Transforms/PGOProfile/profcheck-select.ll
@@ -15,7 +15,11 @@
 ; RUN: not opt -passes=prof-verify %t/verify-missing.ll 2>&1 | FileCheck %t/verify-missing.ll
 
 ; verify we can disable it. It's sufficient to see opt not failing. 
-; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 %t/verify-missing.ll
+; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 --disable-output %t/verify-missing.ll
+
+; verify vector selects without profiles are OK. It's sufficient opt doesn't fail.
+; RUN: opt -passes=prof-verify --disable-output %t/verify-vec.ll
+
 
 ;--- inject.ll
 declare void @foo(i32 %a);
@@ -24,8 +28,16 @@ define void @bar(i1 %c) {
   call void @foo(i32 %v)
   ret void
 }
+
+define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) {
+  %r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2
+  ret <2 x i32> %r
+}
+
 ; CHECK-LABEL: @bar
 ; CHECK: %v = select i1 %c, i32 1, i32 2, !prof !1
+; CHECK-LABEL: @vec
+; CHECK-NOT: select {{.*}} !prof
 ; CHECK: !0 = !{!"function_entry_count", i64 1000}
 ; CHECK: !1 = !{!"branch_weights", i32 2, i32 3}
 
@@ -64,4 +76,10 @@ define void @bar(i1 %c) !prof !0 {
   ret void
 }
 !0 = !{!"function_entry_count", i64 1000}
-; CHECK: Profile verification failed: select annotation missing
\ No newline at end of file
+; CHECK: Profile verification failed: select annotation missing
+
+;--- verify-vec.ll
+define <2 x i32> @vec(<2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2) !prof !{!"function_entry_count", i32 10} {
+  %r = select <2 x i1> %c, <2 x i32> %v1, <2 x i32> %v2
+  ret <2 x i32> %r
+}
diff --git a/llvm/utils/profcheck-xfail.txt b/llvm/utils/profcheck-xfail.txt
index 10a7b62229b8d..04fc387425159 100644
--- a/llvm/utils/profcheck-xfail.txt
+++ b/llvm/utils/profcheck-xfail.txt
@@ -1,679 +1,649 @@
-Bitcode/fcmp-fast.ll
-Bitcode/flags.ll
-CodeGen/AArch64/cgdata-merge-local.ll
-CodeGen/AArch64/llvm-masked-gather-legal-for-sve.ll
-CodeGen/AArch64/llvm-masked-scatter-legal-for-sve.ll
-CodeGen/AArch64/selectopt-cast.ll
-CodeGen/AArch64/selectopt.ll
-CodeGen/ARM/loopvectorize_pr33804.ll
-CodeGen/ARM/sjljeh-swifterror.ll
-CodeGen/Hexagon/autohvx/interleave.ll
-CodeGen/Hexagon/loop-idiom/hexagon-memmove1.ll
-CodeGen/Hexagon/loop-idiom/hexagon-memmove2.ll
-CodeGen/Hexagon/loop-idiom/memmove-rt-check.ll
-CodeGen/Hexagon/masked_gather.ll
-CodeGen/NVPTX/lower-ctor-dtor.ll
-CodeGen/RISCV/zmmul.ll
-CodeGen/WebAssembly/memory-interleave.ll
-CodeGen/X86/AMX/amx-low-intrinsics.ll
-CodeGen/X86/masked_gather_scatter.ll
-CodeGen/X86/nocfivalue.ll
-DebugInfo/AArch64/ir-outliner.ll
-DebugInfo/assignment-tracking/X86/hotcoldsplit.ll
-DebugInfo/Generic/block-asan.ll
-DebugInfo/X86/asan_debug_info.ll
-LTO/X86/diagnostic-handler-remarks-with-hotness.ll
-Other/optimization-remarks-auto.ll
-Other/X86/debugcounter-partiallyinlinelibcalls.ll
-Transforms/AtomicExpand/ARM/atomic-expansion-v7.ll
-Transforms/AtomicExpand/SPARC/partword.ll
-Transforms/Attributor/align.ll
-Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
-Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll
-Transforms/Attributor/ArgumentPromotion/2008-09-07-CGUpdate.ll
-Transforms/Attributor/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll
-Transforms/Attributor/ArgumentPromotion/aggregate-promote.ll
-Transforms/Attributor/ArgumentPromotion/alignment.ll
-Transforms/Attributor/ArgumentPromotion/alloca-as.ll
-Transforms/Attributor/ArgumentPromotion/array.ll
-Transforms/Attributor/ArgumentPromotion/attrs.ll
-Transforms/Attributor/ArgumentPromotion/basictest.ll
-Transforms/Attributor/ArgumentPromotion/byval-2.ll
-Transforms/Attributor/ArgumentPromotion/byval.ll
-Transforms/Attributor/ArgumentPromotion/chained.ll
-Transforms/Attributor/ArgumentPromotion/control-flow2.ll
-Transforms/Attributor/ArgumentPromotion/crash.ll
-Transforms/Attributor/ArgumentPromotion/dbg.ll
-Transforms/Attributor/ArgumentPromotion/fp80.ll
-Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll
-Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll
-Transforms/Attributor/ArgumentPromotion/nonzero-address-spaces.ll
-Transforms/Attributor/ArgumentPromotion/pr27568.ll
-Transforms/Attributor/ArgumentPromotion/profile.ll
-Transforms/Attributor/ArgumentPromotion/reserve-tbaa.ll
-Transforms/Attributor/ArgumentPromotion/tail.ll
-Transforms/Attributor/ArgumentPromotion/X86/attributes.ll
-Transforms/Attributor/ArgumentPromotion/X86/min-legal-vector-width.ll
-Transforms/Attributor/callgraph.ll
-Transforms/Attributor/call-simplify-pointer-info.ll
-Transforms/Attributor/internal-noalias.ll
-Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll
-Transforms/Attributor/IPConstantProp/recursion.ll
-Transforms/Attributor/IPConstantProp/remove-call-inst.ll
-Transforms/Attributor/liveness.ll
-Transforms/Attributor/memory_locations.ll
-Transforms/Attributor/misc_crash.ll
-Transforms/Attributor/noalias.ll
-Transforms/Attributor/nodelete.ll
-Transforms/Attributor/nofpclass.ll
-Transforms/Attributor/nounwind.ll
-Transforms/Attributor/potential.ll
-Transforms/Attributor/range.ll
-Transforms/Attributor/reduced/clear_cached_analysis_for_deleted_functions.ll
-Transforms/Attributor/reduced/register_benchmark_test.ll
-Transforms/Attributor/undefined_behavior.ll
-Transforms/Attributor/value-simplify-gpu.ll
-Transforms/Attributor/value-simplify.ll
-Transforms/Attributor/value-simplify-local-remote.ll
-Transforms/Attributor/value-simplify-pointer-info.ll
-Transforms/Attributor/value-simplify-reachability.ll
-Transforms/BlockExtractor/extract-blocks.ll
-Transforms/BlockExtractor/extract-blocks-with-groups.ll
-Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
-Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
-Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
-Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
-Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
-Transforms/CodeExtractor/extract-assume.ll
-Transforms/CodeExtractor/input-value-debug.ll
-Transforms/CodeExtractor/LoopExtractor_alloca.ll
-Transforms/CodeExtractor/LoopExtractor_crash.ll
-Transforms/CodeExtractor/LoopExtractor_infinite.ll
-Transforms/CodeExtractor/LoopExtractor.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-constant-numerator.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-not-exact.ll
-Transforms/CodeGenPrepare/NVPTX/bypass-slow-div-special-cases.ll
-Transforms/CodeGenPrepare/X86/vec-shift-inseltpoison.ll
-Transforms/CodeGenPrepare/X86/vec-shift.ll
-Transforms/Coroutines/coro-await-suspend-lower-invoke.ll
-Transforms/Coroutines/coro-await-suspend-lower.ll
-Transforms/Coroutines/coro-byval-param.ll
-Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
-Transforms/Coroutines/coro-debug-coro-frame.ll
-Transforms/Coroutines/coro-debug-dbg.values.ll
-Transforms/Coroutines/coro-debug-dbg.values-not_used_in_frame.ll
-Transforms/Coroutines/coro-debug-frame-variable.ll
-Transforms/Coroutines/coro-debug-O2.ll
-Transforms/Coroutines/coro-debug-spill-dbg.declare.ll
-Transforms/Coroutines/coro-materialize.ll
-Transforms/Coroutines/coro-noop.ll
-Transforms/Coroutines/coro-noop-pacbti.ll
-Transforms/Coroutines/coro-only-destroy-when-complete.ll
-Transforms/Coroutines/coro-spill-suspend.ll
-Transforms/Coroutines/coro-split-00.ll
-Transforms/Coroutines/coro-split-alloc.ll
-Transforms/Coroutines/coro-split-dbg-labels.ll
-Transforms/Coroutines/coro-split-final-suspend.ll
-Transforms/Coroutines/coro-split-hidden.ll
-Transforms/Coroutines/coro-split-musttail10.ll
-Transforms/Coroutines/coro-split-musttail12.ll
-Transforms/Coroutines/coro-split-musttail13.ll
-Transforms/Coroutines/coro-split-musttail1.ll
-Transforms/Coroutines/coro-split-musttail2.ll
-Transforms/Coroutines/coro-split-musttail3.ll
-Transforms/Coroutines/coro-split-musttail4.ll
-Transforms/Coroutines/coro-split-musttail5.ll
-Transforms/Coroutines/coro-split-musttail6.ll
-Transforms/Coroutines/coro-split-musttail7.ll
-Transforms/Coroutines/coro-split-musttail8.ll
-Transforms/Coroutines/coro-split-musttail9.ll
-Transforms/Coroutines/coro-split-musttail-chain-pgo-counter-promo.ll
-Transforms/Coroutines/coro-split-musttail.ll
-Transforms/Coroutines/coro-split-musttail-ppc64le.ll
-Transforms/Coroutines/coro-split-noinline.ll
-Transforms/Coroutines/no-suspend.ll
-Transforms/CorrelatedValuePropagation/cond-at-use.ll
-Transforms/CorrelatedValuePropagation/urem-expansion.ll
-Transforms/CorrelatedValuePropagation/urem.ll
-Transforms/CrossDSOCFI/basic.ll
-Transforms/CrossDSOCFI/cfi_functions.ll
-Transforms/CrossDSOCFI/thumb.ll
-Transforms/ExpandLargeDivRem/X86/sdiv129.ll
-Transforms/ExpandLargeDivRem/X86/srem129.ll
-Transforms/ExpandLargeDivRem/X86/udiv129.ll
-Transforms/ExpandLargeDivRem/X86/urem129.ll
-Transforms/ExpandLargeDivRem/X86/vector.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-fptosi129.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-fptoui129.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-si129tofp.ll
-Transforms/ExpandLargeFpConvert/X86/expand-large-fp-convert-ui129tofp.ll
-Transforms/ExpandMemCmp/AArch64/memcmp.ll
-Transforms/ExpandMemCmp/X86/memcmp.ll
-Transforms/ExpandMemCmp/X86/memcmp-x32.ll
-Transforms/ExpandVariadics/expand-va-intrinsic-split-linkage.ll
-Transforms/ExpandVariadics/expand-va-intrinsic-split-simple.ll
-Transforms/ExpandVariadics/intrinsics.ll
-Transforms/FixIrreducible/basic.ll
-Transforms/FixIrreducible/bug45623.ll
-Transforms/FixIrreducible/callbr.ll
-Transforms/FixIrreducible/nested.ll
-Transforms/FixIrreducible/switch.ll
-Transforms/GCOVProfiling/atomic-counter.ll
-Transforms/GCOVProfiling/exit-block.ll
-Transforms/GCOVProfiling/function-numbering.ll
-Transforms/GCOVProfiling/global-ctor.ll
-Transforms/GCOVProfiling/kcfi.ll
-Transforms/GCOVProfiling/kcfi-normalize.ll
-Transforms/GCOVProfiling/linezero.ll
-Transforms/GCOVProfiling/linkagename.ll
-Transforms/GCOVProfiling/module-flags.ll
-Transforms/GCOVProfiling/noprofile.ll
-Transforms/GCOVProfiling/nosanitize.ll
-Transforms/GCOVProfiling/reset.ll
-Transforms/GCOVProfiling/split-indirectbr-critical-edges.ll
-Transforms/GCOVProfiling/three-element-mdnode.ll
-Transforms/GCOVProfiling/version.ll
-Transforms/GlobalOpt/disable-globals-aa.ll
-Transforms/GlobalOpt/global-demotion.ll
-Transforms/GlobalOpt/globalvar-code-model.ll
-Transforms/GlobalOpt/large-int-crash.ll
-Transforms/GlobalOpt/shrink-global-to-bool-check-debug.ll
-Transforms/GlobalOpt/shrink-global-to-bool-opaque-ptrs.ll
-Transforms/GVN/debugloc-load-select.ll
-Transforms/GVN/load-through-select-dbg.ll
-Transforms/GVN/masked-load-store.ll
-Transforms/GVN/masked-load-store-no-mem-dep.ll
-Transforms/GVN/opaque-ptr.ll
-Transforms/GVN/pr69301.ll
-Transforms/GVN/pre-invalid-prof-metadata.ll
-Transforms/GVN/PRE/pre-load-through-select.ll
-Transforms/GVN/PRE/pre-loop-load-through-select.ll
-Transforms/HotColdSplit/addr-taken.ll
-Transforms/HotColdSplit/apply-noreturn-bonus.ll
-Transforms/HotColdSplit/assumption-cache-invalidation.ll
-Transforms/HotColdSplit/delete-use-without-def-dbg-val.ll
-Transforms/HotColdSplit/duplicate-phi-preds-crash.ll
-Transforms/HotColdSplit/eh-pads.ll
-Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
-Transforms/HotColdSplit/invalid-dbg-assign.ll
-Transforms/HotColdSplit/lifetime-markers-on-inputs-1.ll
-Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
-Transforms/HotColdSplit/lifetime-markers-on-inputs-3.ll
-Transforms/HotColdSplit/minsize.ll
-Transforms/HotColdSplit/multiple-exits.ll
-Transforms/HotColdSplit/musttail.ll
-Transforms/HotColdSplit/noreturn.ll
-Transforms/HotColdSplit/outline-cold-asm.ll
-Transforms/HotColdSplit/outline-disjoint-diamonds.ll
-Transforms/HotColdSplit/outline-if-then-else.ll
-Transforms/HotColdSplit/outline-inner-region.ll
-Transforms/HotColdSplit/outline-multiple-entry-region.ll
-Transforms/HotColdSplit/outline-outer-region.ll
-Transforms/HotColdSplit/outline-while-loop.ll
-Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
-Transforms/HotColdSplit/region-overlap.ll
-Transforms/HotColdSplit/resume.ll
-Transforms/HotColdSplit/retain-section.ll
-Transforms/HotColdSplit/section-splitting-custom.ll
-Transforms/HotColdSplit/section-splitting-default.ll
-Transforms/HotColdSplit/split-cold-2.ll
-Transforms/HotColdSplit/split-out-dbg-label.ll
-Transforms/HotColdSplit/split-out-dbg-val-of-arg.ll
-Transforms/HotColdSplit/split-phis-in-exit-blocks.ll
-Transforms/HotColdSplit/split-static-profile.ll
-Transforms/HotColdSplit/stale-assume-in-original-func.ll
-Transforms/HotColdSplit/succ-block-with-self-edge.ll
-Transforms/HotColdSplit/swifterror.ll
-Transforms/HotColdSplit/transfer-debug-info.ll
-Transforms/HotColdSplit/unwind.ll
-Transforms/HotColdSplit/update-split-loop-metadata.ll
-Transforms/IndirectBrExpand/basic.ll
-Transforms/IndVarSimplify/debugloc-rem-subst.ll
-Transforms/IndVarSimplify/eliminate-rem.ll
-Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
-Transforms/IndVarSimplify/pr45835.ll
-Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll
-Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
-Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll
-Transforms/InstCombine/AArch64/sve-intrinsic-sel.ll
-Transforms/InstCombine/AArch64/sve-intrinsic-simplify-binop.ll
-Transforms/InstCombine/AArch64/sve-intrinsic-simplify-shift.ll
-Transforms/InstCombine/add-mask.ll
-Transforms/InstCombine/add-shl-mul-umax.ll
-Transforms/InstCombine/and2.ll
-Transforms/InstCombine/and-fcmp.ll
-Transforms/InstCombine/and.ll
-Transforms/InstCombine/and-or-icmps.ll
-Transforms/InstCombine/apint-div1.ll
-Transforms/InstCombine/apint-div2.ll
-Transforms/InstCombine/ashr-demand.ll
-Transforms/InstCombine/atomic.ll
-Transforms/InstCombine/binop-cast.ll
-Transforms/InstCombine/binop-select-cast-of-select-cond.ll
-Transforms/InstCombine/binop-select.ll
-Transforms/InstCombine/bit-checks.ll
-Transforms/InstCombine/bitreverse.ll
-Transforms/InstCombine/branch.ll
-Transforms/InstCombine/builtin-dynamic-object-size.ll
-Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll
-Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll
-Transforms/InstCombine/cast-mul-select.ll
-Transforms/InstCombine/clamp-to-minmax.ll
-Transforms/InstCombine/conditional-negation.ll
-Transforms/InstCombine/cttz.ll
-Transforms/InstCombine/debuginfo-invert.ll
-Transforms/InstCombine/demorgan.ll
-Transforms/InstCombine/div.ll
-Transforms/InstCombine/div-shift.ll
-Transforms/InstCombine/fabs.ll
-Transforms/InstCombine/fcmp-select.ll
-Transforms/InstCombine/ffs-1.ll
-Transforms/InstCombine/ffs-i16.ll
-Transforms/InstCombine/fmul-bool.ll
-Transforms/InstCombine/fmul.ll
-Transforms/InstCombine/fneg.ll
-Transforms/InstCombine/fold-ctpop-of-not.ll
-Transforms/InstCombine/fold-ext-eq-c-with-op.ll
-Transforms/InstCombine/free-inversion.ll
-Transforms/InstCombine/icmp-and-lowbit-mask.ll
-Transforms/InstCombine/icmp.ll
-Transforms/InstCombine/icmp-mul-and.ll
-Transforms/InstCombine/icmp-of-and-x.ll
-Transforms/InstCombine/icmp-of-or-x.ll
-Transforms/InstCombine/icmp-select-implies-common-op.ll
-Transforms/InstCombine/icmp-select.ll
-Transforms/InstCombine/icmp-with-selects.ll
-Transforms/InstCombine/intrinsic-select.ll
-Transforms/InstCombine/ldexp-ext.ll
-Transforms/InstCombine/ldexp.ll
-Transforms/InstCombine/load-bitcast-select.ll
-Transforms/InstCombine/load.ll
-Transforms/InstCombine/load-select.ll
-Transforms/InstCombine/loadstore-metadata.ll
-Transforms/InstCombine/logical-select-inseltpoison.ll
-Transforms/InstCombine/logical-select.ll
-Transforms/InstCombine/lshr.ll
-Transforms/InstCombine/masked_intrinsics-inseltpoison.ll
-Transforms/InstCombine/masked_intrinsics.ll
-Transforms/InstCombine/memchr-11.ll
-Transforms/InstCombine/memchr-2.ll
-Transforms/InstCombine/memchr-3.ll
-Transforms/InstCombine/memchr-6.ll
-Transforms/InstCombine/memchr-7.ll
-Transforms/InstCombine/memchr-9.ll
-Transforms/InstCombine/memchr.ll
-Transforms/InstCombine/mem-gep-zidx.ll
-Transforms/InstCombine/memrchr-3.ll
-Transforms/InstCombine/memrchr-4.ll
-Transforms/InstCombine/minmax-fold.ll
-Transforms/InstCombine/minmax-fp.ll
-Transforms/InstCombine/minmax-intrinsics.ll
-Transforms/InstCombine/mul-inseltpoison.ll
-Transforms/InstCombine/mul.ll
-Transforms/InstCombine/mul-masked-bits.ll
-Transforms/InstCombine/mul-pow2.ll
-Transforms/InstCombine/multiple-uses-load-bitcast-select.ll
-Transforms/InstCombine/narrow.ll
-Transforms/InstCombine/negated-bitmask.ll
-Transforms/InstCombine/nested-select.ll
-Transforms/InstCombine/not.ll
-Transforms/InstCombine/or-bitmask.ll
-Transforms/InstCombine/or-fcmp.ll
-Transforms/InstCombine/or.ll
-Transforms/InstCombine/pow-1.ll
-Transforms/InstCombine/pow-3.ll
-Transforms/InstCombine/pow-sqrt.ll
-Transforms/InstCombine/pull-conditional-binop-through-shift.ll
-Transforms/InstCombine/rem.ll
-Transforms/InstCombine/sdiv-canonicalize.ll
-Transforms/InstCombine/sdiv-guard.ll
-Transforms/InstCombine/select-and-or.ll
-Transforms/InstCombine/select-cmp-br.ll
-Transforms/InstCombine/select-cmp.ll
-Transforms/InstCombine/select-factorize.ll
-Transforms/InstCombine/select_frexp.ll
-Transforms/InstCombine/select.ll
-Transforms/InstCombine/select-min-max.ll
-Transforms/InstCombine/select-of-symmetric-selects.ll
-Transforms/InstCombine/select-select.ll
-Transforms/InstCombine/shift.ll
-Transforms/InstCombine/shuffle-select-narrow-inseltpoison.ll
-Transforms/InstCombine/shuffle-select-narrow.ll
-Transforms/InstCombine/simplify-demanded-fpclass.ll
-Transforms/InstCombine/sink-not-into-another-hand-of-logical-and.ll
-Transforms/InstCombine/sink-not-into-another-hand-of-logical-or.ll
-Transforms/InstCombine/sink-not-into-logical-and.ll
-Transforms/InstCombine/sink-not-into-logical-or.ll
-Transforms/InstCombine/strchr-1.ll
-Transforms/InstCombine/strchr-3.ll
-Transforms/InstCombine/strlen-1.ll
-Transforms/InstCombine/strrchr-3.ll
-Transforms/InstCombine/sub-ashr-and-to-icmp-select.ll
-Transforms/InstCombine/sub-ashr-or-to-icmp-select.ll
-Transforms/InstCombine/sub-xor-cmp.ll
-Transforms/InstCombine/truncating-saturate.ll
-Transforms/InstCombine/unordered-fcmp-select.ll
-Transforms/InstCombine/urem-via-cmp-select.ll
-Transforms/InstCombine/vec_sext.ll
-Transforms/InstCombine/vector-urem.ll
-Transforms/InstCombine/wcslen-1.ll
-Transforms/InstCombine/wcslen-3.ll
-Transforms/InstCombine/X86/blend_x86.ll
-Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
-Transforms/InstCombine/X86/x86-avx512.ll
-Transforms/InstCombine/xor-and-or.ll
-Transforms/InstComb...
[truncated]

@mtrofin mtrofin force-pushed the users/mtrofin/11-13-_profcheck_disable_verification_of_selects_on_vector_conditions branch from 167be33 to e781a5a Compare November 13, 2025 22:57
Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor nits.

setBranchWeights(I, {SelectTrueWeight, SelectFalseWeight},
/*IsExpected=*/false);
if (auto *SI = dyn_cast<SelectInst>(&I))
if (!SI->getCondition()->getType()->isVectorTy() &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably more readable if we have a if (!SI->...->isVectorTy() { continue; }.

Copy link
Member Author

@mtrofin mtrofin Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would need more instructions, what am I missing.

"Profile verification failed: select annotation missing");
if (auto *SI = dyn_cast<SelectInst>(&I))
if (!SI->getCondition()->getType()->isVectorTy() &&
!I.getMetadata(LLVMContext::MD_prof))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


; verify we can disable it. It's sufficient to see opt not failing.
; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 %t/verify-missing.ll
; RUN: opt -passes=prof-verify -profcheck-annotate-select=0 --disable-output %t/verify-missing.ll
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we disabling output? It should just go nowhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you run the lit test at the command line, it gets printed out.

Copy link
Member Author

mtrofin commented Nov 14, 2025

Merge activity

  • Nov 14, 4:33 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Nov 14, 4:35 AM UTC: @mtrofin merged this pull request with Graphite.

@mtrofin mtrofin merged commit 815453f into main Nov 14, 2025
10 checks passed
@mtrofin mtrofin deleted the users/mtrofin/11-13-_profcheck_disable_verification_of_selects_on_vector_conditions branch November 14, 2025 04:35
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 14, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building llvm at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/42200

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: 1200 seconds without output running [b'ninja', b'check-flang'], attempting to kill
...
PASS: Flang :: Driver/mcmodel.f90 (3989 of 3999)
PASS: Flang :: Transforms/tbaa4.fir (3990 of 3999)
PASS: Flang :: Transforms/OpenACC/acc-implicit-data-fortran.F90 (3991 of 3999)
PASS: Flang :: Driver/use-module-error.f90 (3992 of 3999)
PASS: Flang :: Transforms/debug-dwarf-version.fir (3993 of 3999)
PASS: Flang :: Driver/use-module.f90 (3994 of 3999)
PASS: Flang :: Driver/fopenmp.f90 (3995 of 3999)
PASS: Flang :: Driver/omp-driver-offload.f90 (3996 of 3999)
PASS: Flang :: Driver/linker-options.f90 (3997 of 3999)
PASS: Flang :: Intrinsics/math-codegen.fir (3998 of 3999)
command timed out: 1200 seconds without output running [b'ninja', b'check-flang'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=2822.081247

boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Nov 14, 2025
I think this is quite a bit more readable than the nested conditionals.
From review feedback that was not addressed precommitn in llvm#167973.
boomanaiden154 added a commit that referenced this pull request Nov 14, 2025
I think this is quite a bit more readable than the nested conditionals.
From review feedback that was not addressed precommitn in #167973.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:transforms PGO Profile Guided Optimizations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants