[llvm] [CodeGen][ProfCheck] Mark scalable intrinsic expansion loop with unknown weights (PR #225050)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 02:26:14 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Mattéo Rizza Murgier (matteo-rm)

<details>
<summary>Changes</summary>

`lowerUnaryVectorIntrinsicAsLoop` scalarizes scalable vector intrinsics into a loop whose trip count depends on vscale and cannot be known at compile time. This PR marks the loop branch weights as unknown. Fixes the profcheck bot failing on aarch64 `expand-*.ll` tests (c.f. #<!-- -->223614).

---
Full diff: https://github.com/llvm/llvm-project/pull/225050.diff


2 Files Affected:

- (modified) llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp (+3-1) 
- (modified) llvm/utils/profcheck-xfail.txt (-4) 


``````````diff
diff --git a/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp b/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp
index b4d17f18a687f2..676b3af94bfe71 100644
--- a/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp
+++ b/llvm/lib/Transforms/Utils/LowerVectorIntrinsics.cpp
@@ -9,6 +9,7 @@
 #include "llvm/Transforms/Utils/LowerVectorIntrinsics.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ProfDataUtils.h"
 
 #define DEBUG_TYPE "lower-vector-intrinsics"
 
@@ -73,7 +74,8 @@ bool llvm::lowerUnaryVectorIntrinsicAsLoop(Module &M, CallInst *CI) {
 
   Value *ExitCond =
       LoopBuilder.CreateICmp(CmpInst::ICMP_EQ, NextLoopIndex, LoopEnd);
-  LoopBuilder.CreateCondBr(ExitCond, PostLoopBB, LoopBB);
+  CondBrInst *Br = LoopBuilder.CreateCondBr(ExitCond, PostLoopBB, LoopBB);
+  setExplicitlyUnknownBranchWeightsIfProfiled(*Br, DEBUG_TYPE);
 
   Value *Res = NewVecs[0];
   if (StructRetTy) {
diff --git a/llvm/utils/profcheck-xfail.txt b/llvm/utils/profcheck-xfail.txt
index f316ccc0a325bd..530255af2894e6 100644
--- a/llvm/utils/profcheck-xfail.txt
+++ b/llvm/utils/profcheck-xfail.txt
@@ -95,10 +95,6 @@ Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll
 Transforms/OpenMP/spmdization_indirect.ll
 Transforms/OpenMP/spmdization_no_guarding_two_reaching_kernels.ll
 Transforms/OpenMP/spmdization_remarks.ll
-Transforms/PreISelIntrinsicLowering/AArch64/expand-exp.ll
-Transforms/PreISelIntrinsicLowering/AArch64/expand-fp-math.ll
-Transforms/PreISelIntrinsicLowering/AArch64/expand-log.ll
-Transforms/PreISelIntrinsicLowering/AArch64/expand-multi-result.ll
 Transforms/StackProtector/cross-dso-cfi-stack-chk-fail.ll
 Transforms/TailCallElim/2010-06-26-MultipleReturnValues.ll
 Transforms/TailCallElim/accum_recursion.ll

``````````

</details>


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


More information about the llvm-commits mailing list