[llvm-dev] A 4x slower initialization loop in LLVM vs GCC and MSVC

Stefanos Baziotis via llvm-dev
Sun, 27 Sep 2020 11:52:29 -0000

Hi everyone,

I was watching this video [1]. There's an example of an initialization loop
for which
Clang unfortunately generates really bad code [2]. In my machine, the Clang
version
is 4x slower than the GCC version. I have not tested the MSVC version, but
it should
be around the same.

In case anyone's interested, in the video [1] Casey explains why this code
is bad (around 59:39).

So, I tried to run -print-after-all [3]. There are a lot of passes that
interact here, so I was
wondering if anyone knows more about that. It seems to me that the problem
starts
with SROA. Also, I'm not familiar with how these llvm.memcpy / memset are
handled down
the pipeline. Finally, the regalloc probably did not go very well.

Best,
Stefanos

[1] https://youtu.be/R5tBY9Zyw6o?t=3580
[2] https://godbolt.org/z/9oWhEn
[3] https://godbolt.org/z/xa4jo9
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20200927/e3d32312/attachment.html>