[Mlir-commits] [mlir] [mlir][Affine] Fix loadCSE replacing a load with one already scheduled for erasure (PR #217511)

Aman Singh llvmlistbot at llvm.org
Fri Sep 4 23:09:06 PDT 2026


amanyagami wrote:

Ping — this has had no reviewer since it was opened 16 days ago, and I do not have permission to request one myself.

@matthias-springer @FedericoBruzzone you have been the most active reviewers on `mlir:affine` lately — would one of you be able to take a look, or redirect me to someone better placed?

Short version of the bug: `affineScalarReplace` defers erasing CSE'd-away loads until the whole walk completes, so during `loadCSE`'s search for a dominating equivalent load, ops that are already queued for erasure are still in the IR and can be picked as the replacement. The result is a load being replaced by one that is about to be deleted. The fix skips candidates already in the pending-erase set.

All checks are green and the PR is `clean` against `main`.

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


More information about the Mlir-commits mailing list