Skip to content

Commit f89586e

Browse files
sdesmalen-armwwwatermiao
authored andcommitted
[AArch64][SME] Fix inlining bug introduced in #78703 (#79994)
Calling a `__arm_locally_streaming` function from a function that is not a streaming-SVE function would lead to incorrect inlining. The issue didn't surface because the tests were not testing what they were supposed to test. Signed-off-by: chenmiao <[email protected]> Signed-off-by: chenmiao <[email protected]>
1 parent 55e6ba4 commit f89586e

File tree

2 files changed

+194
-190
lines changed

2 files changed

+194
-190
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,20 @@ static bool hasPossibleIncompatibleOps(const Function *F) {
221221

222222
bool AArch64TTIImpl::areInlineCompatible(const Function *Caller,
223223
const Function *Callee) const {
224-
SMEAttrs CallerAttrs(*Caller);
225-
SMEAttrs CalleeAttrs(*Callee);
224+
SMEAttrs CallerAttrs(*Caller), CalleeAttrs(*Callee);
225+
226+
// When inlining, we should consider the body of the function, not the
227+
// interface.
228+
if (CalleeAttrs.hasStreamingBody()) {
229+
CalleeAttrs.set(SMEAttrs::SM_Compatible, false);
230+
CalleeAttrs.set(SMEAttrs::SM_Enabled, true);
231+
}
232+
226233
if (CalleeAttrs.hasNewZABody())
227234
return false;
228235

229236
if (CallerAttrs.requiresLazySave(CalleeAttrs) ||
230-
(CallerAttrs.requiresSMChange(CalleeAttrs) &&
231-
(!CallerAttrs.hasStreamingInterfaceOrBody() ||
232-
!CalleeAttrs.hasStreamingBody()))) {
237+
CallerAttrs.requiresSMChange(CalleeAttrs)) {
233238
if (hasPossibleIncompatibleOps(Callee))
234239
return false;
235240
}

0 commit comments

Comments
 (0)