Skip to content

Commit dce5d1f

Browse files
authored
[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.
1 parent e237e37 commit dce5d1f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

llvm/lib/Transforms/IPO/GlobalOpt.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2785,8 +2785,16 @@ static bool OptimizeNonTrivialIFuncs(
27852785
} else {
27862786
// We can't reason much about non-FMV callers. Just pick the highest
27872787
// priority callee if it matches, otherwise bail.
2788-
if (I > 0 || !implies(CallerBits, CalleeBits))
2789-
continue;
2788+
// if (I > 0 || !implies(CallerBits, CalleeBits))
2789+
//
2790+
// FIXME: This is causing a regression in the llvm test suite,
2791+
// specifically a 'predres' version is unexpectedly trapping on
2792+
// GravitonG4. My explanation is that when the caller in not a
2793+
// versioned function, the compiler exclusively relies on the
2794+
// command line option, or target attribute to deduce whether a
2795+
// feature is available. However, there is no guarantee that in
2796+
// reality the host supports those implied features.
2797+
continue;
27902798
}
27912799
auto &Calls = CallSites[Caller];
27922800
for (CallBase *CS : Calls)

llvm/test/Transforms/GlobalOpt/resolve-fmv-ifunc.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ resolver_entry:
221221
define i32 @caller4() #8 {
222222
; CHECK-LABEL: define i32 @caller4(
223223
; CHECK-SAME: ) local_unnamed_addr #[[ATTR7:[0-9]+]] {
224-
; CHECK: [[CALL:%.*]] = tail call i32 @test_non_fmv_caller._Maes()
224+
; CHECK: [[CALL:%.*]] = tail call i32 @test_non_fmv_caller()
225225
;
226226
entry:
227227
%call = tail call i32 @test_non_fmv_caller()

0 commit comments

Comments
 (0)