[mlir][CSE] fix use-after-free (#203849)

There was a use-after free introduced accidentally by e79e056ee982
[mlir][CSE] Remove the opsToErase container and immediately delete dead
ops. (#203702) This change fixes it by moving the copy of the location
(the "use") to before the deletion of the op (the "free").

Locating the use-after-free has been assisted by Claude Code. The
implementation of the fix has been done without it.

Signed-off-by: Stefan Schuermans <schuermans@roofline.ai>
GitOrigin-RevId: c33a47e6863b3294e693e540df8134a486eafef7
1 file changed
tree: fd0badd09ffde98519a805d7c8f2eebc7dd095a4
  1. benchmark/
  2. cmake/
  3. docs/
  4. examples/
  5. include/
  6. lib/
  7. python/
  8. test/
  9. tools/
  10. unittests/
  11. utils/
  12. .clang-format
  13. .clang-tidy
  14. CMakeLists.txt
  15. LICENSE.TXT
  16. Maintainers.md
  17. README.md
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.