OSDN Git Service

[mlir][NFC] Refactor DialectConversion debug logging
authorRiver Riddle <riddleriver@gmail.com>
Fri, 31 Jan 2020 19:46:53 +0000 (11:46 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Fri, 31 Jan 2020 20:07:17 +0000 (12:07 -0800)
commit4948b8b3cf485159da64fca81a9903610a830281
tree8bdec03418368894da99646d05d6285a97a7964c
parentff17da3f75b4825f71e81e1caa2e5084d500a1a1
[mlir][NFC] Refactor DialectConversion debug logging

Summary:
This revision beefs up the debug logging within dialect conversion. Given the nature of multi-level legalization, and legalization in general, it is one of the harder pieces of infrastructure to debug. This revision adds nice formatting to make the output log easier to parse:

```
Legalizing operation : 'std.constant'(0x608000002420) {
  * Fold {
  } -> FAILURE : unable to fold

  * Pattern : 'std.constant -> ()' {
  } -> FAILURE : pattern failed to match

  * Pattern : 'std.constant -> ()' {
  } -> FAILURE : pattern failed to match

  * Pattern : 'std.constant -> (spv.constant)' {
    ** Insert  : 'spv.constant'(0x608000002c20)
    ** Replace : 'std.constant'(0x608000002420)

    //===-------------------------------------------===//
    Legalizing operation : 'spv.constant'(0x608000002c20) {
    } -> SUCCESS : operation marked legal by the target
    //===-------------------------------------------===//
  } -> SUCCESS : pattern applied successfully
} -> SUCCESS
```

Differential Revision: https://reviews.llvm.org/D73747
mlir/lib/Transforms/DialectConversion.cpp