summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-05 20:36:28 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-05 20:36:28 +0000
commit671bab1c7db2f166e9e19b9771dc0865d97a6431 (patch)
tree4b19d283623d70e08bbd6c0d9c7c0de9d8320e5a /llvm/lib/CodeGen
parentb0cedd5f96b4c3377e65c347c129bf19567c49bc (diff)
downloadbcm5719-llvm-671bab1c7db2f166e9e19b9771dc0865d97a6431.tar.gz
bcm5719-llvm-671bab1c7db2f166e9e19b9771dc0865d97a6431.zip
When we find a reaching definition, make sure it is visited from all paths by
erasing it from the visited set. That ensures we create the right phi defs. llvm-svn: 115666
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SplitKit.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp
index 062194586ff..cce97fdb67d 100644
--- a/llvm/lib/CodeGen/SplitKit.cpp
+++ b/llvm/lib/CodeGen/SplitKit.cpp
@@ -424,10 +424,14 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
// This may change during the DFS as we create new phi-defs.
typedef DenseMap<MachineBasicBlock*, VNInfo*> MBBValueMap;
MBBValueMap DomValue;
-
- for (idf_iterator<MachineBasicBlock*>
- IDFI = idf_begin(IdxMBB),
- IDFE = idf_end(IdxMBB); IDFI != IDFE;) {
+ typedef SplitAnalysis::BlockPtrSet BlockPtrSet;
+ BlockPtrSet Visited;
+
+ // Iterate over IdxMBB predecessors in a depth-first order.
+ // Skip begin() since that is always IdxMBB.
+ for (idf_ext_iterator<MachineBasicBlock*, BlockPtrSet>
+ IDFI = llvm::next(idf_ext_begin(IdxMBB, Visited)),
+ IDFE = idf_ext_end(IdxMBB, Visited); IDFI != IDFE;) {
MachineBasicBlock *MBB = *IDFI;
SlotIndex End = lis_.getMBBEndIdx(MBB).getPrevSlot();
@@ -444,7 +448,10 @@ VNInfo *LiveIntervalMap::mapValue(const VNInfo *ParentVNI, SlotIndex Idx,
continue;
}
- // Yes, VNI dominates MBB. Track the path back to IdxMBB, creating phi-defs
+ // Yes, VNI dominates MBB. Make sure we visit MBB again from other paths.
+ Visited.erase(MBB);
+
+ // Track the path back to IdxMBB, creating phi-defs
// as needed along the way.
for (unsigned PI = IDFI.getPathLength()-1; PI != 0; --PI) {
// Start from MBB's immediate successor. End at IdxMBB.
OpenPOWER on IntegriCloud