[all-commits] [llvm/llvm-project] 571755: [MLIR][IR] add -mlir-print-unique-ssa-ids to AsmPr...

Scott Manley via All-commits all-commits at lists.llvm.org
Tue May 7 08:45:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57175533da0f3ea2054550c2e4d3e831e93bb4df
      https://github.com/llvm/llvm-project/commit/57175533da0f3ea2054550c2e4d3e831e93bb4df
  Author: Scott Manley <rscottmanley at gmail.com>
  Date:   2024-05-07 (Tue, 07 May 2024)

  Changed paths:
    M mlir/include/mlir/IR/OperationSupport.h
    M mlir/lib/IR/AsmPrinter.cpp
    A mlir/test/IR/print-unique-ssa-ids.mlir

  Log Message:
  -----------
  [MLIR][IR] add -mlir-print-unique-ssa-ids to AsmPrinter (#91241)

Add an option to unique the numbers of values, block arguments and
naming conflicts when requested and/or printing generic op form. This is
helpful when debugging. For example, if you have:

    scf.for
      %0 =
      %1 = opA %0

    scf.for
      %0 =
      %1 = opB %0

And you get a verifier error which says opB's "operand #0 does not
dominate this use", it looks like %0 does dominate the use. This is not
intuitive. If these were numbered uniquely, it would look like:

    scf.for
      %0 =
      %1 = opA %0

    scf.for
      %2 =
      %3 = opB %0

And thus, much clearer as to why you are getting the error since %0 is
out of scope. Since generic op form should aim to give you the most
possible information, it seems like a good idea to use unique numbers in
this situation. Adding an option also gives those an option to use it
outside of generic op form.

Co-authored-by: Scott Manley <scmanley at nvidia.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list