[LLVMdev] A question about FoldBranchtoCommonDest() in pass -simplifycfg

Sheng Zhou zhousheng at autoesl.com
Sun Aug 17 19:00:54 PDT 2008


Hi,

Is there anybody familiar with the code in
llvm/lib/Transforms/Utils/SimplifyCFG.cpp?

The function FoldBranchtoCommonDest() (line 1422) has the comment as
following:
"/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a
branch,
/// and if a predecessor branches to us and one of our successors, fold the
/// setcc into the predecessor and use logical operations to pick the right
/// destination."

My question is why that function requires the basic block should only
contain a setcc and a branch in it. Is there any special reason?

Thanks in advance.
Sheng.



More information about the llvm-dev mailing list