================
@@ -11335,6 +11335,13 @@ Value 
*CodeGenFunction::EmitAArch64SMEBuiltinExpr(unsigned BuiltinID,
       unsigned SMEAttrs = FPT->getAArch64SMEAttributes();
       if (!(SMEAttrs & FunctionType::SME_PStateSMCompatibleMask)) {
         bool IsStreaming = SMEAttrs & FunctionType::SME_PStateSMEnabledMask;
+        // Emit the llvm.assume intrinsic so that called functions can use the
+        // streaming mode information discerned here
+        Value *call =
+            Builder.CreateCall(CGM.getIntrinsic(Builtin->LLVMIntrinsic));
+        if (!IsStreaming)
+          call = Builder.CreateNot(call);
+        Builder.CreateIntrinsic(Intrinsic::assume, {}, {call});
----------------
sdesmalen-arm wrote:
Emitting the llvm.assume only for calls to `__arm_in_streaming_mode()` only has 
any effect if it is followed by a call to a streaming-compatible function.

To make this more useful generically, I think it needs to be emitted before any 
call from a streaming- or non-streaming function, to a streaming-compatible 
function. Then the partial-inliner, ipsccp pass, or function specialization 
pass can use the information to specialize or inline the callee.

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

Reply via email to