================
@@ -559,31 +559,86 @@ SemaARM::ArmStreamingType getArmStreamingFnType(const 
FunctionDecl *FD) {
   return SemaARM::ArmNonStreaming;
 }
 
-static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
-                                     const FunctionDecl *FD,
-                                     SemaARM::ArmStreamingType BuiltinType) {
+static bool checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall,
+                                     FunctionDecl *FD,
+                                     SemaARM::ArmStreamingType BuiltinType,
+                                     unsigned BuiltinID) {
   SemaARM::ArmStreamingType FnType = getArmStreamingFnType(FD);
-  if (BuiltinType == SemaARM::ArmStreamingOrSVE2p1) {
-    // Check intrinsics that are available in [sve2p1 or sme/sme2].
-    llvm::StringMap<bool> CallerFeatureMap;
-    S.Context.getFunctionFeatureMap(CallerFeatureMap, FD);
-    if (Builtin::evaluateRequiredTargetFeatures("sve2p1", CallerFeatureMap))
-      BuiltinType = SemaARM::ArmStreamingCompatible;
-    else
+
+  // Check if the intrinsic is available in the right mode, i.e.
+  // * When compiling for SME only, the caller must be in streaming mode.
+  // * When compiling for SVE only, the caller must be in non-streaming mode.
+  // * When compiling for both SVE and SME, the caller can be in either mode.
+  if (BuiltinType == SemaARM::VerifyRuntimeMode) {
+    static llvm::StringMap<bool> CallerFeatureMapWithoutSVE,
+        CallerFeatureMapWithoutSME;
----------------
paulwalker-arm wrote:

I hope I'm wrong but I think the use of static here is almost certainly bad 
because there's nothing stopping multiple threads from calling 
`checkArmStreamingBuiltin`. I looked for other instances but all I could find 
involved one time static initialisation after which the data is effectively 
constant.

Random Idea:
Rather than filtering the feature map you could process `BuiltinTargetGuards`, 
by which I mean you could split the guard into streaming and non-streaming 
(perhaps that's what `|` effectively means) and then you use whichever side is 
relevant to the function's mode of operation.

Of course you could just remove the cache and leave compile time as a worry for 
tomorrow.

https://github.com/llvm/llvm-project/pull/93802
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to