[clang] [clang][FMV][AArch64] Improve streaming mode compatibility. (PR #100181)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 24 07:01:21 PDT 2024


================
@@ -11145,7 +11148,24 @@ bool Sema::areMultiversionVariantFunctionsCompatible(
     FunctionType::ExtInfo OldTypeInfo = OldType->getExtInfo();
     FunctionType::ExtInfo NewTypeInfo = NewType->getExtInfo();
 
-    if (OldTypeInfo.getCC() != NewTypeInfo.getCC())
+    const auto *OldFPT = OldFD->getType()->getAs<FunctionProtoType>();
+    const auto *NewFPT = NewFD->getType()->getAs<FunctionProtoType>();
+
+    bool ArmStreamingCCMismatched = false;
+    // Locally streaming does not affect the calling convention.
+    if (OldFPT && NewFPT && !OldFD->hasAttr<ArmLocallyStreamingAttr>() &&
+        !NewFD->hasAttr<ArmLocallyStreamingAttr>()) {
----------------
sdesmalen-arm wrote:

I also think there is no need to disallow cases where one of the functions is `__arm_streaming_compatible`, e.g.

```
__attribute__((target_clones("sve", "simd"))) void n_callee(void) {}
__attribute__((target_version("sme2"))) void n_callee(void) __arm_streaming_compatible {}
__attribute__((target_version("default"))) void n_callee(void) {}

void s_caller(void) __arm_streaming {
  n_callee();
}
```
because all three versions of `n_callee` can be called from non-streaming mode, so from the perspective of the implementation of `s_caller`, it's fine for it to just do:
```
smstop
bl n_callee
smstart
```

https://github.com/llvm/llvm-project/pull/100181


More information about the cfe-commits mailing list