[LLVMdev] LICM for function calls
Kuperstein, Michael M
michael.m.kuperstein at intel.com
Sun Jul 19 00:28:48 PDT 2015
I meant side-effect free.
You cannot hoist an idempotent function with possible side-effects unless you know the loop is going to execute for at least one iteration, in which case, it's not speculation (assuming the function is called within the loop unconditionally, that is).
-----Original Message-----
From: Philip Reames [mailto:listmail at philipreames.com]
Sent: Friday, July 17, 2015 19:44
To: Kuperstein, Michael M; Hal Finkel; Raoux, Thomas F
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] LICM for function calls
On 07/16/2015 03:57 AM, Kuperstein, Michael M wrote:
> The common case is wanting LICM to hoist a loop-invariant function call into the pre-header of a loop where the trip count is unknown - and, in particular, not known to be > 0.
Just to clarify, I assume that you mean a read only idempotent function right? (i.e. running it only once is not observable vs running it many times in the loop) Or do you mean a read only side effect free function (i.e. running it once is indistinguishable from 0 or many runs)? We could - and should - support both, but they're slightly different.
(I'm assuming no aliasing writes in both cases above.)
>
> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Hal Finkel
> Sent: Thursday, July 16, 2015 08:38
> To: Raoux, Thomas F
> Cc: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] LICM for function calls
>
> I think we'd need some kind of 'safe_to_speculate' attribute on the function. Regarding the optimization, under what circumstances would you want to speculate a function? I can imagine doing this only if I knew the function would be lowered in the backend to some simple set of instructions.
>
> -Hal
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the llvm-dev
mailing list