[llvm] [llubi] Add support for exposed provenance (PR #200596)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 03:25:21 PDT 2026


================
@@ -104,26 +104,60 @@ enum class StorageKind {
 /// Tri-state boolean value.
 enum class BooleanKind { False, True, Poison };
 
+/// A set of previously exposed provenances. It is originally yielded by
+/// inttoptr, and shared by pointers derived from the result.
+class WildcardProvenance : public RefCountedBase<WildcardProvenance> {
+  // Each capability check may invalidate some provenances. If we cannot
+  // pick one, it is UB. That is, from the angelic non-determinism view,
+  // we cannot pick a provenance to make the program reach this point.
+  // The bitwidth represents the generation of the set. We only consider
+  // the exposed provenances in the snapshot, which is captured at the
+  // point where inttoptr executes.
+  APInt ActiveMask;
+  union {
+    // Initially, we record a snapshot of exposed provenances. It is active when
+    // ActiveMask is zero.
+    uint64_t Generation;
+    // After a memory access is performed, the memory object can be determined.
+    // It is active when ActiveMask is non-zero.
+    uint64_t BaseAddress;
+  };
+
+  friend class Context;
+
+public:
+  explicit WildcardProvenance(uint64_t Generation)
+      : ActiveMask(), Generation(Generation) {}
+};
+
 /// Components of a pointer excluding address. They are shared between pointer
 /// values, as most of operations don't change the provenance.
 /// Each node will be assigned a unique, pointer-sized tag, which is used to
 /// represent the pointer in the memory.
+/// The provenance can be either concrete or wildcard, as determined by the
+/// cases below: Obj        Wildcard      State Null       Null          Invalid
----------------
nikic wrote:

Weird formatting here, to the point that I don't understand this comment at all.

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


More information about the llvm-commits mailing list