[llvm] r342578 - [X86] Handle COPYs of physregs better (regalloc hints)
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 27 03:45:38 PDT 2018
Hi,
I would be happy to take a look. Could you please post a preprocessed /
bitcode (reduced if possible) test case, preferably llc input, with a
command line?
/Jonas
On 2018-09-27 10:14, Simon Pilgrim wrote:
> This is a question for Jonas - I just kept the x86 tests up to date
> until the patch was accepted.
>
> On 27/09/2018 00:08, Jordan Rupprecht wrote:
>> Hi Simon,
>>
>> We seem to have some extreme compile slowdowns in sanitizer (asan,
>> msan, and tsan) modes after r342578. In one case, we've seen something
>> built with tsan and -O2 go from 20 seconds to 12 minutes. It doesn't
>> seem to be a general slowdown, just certain "interesting" pieces of
>> code (heavy template users, generated code that has thousands of
>> expressions, etc.)
>>
>> We've seen it in all sanitizer modes, but the tsan example mentioned
>> can be distilled down to something like this:
>>
>> $ time bin/clang -c repro.cpp -I</path/to/eigen> -O2
>> -fno-strict-aliasing -fsanitize=thread -o repro.o
>> @r342577: 5.25s user 0.68s system 99% cpu 5.984 total
>> @r342578: 9.50s user 0.26s system 99% cpu 9.811 total
>>
>> $ cat repro.cpp
>> #include <Eigen/Core>
>> Eigen::MatrixXi foo(int x) {
>> Eigen::MatrixXi m;
>> switch (x) {
>> case 3:
>> m.resize(3, 3);
>> m << 1, 2, 3, //
>> 1, 2, 3, //
>> 1, 2, 3;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> break;
>> case 5:
>> m.resize(5, 5);
>> m << 1, 2, 3, 4, 5, //
>> 1, 2, 3, 4, 5, //
>> 1, 2, 3, 4, 5, //
>> 1, 2, 3, 4, 5, //
>> 1, 2, 3, 4, 5;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> break;
>> case 7:
>> m.resize(7, 7);
>> m << 1, 2, 3, 4, 5, 6, 7, //
>> 1, 2, 3, 4, 5, 6, 7, //
>> 1, 2, 3, 4, 5, 6, 7, //
>> 1, 2, 3, 4, 5, 6, 7, //
>> 1, 2, 3, 4, 5, 6, 7, //
>> 1, 2, 3, 4, 5, 6, 7, //
>> 1, 2, 3, 4, 5, 6, 7;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> break;
>> case 25:
>> m.resize(25, 25);
>> m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> 17, 18, 19,
>> 20, 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> break;
>> case 30:
>> m.resize(30, 30);
>> m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> 17, 18, 19,
>> 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, //
>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
>> 18, 19, 20,
>> 21, 22, 23, 24, 25, 26, 27, 28, 29, 30;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> m.array() -= 1;
>> break;
>> default:
>> break;
>> }
>> return m;
>> }
>>
>> In some cases, we can workaround this by rewriting the methods to be
>> simpler. However, it'd be nice to understand what's going on -- is
>> there a O(n^2) algorithm that enableMultipleCopyHints() is enabling
>> that would cause large methods to be slow to compile?
>>
>> Thanks -- Jordan
>
More information about the llvm-commits
mailing list