http://llvm.org/bugs/show_bug.cgi?id=9443

           Summary: MergeBasicBlockIntoOnlyPred() and
                    MergeBlockIntoPredecessor() should be merged.
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Transforms/Utils/Local.cpp has a function MergeBasicBlockIntoOnlyPred(), and
Transforms/Utils/BasicBlockUtils.cpp has one named MergeBlockIntoPredecessor().
These two functions perform *very* similar jobs, but do so in different ways:

MergeBasicBlockIntoOnlyPred() assumes the transform is valid, while
MergeBlockIntoPredecessor() checks and returns false if it can't do anything.

MergeBasicBlockIntoOnlyPred() moves instructions from the predecessor to the
successor, MergeBlockIntoPredecessor() moves them the other way around.

They both remove the PHIs in the successor block, but
MergeBasicBlockIntoOnlyPred() does this ad-hoc while
MergeBlockIntoPredecessor() calls FoldSingleEntryPHINodes() (which also updates
AliasAnalysis and MemoryDepencenceAnalysis).

MergeBasicBlockIntoOnlyPred() handles successors with blockaddresses pointing
at it, MergeBlockIntoPredecessor() doesn't.

They both update the DominatorTree, but MergeBasicBlockIntoOnlyPred() also
updates ProfileInfo. MergeBlockIntoPredecessor() on the other hand also updates
LoopInfo and MemoryDependenceAnalysis.

IMHO these two functions should be merged somehow. (possibly by having
MergeBlockIntoPredecessor() keep performing the initial checks and calling
MergeBasicBlockIntoOnlyPred() to do the actual work)
It seems to me that besides just cleaning things up, they can both be improved
by incorporating features from the other one.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to