================
@@ -4670,6 +4670,62 @@ def CIR_StackRestoreOp : CIR_Op<"stackrestore"> {
let assemblyFormat = "$ptr attr-dict `:` qualified(type($ptr))";
}
+//===----------------------------------------------------------------------===//
+// LifetimeStartOp & LifetimeEndOp
+//===----------------------------------------------------------------------===//
+
+def CIR_LifetimeStartOp : CIR_Op<"lifetime.start"> {
+ let summary = "Marks the beginning of an alloca object's live range";
+ let description = [{
+ The `cir.lifetime.start` operation marks the beginning of the live range
+ of the memory region pointed to by `$ptr`. Between this operation and a
+ matching `cir.lifetime.end` on the same pointer, the underlying storage
+ is considered live; outside that range it is considered dead, and the
+ optimizer is free to reuse the storage for other purposes.
+
+ This operation exhibits undefined behavior if:
+ * `$ptr` does not point to memory allocated by `cir.alloca`; or
+ * no matching `cir.lifetime.end` reaches every control-flow path that
+ follows this operation.
+
+ This operation corresponds to the LLVM intrinsic `llvm.lifetime.start`.
+
+ Example:
+ ```
+ cir.lifetime.start %ptr : !cir.ptr<!void>
+ ```
+ }];
+
+ let arguments = (ins CIR_PointerType:$ptr);
+ let assemblyFormat = "$ptr attr-dict `:` qualified(type($ptr))";
+}
+
+def CIR_LifetimeEndOp : CIR_Op<"lifetime.end"> {
+ let summary = "Marks the end of an alloca object's live range";
+ let description = [{
+ The `cir.lifetime.end` operation marks the end of the live range of the
+ memory region pointed to by `$ptr`. After this operation the underlying
+ storage is considered dead until a subsequent `cir.lifetime.start` on
+ the same pointer; accesses to the storage in the dead range are
+ undefined behavior.
+
+ This operation exhibits undefined behavior if:
+ * `$ptr` does not point to memory allocated by `cir.alloca`; or
----------------
xlauko wrote:
Verify producer
https://github.com/llvm/llvm-project/pull/199599
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits