[clang] [llvm] [IR] Make dead_on_return attribute optionally sized (PR #171712)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 9 01:48:37 PST 2026
================
@@ -60,6 +60,40 @@ enum class AllocFnKind : uint64_t {
LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ Aligned)
};
+class DeadOnReturnInfo {
+public:
+ DeadOnReturnInfo() : DeadBytes(std::nullopt) {}
+ DeadOnReturnInfo(uint64_t DeadOnReturnBytes) : DeadBytes(DeadOnReturnBytes) {}
+
+ uint64_t getNumberOfDeadBytes() {
+ assert(DeadBytes.has_value() &&
+ "This attribute does not specify a byte count. Did you forget to "
+ "check if the attribute covers all reachable memory?");
+ return DeadBytes.value();
+ }
+
+ bool coversAllReachableMemory() { return !DeadBytes.has_value(); }
----------------
antoniofrighetto wrote:
```suggestion
bool coversAllReachableMemory() const { return !DeadBytes.has_value(); }
```
https://github.com/llvm/llvm-project/pull/171712
More information about the llvm-commits
mailing list