[llvm] [NFCI][IR] Add optional DataLayout argument to zero and null value related APIs (PR #183208)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 09:54:25 PDT 2026


================
@@ -52,7 +53,10 @@ class Constant : public User {
   Constant(const Constant &) = delete;
 
   /// Return true if this is the value that would be returned by getNullValue.
-  LLVM_ABI bool isNullValue() const;
+  LLVM_ABI bool isNullValue(const DataLayout *DL = nullptr) const;
----------------
shiltian wrote:

well, we have to though, because the current `getNullValue` will simply return `ConstantAggregateZero` for any aggregate types, but this will no longer be the case after we change the semantics. We will have to recursively construct null/zero value accordingly.

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


More information about the llvm-commits mailing list