[Mlir-commits] [mlir] 82bcd98 - [mlir] Fix bug in ForwardDataFlowAnalysis solver

River Riddle llvmlistbot at llvm.org
Tue Apr 27 14:31:50 PDT 2021


Author: River Riddle
Date: 2021-04-27T14:31:27-07:00
New Revision: 82bcd985862892773fc9685aa6abcbb298267aa0

URL: https://github.com/llvm/llvm-project/commit/82bcd985862892773fc9685aa6abcbb298267aa0
DIFF: https://github.com/llvm/llvm-project/commit/82bcd985862892773fc9685aa6abcbb298267aa0.diff

LOG: [mlir] Fix bug in ForwardDataFlowAnalysis solver

Explicitly check for uninitialized to prevent crashes in edge cases where the derived analysis creates a lattice element for a value that hasn't been visited yet.

Added: 
    

Modified: 
    mlir/lib/Analysis/DataFlowAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/DataFlowAnalysis.cpp b/mlir/lib/Analysis/DataFlowAnalysis.cpp
index ec1a13a742426..ef629c10202af 100644
--- a/mlir/lib/Analysis/DataFlowAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlowAnalysis.cpp
@@ -317,7 +317,7 @@ void ForwardDataFlowSolver::visitOperation(Operation *op) {
   for (Value operand : op->getOperands()) {
     AbstractLatticeElement *operandLattice =
         analysis.lookupLatticeElement(operand);
-    if (!operandLattice)
+    if (!operandLattice || operandLattice->isUninitialized())
       return;
     operandLattices.push_back(operandLattice);
   }


        


More information about the Mlir-commits mailing list