[PATCH] D12341: add llvm.unpredictable intrinsic and lower it to metadata

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 10:29:39 PDT 2015


On 8/28/2015 12:13 PM, Philip Reames wrote:
> A somewhat horrible though occurred to me after reading this thread.
> Given that many code bases are targeted for multiple distinct hardware
> platforms, and deriving predictability of branch on a particular piece
> of hardware from a description the behavior is somewhat of a
> non-starter, do we need to have a mechanism for describing the
> predictability of a given branch on a particular instance of hardware? A
> branch that's entirely predictable on one compilation target (say modern
> x86 excluding Atom), might be utterly unpredictable to another (say
> PPC).  Do we need to support this either at the source level (Clang
> builtins), or the compiler itself?

I think it's completely reasonable to have a mechanism to record HW 
profiles.  If a target sees HW profiling data that do not apply, it can 
simply ignore them (or pick and choose the elements that do).  The only 
requirement for such metadata would be that each target could identify 
whether the information is "interesting" (i.e. matches the selected 
target parameters), or not.  For the data that do apply, TTI could make 
use of it, and the details of the format can be defined by each target 
for its own purposes.

I don't know how that could be done on a source level---I'm thinking 
about it in terms of translating HW-provided data into the PGO 
information---but it could be useful too.

-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation


More information about the llvm-commits mailing list