git: 814ddb3c8cda - stable/13 - Tentatively merge llvm fix for buildworld WITH_ASAN

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 02 Nov 2024 19:41:10 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=814ddb3c8cda06686c5fe10f67b63bc2457e97b5

commit 814ddb3c8cda06686c5fe10f67b63bc2457e97b5
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-10-28 17:33:49 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-11-02 19:37:33 +0000

    Tentatively merge llvm fix for buildworld WITH_ASAN
    
    Building world using WITH_ASAN results in an assertion when compiling
    certain source files referencing ifuncs:
    
      Assertion failed: (isa<Function>(Callee) || isa<GlobalAlias>(Callee)), function analyzeAllUses, file /root/freebsd/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp, line 514.
    
    This was already reported upstream a while ago, in
    <https://github.com/llvm/llvm-project/issues/87923>, but now there is
    finally a candidate fix, which seems trivial so I am importing it right
    away.
    
    Reported by:    markj
    PR:             280936
    Pull Request:   https://github.com/llvm/llvm-project/pull/113841
    MFC after:      3 days
    
    (cherry picked from commit f3457ed94241be9d4c2c3ab337c9086d5c45c43f)
---
 contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp
index 19991c1a7bae..3973a48139aa 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp
@@ -506,7 +506,7 @@ void StackSafetyLocalAnalysis::analyzeAllUses(Value *Ptr,
         // dso_preemptable aliases or aliases with interposable linkage.
         const GlobalValue *Callee =
             dyn_cast<GlobalValue>(CB.getCalledOperand()->stripPointerCasts());
-        if (!Callee) {
+        if (!Callee || isa<GlobalIFunc>(Callee)) {
           US.addRange(I, UnknownRange, /*IsSafe=*/false);
           break;
         }