[llvm-bugs] [Bug 47712] New: verifyFunction spends too much time validating module metadata in +asserts builds
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 2 11:58:06 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47712
Bug ID: 47712
Summary: verifyFunction spends too much time validating module
metadata in +asserts builds
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Core LLVM classes
Assignee: unassignedbugs at nondot.org
Reporter: rnk at google.com
CC: aprantl at apple.com, hans at chromium.org,
llvm-bugs at lists.llvm.org, nicolasweber at gmx.de,
spatel+llvm at rotateright.com, vsk at apple.com
I was profiling LLVM for other reasons and accidentally used a build with
assertions enabled. What I discovered is that, if you compile PassBuilder.cpp
with assertions, most of the time is spent in the verifier, mostly due to
asserts in SLPVectorizer and LoopVectorizer. There are 187,486 samples overall,
and 131,698 of them (70.2%) are inside calls to verifyFunction.
If you drill into what verifyFunction is doing, all the time is spent in
recursive calls to visitMDNode. These calls are rooted in visitInstruction
calls to visitMDNode:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/IR/Verifier.cpp#L4431
visitMDNode in turn validates each of its operands. This is undesirable when
validating a function: location metadata points upwards, so validating one
location will ultimately validate the entire metadata graph rooted in the
compile unit. See the tree of calls in this screenshot:
https://reviews.llvm.org/file/data/u5ms43qqwl3aahxopjql/PHID-FILE-ysoomivlg3fixz52f4ny/visitmdnode-profile.png
The code I linked was added in
http://github.com/llvm/llvm-project/commit/8dfe819bcd23, but I'm not sure when
this regressed. We used to ship clang with assertions enabled, so we saw these
non-linear assert compile time issues in the field as they arose. Now that we
are no longer watching carefully, it seems like these issues can slip in.
Should we try to establish the invariant that llvm::verifyFunction runs in
O(#instructions), or should we move all calls to verifyFunction to
EXPENSIVE_CHECKS?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201002/6c2146c4/attachment.html>
More information about the llvm-bugs
mailing list