git: f3457ed94241 - main - Tentatively merge llvm fix for buildworld WITH_ASAN

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 28 Oct 2024 17:35:19 UTC
The branch main has been updated by dim:

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

commit f3457ed94241be9d4c2c3ab337c9086d5c45c43f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-10-28 17:33:49 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-28 17:34:58 +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
---
 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 27360d0e84cb..5d81658409da 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp
+++ b/contrib/llvm-project/llvm/lib/Analysis/StackSafetyAnalysis.cpp
@@ -528,7 +528,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;
         }