aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/MachineBasicBlock.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-09-18 08:16:04 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-09-18 08:16:04 +0000
commitf8a56255a54bf60d0cfa6b20d10dad969cce9f81 (patch)
treeab02b516f483c2c622f62eb4dea11716585ac889 /include/llvm/CodeGen/MachineBasicBlock.h
parent1134dc5cc0cb83abcdf072dc4300cd7a898f830c (diff)
downloadexternal_llvm-f8a56255a54bf60d0cfa6b20d10dad969cce9f81.zip
external_llvm-f8a56255a54bf60d0cfa6b20d10dad969cce9f81.tar.gz
external_llvm-f8a56255a54bf60d0cfa6b20d10dad969cce9f81.tar.bz2
Fix a bug in sdisel switch lowering code. When it updates the phi nodes in switch successor blocks, it can introduce multiple phi operands of the same value from different blocks (and may not be on the predecessor list).
This can be seen on CodeGen/Generic/2006-09-06-SwitchLowering.ll. But it's not known to cause any real regression (but I have added an assertion for it now). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineBasicBlock.h')
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 2a9e86a..2bfb1ba 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -149,6 +149,10 @@ public:
return (unsigned)Predecessors.size();
}
bool pred_empty() const { return Predecessors.empty(); }
+ bool isPred(MachineBasicBlock *MBB) const {
+ return std::find(pred_begin(), pred_end(), MBB) != pred_end();
+ }
+
succ_iterator succ_begin() { return Successors.begin(); }
const_succ_iterator succ_begin() const { return Successors.begin(); }
succ_iterator succ_end() { return Successors.end(); }
@@ -165,6 +169,9 @@ public:
return (unsigned)Successors.size();
}
bool succ_empty() const { return Successors.empty(); }
+ bool isSucc(MachineBasicBlock *MBB) const {
+ return std::find(succ_begin(), succ_end(), MBB) != succ_end();
+ }
// LiveIn management methods.