diff --git a/enzyme/Enzyme/MLIR/Analysis/DataFlowActivityAnalysis.cpp b/enzyme/Enzyme/MLIR/Analysis/DataFlowActivityAnalysis.cpp index 5482195764e8..2896b428a23d 100644 --- a/enzyme/Enzyme/MLIR/Analysis/DataFlowActivityAnalysis.cpp +++ b/enzyme/Enzyme/MLIR/Analysis/DataFlowActivityAnalysis.cpp @@ -34,6 +34,7 @@ #include "mlir/Analysis/DataFlow/DenseAnalysis.h" #include "mlir/Analysis/DataFlow/SparseAnalysis.h" #include "mlir/Analysis/DataFlowFramework.h" +#include "mlir/IR/Matchers.h" #include "mlir/Interfaces/SideEffectInterfaces.h" // TODO: Don't depend on specific dialects @@ -856,7 +857,7 @@ void printActivityAnalysisResults(const DataFlowSolver &solver, }); }; - if (isa_and_present( + if (isa_and_present( value.getDefiningOp())) { // Alias classes aren't computed for poison ops, but they are // definitionally constant. @@ -867,6 +868,7 @@ void printActivityAnalysisResults(const DataFlowSolver &solver, // TODO: We're seeing a case where we load from calloc which is // defined to be zero. errs() << "ac for " << value << " was undefined\n"; + return true; } // If this triggers, investigate why the alias classes weren't computed. // If they weren't computed legitimately, treat the value as diff --git a/enzyme/test/MLIR/AliasAnalysis/llvm_noalias.mlir b/enzyme/test/MLIR/AliasAnalysis/llvm_noalias.mlir index 74f020dcf911..2c3d212fb1ba 100644 --- a/enzyme/test/MLIR/AliasAnalysis/llvm_noalias.mlir +++ b/enzyme/test/MLIR/AliasAnalysis/llvm_noalias.mlir @@ -1,10 +1,11 @@ // RUN: %eopt --test-print-alias-analysis --split-input-file %s 2>&1 | FileCheck %s // The dataflow framework never sees what is stored into %x, but we know its load result does not alias -// with anything else in the function because it has `noalias`. +// with %x itself because of the `llvm.noalias` // CHECK: "x" and "x_load": NoAlias -llvm.func @f(%x: !llvm.ptr {enzyme.tag = "x", llvm.noalias}) { +// CHECK: "y" and "x_load": MayAlias +llvm.func @f(%x: !llvm.ptr {enzyme.tag = "x", llvm.noalias}, %y: !llvm.ptr {enzyme.tag = "y"}) { %x_load = llvm.load %x {tag = "x_load"} : !llvm.ptr -> !llvm.ptr llvm.return }