[LLVMdev] [Proposal] Speculative execution of function calls
David Tweed
david.tweed at arm.com
Wed Jul 31 04:36:54 PDT 2013
Hi,
| I suspect that much of the problem here comes from modelling intrinsics as
calls in the IR, when most of them are closer to arithmetic operations.
This means that optimisations have to be aware that
| some calls are not really calls and so don't cause any flow control
effects. I wonder if it's worth revisiting some of the design of intrinsics
and having some notion of target-dependent
| instructions. This would also help if anyone wants to try the route
discussed at the San Jose DevMeeting last year of progressively lowering
machine-independent IR to machine instructions.
The only thing I'd say is that I think it's a mistake to try to separate out
real "intrinsics" and "function calls" that should be speculatable when
we're at thte level of platform independent optimizations (afterwards it may
make more sense). Depending how exotic your hardware is there may be a lot
of things that are implemented in a speculation-safe way that you'd like to
represent (at the mid-level) as calls rather than as explicit LLVM IR
intrinsics. For example, I expect which OpenCL "built-in functions" are
functions and which are specialised in hardware varies significantly from
device to device. Having different paths for "speculating" intrinsic and
"functions which may or may not (depending on the back-end) be an intrinsic"
seems to have a lot of potential for very algorithm duplication that's prone
to drifting out of sync.
Cheers,
Dave
More information about the llvm-dev
mailing list