[llvm] dce5d1f - [FMV][GlobalOpt] Do not statically resolve non-FMV callers. (#123383)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 12:33:15 PST 2025


Author: Alexandros Lamprineas
Date: 2025-01-17T20:33:11Z
New Revision: dce5d1fcb956e0218268dc1bf3e128bd2586df77

URL: https://github.com/llvm/llvm-project/commit/dce5d1fcb956e0218268dc1bf3e128bd2586df77
DIFF: https://github.com/llvm/llvm-project/commit/dce5d1fcb956e0218268dc1bf3e128bd2586df77.diff

LOG: [FMV][GlobalOpt] Do not statically resolve non-FMV callers. (#123383)

This fixes a runtime regression in the llvm testsuite:

https://lab.llvm.org/buildbot/#/builders/198/builds/1237

On clang-aarch64-sve2-vla:

predres
        FAIL

A 'predres' version is unexpectedly trapping on GravitonG4. My
explanation is that when the caller in not a versioned function, the
compiler exclusively relies on the command line option, or target
attribute to deduce whether a feature is available. However, there is no
guarantee that in reality the host supports those implied features.

This is a quickfix. We may rather change the mcpu option in the llvm
testsuite build instead.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/GlobalOpt.cpp
    llvm/test/Transforms/GlobalOpt/resolve-fmv-ifunc.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index bf0cacc6224be8..eb97d8b4a74f35 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2785,8 +2785,16 @@ static bool OptimizeNonTrivialIFuncs(
       } else {
         // We can't reason much about non-FMV callers. Just pick the highest
         // priority callee if it matches, otherwise bail.
-        if (I > 0 || !implies(CallerBits, CalleeBits))
-          continue;
+        // if (I > 0 || !implies(CallerBits, CalleeBits))
+        //
+        // FIXME: This is causing a regression in the llvm test suite,
+        // specifically a 'predres' version is unexpectedly trapping on
+        // GravitonG4. My explanation is that when the caller in not a
+        // versioned function, the compiler exclusively relies on the
+        // command line option, or target attribute to deduce whether a
+        // feature is available. However, there is no guarantee that in
+        // reality the host supports those implied features.
+        continue;
       }
       auto &Calls = CallSites[Caller];
       for (CallBase *CS : Calls)

diff  --git a/llvm/test/Transforms/GlobalOpt/resolve-fmv-ifunc.ll b/llvm/test/Transforms/GlobalOpt/resolve-fmv-ifunc.ll
index 4b6a19d3f05cf5..fa817a8cbf417f 100644
--- a/llvm/test/Transforms/GlobalOpt/resolve-fmv-ifunc.ll
+++ b/llvm/test/Transforms/GlobalOpt/resolve-fmv-ifunc.ll
@@ -221,7 +221,7 @@ resolver_entry:
 define i32 @caller4() #8 {
 ; CHECK-LABEL: define i32 @caller4(
 ; CHECK-SAME: ) local_unnamed_addr #[[ATTR7:[0-9]+]] {
-; CHECK:    [[CALL:%.*]] = tail call i32 @test_non_fmv_caller._Maes()
+; CHECK:    [[CALL:%.*]] = tail call i32 @test_non_fmv_caller()
 ;
 entry:
   %call = tail call i32 @test_non_fmv_caller()


        


More information about the llvm-commits mailing list