Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixed:
- Preserve SourceRef storage identities while exposing initialized, written, and rebased values through explicit dependency queries
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixed:
- Preserve array and POD SourceRef state through SCF loops and resultless aggregate writes
17 changes: 15 additions & 2 deletions include/llzk/Analysis/ConstraintDependencyGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ class SourceRefAnalysis : public dataflow::SparseForwardDataFlowAnalysis<SourceR
using Base::SparseForwardDataFlowAnalysis;

static const Lattice *getLattice(mlir::DataFlowSolver &solver, mlir::Value val);

/// Return the storage references represented by `val` without replacing them with values
/// written to those locations.
static SourceRefLatticeValue getValueState(mlir::DataFlowSolver &solver, mlir::Value val);

/// Return the logical dependencies of `val` by following known storage writes transitively.
/// Unwritten storage remains represented by its address.
static SourceRefLatticeValue getDependencyState(mlir::DataFlowSolver &solver, mlir::Value val);

static mlir::FailureOr<SourceRefLatticeValue>
getWriteTargetState(mlir::DataFlowSolver &solver, mlir::Operation *op);

Expand All @@ -68,10 +76,15 @@ class SourceRefAnalysis : public dataflow::SparseForwardDataFlowAnalysis<SourceR
// Create the references for either an array.read op or an array.extract op, which
// operate very similarly: index into the first operand using a variable number
// of provided indices.
static SourceRefLatticeValue
arraySubdivisionOpUpdate(array::ArrayAccessOpInterface op, const OperandValues &operandVals);
static SourceRefLatticeValue arraySubdivisionOpUpdate(
array::ArrayAccessOpInterface op, const OperandValues &operandVals,
std::vector<SourceRefIndex> *resolvedIndices = nullptr
);

private:
class StorageState;
StorageState *getStorageState(mlir::Operation *op);

mlir::SymbolTableCollection tables;
};

Expand Down
2 changes: 2 additions & 0 deletions include/llzk/Analysis/SourceRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ class SourceRef {
bool isTemplateConstant() const {
return isConstant() && llvm::isa_and_present<polymorphic::ConstReadOp>(value.getDefiningOp());
}
/// Return whether this reference originates from a read of an immutable global.
bool isImmutableGlobal() const;

bool isConstant() const { return constant; }
bool isConstantInt() const { return isConstantFelt() || isConstantIndex(); }
Expand Down
Loading
Loading