summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-06-04 20:28:22 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-06-04 20:28:22 +0000
commit9ff058b674b6cda18207bcbabd7d5999892fca57 (patch)
tree309831c3d0e8b8f31524c7185118ecafb273bdaf /llvm/lib/CodeGen/RegAllocLinearScan.cpp
parent60fdf787a79a2f5025f49feee4238d8dd4f13ecf (diff)
downloadbcm5719-llvm-9ff058b674b6cda18207bcbabd7d5999892fca57.tar.gz
bcm5719-llvm-9ff058b674b6cda18207bcbabd7d5999892fca57.zip
A value defined by an implicit_def can be liven to a use BB. This is unfortunate. But register allocator still has to add it to the live-in set of the use BB.
llvm-svn: 72889
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocLinearScan.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp
index 0ef97c139df..ab4068e6e4c 100644
--- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/llvm/lib/CodeGen/RegAllocLinearScan.cpp
@@ -542,6 +542,24 @@ void RALinScan::linearScan()
// Ignore splited live intervals.
if (!isPhys && vrm_->getPreSplitReg(cur.reg))
continue;
+
+ // A register defined by an implicit_def can be liveout the def BB and livein
+ // to a use BB. Add it to the livein set of the use BB's.
+ if (!isPhys && cur.empty()) {
+ if (MachineInstr *DefMI = mri_->getVRegDef(cur.reg)) {
+ assert(DefMI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF);
+ MachineBasicBlock *DefMBB = DefMI->getParent();
+ SmallPtrSet<MachineBasicBlock*, 4> Seen;
+ Seen.insert(DefMBB);
+ for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(cur.reg),
+ re = mri_->reg_end(); ri != re; ++ri) {
+ MachineInstr *UseMI = &*ri;
+ MachineBasicBlock *UseMBB = UseMI->getParent();
+ if (Seen.insert(UseMBB))
+ UseMBB->addLiveIn(Reg);
+ }
+ }
+ }
for (LiveInterval::Ranges::const_iterator I = cur.begin(), E = cur.end();
I != E; ++I) {
const LiveRange &LR = *I;
OpenPOWER on IntegriCloud