[PATCH] D44132: [MIR] Making MIR Printing, opt -dot-cfg, and -debug printing faster

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 20:57:48 PST 2018


rtereshin created this revision.
rtereshin added reviewers: dexonsmith, bkramer, void, chandlerc, aditya_nandakumar, dsanders, bogner, qcolombet.

Value::printAsOperand has been scanning the entire module just to
print a single value as an operand, regardless being asked to print a
type or not at all, and regardless really needing to scan the module
to print a type.

It made some of the users of the method exceptionally slow on large
IR-modules (or large MIR-files with large IR-modules embedded).

This patch defers scanning a module looking for struct types, mostly
numbered struct types, as much as possible, speeding up those users
w/o changing any APIs at all.

See speedup examples below:

Release Build:

  # 83 seconds -> 5.5 seconds
  time ./bin/llc -start-before=irtranslator -stop-after=irtranslator \
    -global-isel -global-isel-abort=2 -simplify-mir sqlite3.O0.ll -o \
    sqlite3.O0.ll.regbankselected.mir

  # 133 seconds -> 6.2 seconds
  time ./bin/opt sqlite3.O0.ll -dot-cfg -disable-output

Release + Asserts Build:

  # 1096 seconds -> 553 seconds
  time ./bin/llc -debug-only=isel -fast-isel=false -stop-after=isel \
    sqlite3.O0.ll -o /dev/null 2> err

  # 95 seconds -> 5.5 seconds
  time ./bin/llc -start-before=irtranslator -stop-after=irtranslator \
    -global-isel -global-isel-abort=2 -simplify-mir sqlite3.O0.ll -o \
    sqlite3.O0.ll.regbankselected.mir

  # 146 seconds -> 6.2 seconds
  time ./bin/opt sqlite3.O0.ll -dot-cfg -disable-output

where sqlite3.O0.ll is non-optimized IR produced from
sqlite-amalgamation (http://sqlite.org/download.html), which is entire
SQLite3 implementation in a single C-file.

Benchmarked on 4-cores / 8 threads PCI-E SSD iMac running macOS


Repository:
  rL LLVM

https://reviews.llvm.org/D44132

Files:
  lib/IR/AsmWriter.cpp
  unittests/IR/ValueTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44132.137123.patch
Type: text/x-patch
Size: 8453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/6569025c/attachment.bin>


More information about the llvm-commits mailing list