@@ -48,7 +48,7 @@ using namespace mlir;
4848using namespace mlir ::dataflow;
4949
5050static bool isPointerLike (Type type) {
51- return isa<MemRefType, LLVM::LLVMPointerType>(type);
51+ return isa<MemRefType, LLVM::LLVMPointerType, enzyme::CacheType >(type);
5252}
5353
5454// ===----------------------------------------------------------------------===//
@@ -121,29 +121,6 @@ ChangeResult enzyme::PointsToSets::update(const AliasClassSet &keysToUpdate,
121121 [&](DistinctAttr dest, AliasClassSet::State state) {
122122 assert (state == AliasClassSet::State::Defined &&
123123 " unknown must have been handled above" );
124- #ifndef NDEBUG
125- if (replace) {
126- auto it = map.find (dest);
127- if (it != map.end ()) {
128- // Check that we are updating to a state that's >= in the
129- // lattice.
130- // TODO: consider a stricter check that we only replace unknown
131- // values or a value with itself, currently blocked by memalign.
132- AliasClassSet valuesCopy (values);
133- (void )valuesCopy.join (it->getSecond ());
134- values.print (llvm::errs ());
135- llvm::errs () << " \n " ;
136- it->getSecond ().print (llvm::errs ());
137- llvm::errs () << " \n " ;
138- valuesCopy.print (llvm::errs ());
139- llvm::errs () << " \n " ;
140- assert (valuesCopy == values &&
141- " attempting to replace a pointsTo entry with an alias class "
142- " set that is ordered _before_ the existing one -> "
143- " non-monotonous update " );
144- }
145- }
146- #endif // NDEBUG
147124 return joinPotentiallyMissing (dest, values);
148125 });
149126}
@@ -278,7 +255,7 @@ LogicalResult enzyme::PointsToPointerAnalysis::visitOperation(
278255 // fixpoint and bail.
279256 auto memory = dyn_cast<MemoryEffectOpInterface>(op);
280257 if (!memory) {
281- if (isNoOp (op))
258+ if (isNoOp (op) || isMemoryEffectFree (op) )
282259 return success ();
283260 propagateIfChanged (after, after->markAllPointToUnknown ());
284261 return success ();
@@ -557,7 +534,7 @@ void enzyme::PointsToPointerAnalysis::visitCallControlFlowTransfer(
557534 std::optional<LLVM::ModRefInfo> otherModRef =
558535 getFunctionOtherModRef (callee);
559536
560- SmallVector<int > pointerLikeOperands;
537+ SmallVector<unsigned > pointerLikeOperands;
561538 for (auto &&[i, operand] : llvm::enumerate (call.getArgOperands ())) {
562539 if (isPointerLike (operand.getType ()))
563540 pointerLikeOperands.push_back (i);
@@ -575,7 +552,7 @@ void enzyme::PointsToPointerAnalysis::visitCallControlFlowTransfer(
575552 // unknown alias sets into any writable pointer.
576553 (void )functionMayCapture.markUnknown ();
577554 } else {
578- for (int pointerAsData : pointerLikeOperands) {
555+ for (unsigned pointerAsData : pointerLikeOperands) {
579556 // If not captured, it cannot be stored in anything.
580557 if ((pointerAsData < numArguments &&
581558 !!callee.getArgAttr (pointerAsData,
@@ -593,7 +570,7 @@ void enzyme::PointsToPointerAnalysis::visitCallControlFlowTransfer(
593570 AliasClassSet writableClasses = AliasClassSet::getUndefined ();
594571 AliasClassSet nonWritableOperandClasses = AliasClassSet::getUndefined ();
595572 ChangeResult changed = ChangeResult::NoChange;
596- for (int pointerOperand : pointerLikeOperands) {
573+ for (unsigned pointerOperand : pointerLikeOperands) {
597574 auto *destClasses = getOrCreateFor<AliasClassLattice>(
598575 getProgramPointAfter (call), call.getArgOperands ()[pointerOperand]);
599576
@@ -696,7 +673,7 @@ void enzyme::PointsToPointerAnalysis::visitCallControlFlowTransfer(
696673 continue ;
697674 }
698675
699- for (int operandNo : pointerLikeOperands) {
676+ for (unsigned operandNo : pointerLikeOperands) {
700677 const auto *srcClasses = getOrCreateFor<AliasClassLattice>(
701678 getProgramPointAfter (call), call.getArgOperands ()[operandNo]);
702679 if (mayReadArg (callee, operandNo, argModRef)) {
@@ -840,7 +817,8 @@ static bool isAliasTransferFullyDescribedByMemoryEffects(Operation *op) {
840817 }
841818 }
842819 }
843- return isa<memref::LoadOp, memref::StoreOp, LLVM::LoadOp, LLVM::StoreOp>(op);
820+ return isa<memref::LoadOp, memref::StoreOp, LLVM::LoadOp, LLVM::StoreOp,
821+ enzyme::PushOp, enzyme::PopOp>(op);
844822}
845823
846824void enzyme::AliasAnalysis::transfer (
0 commit comments