Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Conditionalize code gen based on hotness/coldness #35377

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR36404
Status NEW
Importance P enhancement
Reported by David Zarzycki (dave@znu.io)
Reported on 2018-02-15 15:45:56 -0800
Last modified on 2019-10-11 05:43:07 -0700
Version trunk
Hardware All All
CC hiraditya@msn.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
This bug is a followup to discussion in:
  https://reviews.llvm.org/D43201

It would be great if the compiler could conditionalize code gen based on the
hot/cold nature of functions and/or basic blocks. Anecdotally speaking (from my
experience at Apple), improving overall code density tends to improve overall
system performance. That being said, microbenchmarks sometimes suffer.

It would be great if LLVM could optimize for "reasonable size" (i.e. not micro-
coded; a.k.a. -Os not -Oz) by default and then switch to throughput optimized
code gen when evidence suggests that a "hot path" exists. At best, evidence can
include profile guided optimization and explicit source attributes; and at
worst simple heuristics.
Quuxplusone commented 4 years ago

Do you think Hot cold splitting maybe helpful in this case?

https://reviews.llvm.org/D50658

Quuxplusone commented 4 years ago

That would certainly help. That being said, lots of projects don't profile for various reasons.

Personally, I think the best bang-for-buck solution is to have two default optimization levels: one for obvious loops and one for everything else. This would also work well with things like code alignment (where loops are aligned but everything else is unaligned for density reasons).