[llvm-commits] [PATCH] Tail recursion elimination and memory loads.

Frits van Bommel fvbommel at wxs.nl
Wed Jun 17 01:26:06 PDT 2009


Duncan Sands wrote:
> Hi Frits,
> 
>>  2) The load is non-volatile, the call does not write to memory, and the 
>> pointer isSafeToLoadUnconditionally() at that point in the code. In this 
>> case, the load has no side-effects (and won't trap) and the memory it 
>> loads from won't contain different data after the call, making it safe 
>> to raise the load above the call.
> 
> shouldn't isSafeToLoadUnconditionally() check that the load is not
> volatile?  If you are loading from i/o memory, then the fact of
> executing the load could cause your rocket to launch - in any case
> it is not in general safe to LoadUnconditionally something volatile.

isSafeToLoadUnconditionally() only receives the pointer loaded from and the 
instruction to start scanning from[1] so it never sees the load itself.
(instcombine, the only other user, already gives up earlier if 
Load->isVolatile() returns true)


[1]: And in the case of instcombine, the latter is a select instruction, not a load.



More information about the llvm-commits mailing list