[LLVMdev] Preserving ProfileInfo in several Passes

Dan Gohman gohman at apple.com
Thu Dec 3 10:50:54 PST 2009


Here are a few misc. comments on this patch.

Would it make sense to mark the ProfileInfo passes as "CFGOnly?"
If so, that would let them be automatically preserved by passes
which don't modify the CFG (and that call AU.setPreservesCFG()).

> +  if (ProfileInfo* PI = getAnalysisIfAvailable<ProfileInfo>()) {
> +    PI->splitEdge(OrigPreHeader, NewHeader, NewPreHeader);
> +  }
> +
>    // Preserve canonical loop form, which means Exit block should
>    // have only one predecessor.
>    SplitEdge(L->getLoopLatch(), Exit, this);

Would it make sense to move the ProfileInfo updating code into
SplitEdge? That way all users of SplitEdge would automatically do
the right thing. Actually, SplitEdge just delegates to either
SplitCriticalEdge or SplitBlock, so those two should do the work.

In TailRecursionElimination.cpp, there's logic which uses a
"10-fold increase" heuristic. It would be nice if that code were
factored out into a utility routine so that the profiling
heuristics are more centralized.

> -        bool Folded = ConstantFoldTerminator(I->getParent());
> +        bool Folded = ConstantFoldTerminator(I->getParent(), this);

I don't see any corresponding changes to the definition of
ConstantFoldTerminator. Are there files missing from the patch?


On Dec 3, 2009, at 9:56 AM, Andreas Neustifter wrote:

> Hi all,
> this (altough a big patch) is actually pretty straight forward: It (tries) to preserve ProfileInfo in all -std-compile-opts passes and all X86-Backend passes.
> There is still some passes that have corner cases where the ProfileInfo is not correct after the pass. Some passes are still missing...
> How shall I proceed with this?
> Andi
> <llvm-r90454.profileinfo-preservation.patch>_______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list