================
@@ -420,45 +420,53 @@ 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) {
+/// Lower a CIR `side_effect` to an LLVM memory effect. A null result means
+/// unknown effects, which is how `All` is represented. The argmem values
+/// lower to ModRef because they do not say whether the slot is read or
+/// written.
+static mlir::LLVM::MemoryEffectsAttr
+buildMemoryEffects(mlir::MLIRContext *ctx, cir::SideEffect sideEffect) {
using mlir::LLVM::ModRefInfo;
+ ModRefInfo other;
+ ModRefInfo argMem;
switch (sideEffect) {
case cir::SideEffect::All:
- memoryEffect = {};
- noUnwind = isNothrow;
- willReturn = false;
- break;
-
+ return {};
case cir::SideEffect::Pure:
- memoryEffect = mlir::LLVM::MemoryEffectsAttr::get(
- callOp->getContext(), /*other=*/ModRefInfo::Ref,
- /*argMem=*/ModRefInfo::Ref,
- /*inaccessibleMem=*/ModRefInfo::Ref,
- /*errnoMem=*/ModRefInfo::Ref,
- /*targetMem0=*/ModRefInfo::Ref,
- /*targetMem1=*/ModRefInfo::Ref);
- noUnwind = true;
- willReturn = true;
+ other = argMem = ModRefInfo::Ref;
break;
-
case cir::SideEffect::Const:
- memoryEffect = mlir::LLVM::MemoryEffectsAttr::get(
- callOp->getContext(), /*other=*/ModRefInfo::NoModRef,
- /*argMem=*/ModRefInfo::NoModRef,
- /*inaccessibleMem=*/ModRefInfo::NoModRef,
- /*errnoMem=*/ModRefInfo::NoModRef,
- /*targetMem0=*/ModRefInfo::NoModRef,
- /*targetMem1=*/ModRefInfo::NoModRef);
- noUnwind = true;
- willReturn = true;
+ other = argMem = ModRefInfo::NoModRef;
+ break;
+ case cir::SideEffect::PureArgMem:
----------------
andykaylor wrote:
I don't understand what "PureArgMem" means. "Pure" and "argmem: modref" are
contradictory.
https://github.com/llvm/llvm-project/pull/221067
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits