[clang] [CIR] Widen memory effects for ABI-introduced argument memory (PR #221067)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 10:57:27 PDT 2026


================
@@ -420,45 +410,66 @@ mlir::Value lowerCirAttrAsValue(mlir::Operation *parentOp,
   return value;
 }
 
-void convertSideEffectForCall(mlir::Operation *callOp, bool isNothrow,
-                              cir::SideEffect sideEffect,
-                              mlir::LLVM::MemoryEffectsAttr &memoryEffect,
-                              bool &noUnwind, bool &willReturn,
-                              bool &noReturn) {
+/// Whether the ABI hands the callee memory through a pointer argument: an
+/// sret slot for an indirect return, or byval / byref for an indirect
+/// argument.  Such a function reaches argument memory no matter what its
+/// source-level attributes say, so `const` and `pure` cannot lower to a
+/// memory effect that excludes it.
+static bool hasABIIndirectMemoryArg(mlir::ArrayAttr argAttrs) {
----------------
andykaylor wrote:

Why are we waiting until LowerToLLVM to do this? It seems like we should be updating the CIR side effects when we rewrite the function call.

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


More information about the cfe-commits mailing list