[LLVMdev] A question about LICM (Loop Invariant Code Motion)

Reid Kleckner reid.kleckner at gmail.com
Tue Feb 8 07:36:29 PST 2011


On Tue, Feb 8, 2011 at 4:55 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Yuelu,
>
>> After tracking the LICM pass, I find that both loads are loop
>> invariant, and canSinkOrHoist() also returns true; however the
>> difference is at Instruction::isSafeToSpeculativelyExecute(),
>> for load from function parameter pointer, it return false; with load
>> from a global var pointer, it returns true. As a result no hoist
>> happens for a load *fp:
>
> the function parameter pointer might be null.

I suppose you could peel a single iteration to try to work around that.

Reid



More information about the llvm-dev mailing list