diff options
| author | Dan Gohman <gohman@apple.com> | 2012-04-13 01:08:28 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2012-04-13 01:08:28 +0000 |
| commit | de8d2c446b088215133cd6db1915ab50841897a9 (patch) | |
| tree | 7430121a908e9aef88a664e3c59922394363c48f /llvm/lib | |
| parent | d239387098ff0ce0d13735e8f3df69e4efe46cea (diff) | |
| download | bcm5719-llvm-de8d2c446b088215133cd6db1915ab50841897a9.tar.gz bcm5719-llvm-de8d2c446b088215133cd6db1915ab50841897a9.zip | |
Use the new Use-aware dominates method to apply the objc runtime
library return value optimization for phi uses. Even when the
phi itself is not dominated, the specific use may be dominated.
llvm-svn: 154647
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ObjCARC.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp index 62c4694616f..40b0b206168 100644 --- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp +++ b/llvm/lib/Transforms/Scalar/ObjCARC.cpp @@ -4109,16 +4109,12 @@ bool ObjCARCContract::runOnFunction(Function &F) { Use &U = UI.getUse(); unsigned OperandNo = UI.getOperandNo(); ++UI; // Increment UI now, because we may unlink its element. - Instruction *UserInst = dyn_cast<Instruction>(U.getUser()); - if (!UserInst) - continue; - // FIXME: dominates should return true for unreachable UserInst. - if (DT->isReachableFromEntry(UserInst->getParent()) && - DT->dominates(Inst, UserInst)) { + if (DT->isReachableFromEntry(U) && + DT->dominates(Inst, U)) { Changed = true; Instruction *Replacement = Inst; Type *UseTy = U.get()->getType(); - if (PHINode *PHI = dyn_cast<PHINode>(UserInst)) { + if (PHINode *PHI = dyn_cast<PHINode>(U.getUser())) { // For PHI nodes, insert the bitcast in the predecessor block. unsigned ValNo = PHINode::getIncomingValueNumForOperand(OperandNo); @@ -4139,7 +4135,8 @@ bool ObjCARCContract::runOnFunction(Function &F) { } } else { if (Replacement->getType() != UseTy) - Replacement = new BitCastInst(Replacement, UseTy, "", UserInst); + Replacement = new BitCastInst(Replacement, UseTy, "", + cast<Instruction>(U.getUser())); U.set(Replacement); } } |

