[PATCH] D116821: [DebugInfo][InstrRef] Move instr-ref controlling flag out of TargetOptions

Alexander Kornienko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 18:16:11 PST 2022


alexfh added a comment.

I reduced our problematic file to a function with a couple thousand variables of a type containing a few `std::function<>`s. This can be demonstrated by this synthetic test case:

  #include <functional>
  #include <vector>
  namespace n {
  
  using F = std::function<void()>;
  
  struct S {
    F f1;
    F f2;
    F f3;
  };
  
  std::vector<S> f() {
    std::vector<S> v;
    #define X(s) S s; v.push_back(s)
    #define XX(s) \
      X(s ## 0); \
      X(s ## 1); \
      X(s ## 2); \
      X(s ## 3); \
      X(s ## 4); \
      X(s ## 5); \
      X(s ## 6); \
      X(s ## 7); \
      X(s ## 8); \
      X(s ## 9)
    #define XXX(s) \
      XX(s ## 0); \
      XX(s ## 1); \
      XX(s ## 2); \
      XX(s ## 3); \
      XX(s ## 4); \
      XX(s ## 5); \
      XX(s ## 6); \
      XX(s ## 7); \
      XX(s ## 8); \
      XX(s ## 9)
    #define XXXX(s) \
      XXX(s ## 0); \
      XXX(s ## 1); \
      XXX(s ## 2); \
      XXX(s ## 3); \
      XXX(s ## 4); \
      XXX(s ## 5); \
      XXX(s ## 6); \
      XXX(s ## 7); \
      XXX(s ## 8); \
      XXX(s ## 9)
  
    XXXX(a);
    return v;
  }
  }

  $ time -v ./clang-74db5c8c95e2aed40d288bb2df92eb859b87c827 -O1 --target=x86_64-generic-linux-gnu -g -fsanitize=address -fsized-deallocation -std=c++17 -c q.cc -o q.o
          Command being timed: "./clang-74db5c8c95e2aed40d288bb2df92eb859b87c827 -O1 --target=x86_64-generic-linux-gnu -g -fsanitize=address -fsized-deallocation -std=c++17 -c q.cc -o q.o"
          User time (seconds): 20.13
          System time (seconds): 0.31
          Percent of CPU this job got: 99%
          Elapsed (wall clock) time (h:mm:ss or m:ss): 0:20.46
          Average shared text size (kbytes): 0
          Average unshared data size (kbytes): 0
          Average stack size (kbytes): 0
          Average total size (kbytes): 0
          Maximum resident set size (kbytes): 1029064
          Average resident set size (kbytes): 0
          Major (requiring I/O) page faults: 0
          Minor (reclaiming a frame) page faults: 8101
          Voluntary context switches: 8
          Involuntary context switches: 42
          Swaps: 0
          File system inputs: 0
          File system outputs: 5104
          Socket messages sent: 0
          Socket messages received: 0
          Signals delivered: 0
          Page size (bytes): 4096
          Exit status: 0
  $ time -v ./clang-80532ebb508d0ca62f96df5f253db8caed969397 -O1 --target=x86_64-generic-linux-gnu -g -fsanitize=address -fsized-deallocation -std=c++17 -c q.cc -o q.o
          Command being timed: "./clang-80532ebb508d0ca62f96df5f253db8caed969397 -O1 --target=x86_64-generic-linux-gnu -g -fsanitize=address -fsized-deallocation -std=c++17 -c q.cc -o q.o"
          User time (seconds): 66.67
          System time (seconds): 2.06
          Percent of CPU this job got: 99%
          Elapsed (wall clock) time (h:mm:ss or m:ss): 1:08.75
          Average shared text size (kbytes): 0
          Average unshared data size (kbytes): 0
          Average stack size (kbytes): 0
          Average total size (kbytes): 0
          Maximum resident set size (kbytes): 7632172
          Average resident set size (kbytes): 0
          Major (requiring I/O) page faults: 0
          Minor (reclaiming a frame) page faults: 12537
          Voluntary context switches: 8
          Involuntary context switches: 223
          Swaps: 0
          File system inputs: 0
          File system outputs: 4872
          Socket messages sent: 0
          Socket messages received: 0
          Signals delivered: 0
          Page size (bytes): 4096
          Exit status: 0

Note the 3.3x run time and ~7.5x maximum rss with this patch. But what's surprising to me is the high run time and memory consumption of clang even without this patch =\


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116821/new/

https://reviews.llvm.org/D116821



More information about the llvm-commits mailing list