Closed Quuxplusone closed 3 years ago
Here's what I see with a build from trunk (this is an unoptimized clang binary
with asserts, so the absolute times aren't very interesting, but give an upper
bound on compile time):
-O0: 3.06s
-O0 -g: 3.75s
-O3: 24.39s
-O3 -g: 42.27s
How does this compare with what you see for the reduced testcase with Clang 3.3?
Hmmmm, we'll we actually tried our test code on the Mac and couldn't reproduce it with the Xcode's version of clang. We could possibly give you PS4 timings but we were hesitant because we were thinking it was a custom version of clang. I could try to get those if that will help?
I believe there is a bug open with SN systems too.
The wierd thing is that the particular Scaleform .cpp file causes both the PS4 and Xcode clang compilers to choke, eating up tons of memeory and taking forever to complete.
(In reply to comment #2)
> Hmmmm, we'll we actually tried our test code on the Mac and couldn't
> reproduce it with the Xcode's version of clang.
> ...
> The wierd thing is that the
> particular Scaleform .cpp file causes both the PS4 and Xcode clang compilers
> to choke, eating up tons of memeory and taking forever to complete.
Sorry... you are, or are not, able to reproduce this with Xcode?
> We could possibly give you
> PS4 timings but we were hesitant because we were thinking it was a custom
> version of clang. I could try to get those if that will help?
That compiler is somewhat customized but for compile-time performance
issues the most relevant customizations are the command-line options,
and the most relevant of those are usually:
-fno-exceptions -fno-rtti -fPIC
Also note that the currently released PS4 compiler is based on LLVM 3.2.
So, if you could be explicit about what options you use, and when you
do and don't see the problem, and what version of Xcode you are using,
that would help.
> I believe there is a bug open with SN systems too.
Yes there is.
Sorry... you are, or are not, able to reproduce this with Xcode?
With that code snippet I attached it seems we can not reproduce the long compile time in XCode 5.0.2, but we still see long compile times with XCode 5.0.2 when we compile the Scaleform .cpp file that originally brought this to our attention initially. I'll keep messing around with XCode to see if I can get an easy example case, as you stated it may be just certain flags that exhibit the behavior. AS this is an Unreal integration I'll have to pull the build appart a bit to see what exactly is causing it.
I do have a ticket open with Adobe/Scaleform with no replies from them unfortunately.
We do however see the bug always with the SN system version of clang, with the attached code snippet and the Scaleform.cpp.
(In reply to comment #3)
> So, if you could be explicit about what options you use, and when you
> do and don't see the problem, and what version of Xcode you are using,
> that would help.
Well I did get it to repro with the XCode 5.0.2 clang compiler. This was the
basic command line I used
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-c -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-O3 -gdwarf-2 -fno-exceptions -fno-rtti ClangOptBug.cpp
The key is -fno-exceptions and -fno-rtti. If I add those options with an
optimized build it will take an extremely long time here are some timings from
our Mac.
-O0 -g0
0.438-
-O3 - gdwarf-2
4.197 secs
-O0 -g0 -fno-exceptions -fno-rtti
0.439
-O3 -gdwarf-2 -fno-exceptions -fno-rtti
13m 39seconds
Attached ClangOptBug.rar
(4308 bytes, application/octet-stream): Code snippet to revela compiler bug
Attached ClangOptBug.ii
(891519 bytes, application/octet-stream): preprocessed file
This is slow, but much better on trunk:
$ time clang -cc1 -triple thumbv7-apple-ios7.0.0 -S -target-abi apcs-gnu -g -O2
-fblocks ClangOptBug.ii
real 1m35.015s
user 1m27.564s
sys 0m4.733s
$ time
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-cc1 -triple thumbv7-apple-ios7.0.0 -S -target-abi apcs-gnu -g -O2 -fblocks
ClangOptBug.ii
real 14m14.983s
user 14m9.464s
sys 0m4.459s
perf says:
24.84% llc llc [.] llvm::LiveDebugVariables::emitDebugValues(llvm::VirtRegMap*)
18.74% llc llc [.] llvm::LiveDebugVariables::splitRegister(unsigned int, llvm::ArrayRef<unsigned int>, llvm::LiveIntervals&)
6.45% llc llc [.] llvm::MachineOperand::isIdenticalTo(llvm::MachineOperand const&) const
I have a faster machine, but now this example takes 0m21.393s to compile for me. We can close this out.
ClangOptBug.rar
(4308 bytes, application/octet-stream)ClangOptBug.ii
(891519 bytes, application/octet-stream)