I’m new here, and would like to implement my own Loop Invariant Detection adding some more information on Quasi-Invariants.
First, is there anything about Quasi-Invariants detection in LLVM I would missed?
I’ve seen LICM using LoopInfo::isLoopInvariant for finding invariants.
It seems that this method considers a Value invariant if:
it’s an Instruction not presents in the current loop (what does it mean? There is no dependence analysis on In and Out “variables” of all instructions in the loop?)
this Value is not an Instruction (then a Constant I guess…).
I’ve seen LoopAccessAnalysis using it too. What does this analysis do exactly on loop invariant address?
Also DependenceAnalysis seems to give dependence information on memory refs. But it seems to not be used by LICM…
Also MemoryDependenceAnalysis “determines, for a given memory operation, what preceding memory operations it depends on”.
My question is: Where is really done this dependence analysis. The one which figures out which Instructions depends on others?
Simply if I have:
%0 = load i32, i32* %coucou, align 4
%1 = load i32, i32* %fact, align 4
%2 = load i32, i32* %i, align 4
%mul = mul nsw i32 %1, %2
mul instruction will depends on the two precedents loads because it uses their results %1 and %2 but not the first one.
I guess this is done somewhere, and there is a special representation of this information but I didn’t find, I’m a bit lost ^^’
Is someone can show me the way? Or just explain what he knows about Invariants and Instructions dependencies detection in LLVM… or just a good link I should follow…