[LLVMbugs] [Bug 9443] New: MergeBasicBlockIntoOnlyPred() and MergeBlockIntoPredecessor() should be merged.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 9 13:30:34 PST 2011


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: unassignedbugs at nondot.org
        ReportedBy: fvbommel at gmail.com
                CC: llvmbugs at cs.uiuc.edu


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.



More information about the llvm-bugs mailing list