diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reg2Mem.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reg2Mem.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reg2Mem.cpp b/llvm/lib/Transforms/Scalar/Reg2Mem.cpp index 25fbec2f291..d9809ce6ef4 100644 --- a/llvm/lib/Transforms/Scalar/Reg2Mem.cpp +++ b/llvm/lib/Transforms/Scalar/Reg2Mem.cpp @@ -45,12 +45,11 @@ namespace { AU.addPreservedID(BreakCriticalEdgesID); } - bool valueEscapes(const Instruction *Inst) const { - const BasicBlock *BB = Inst->getParent(); - for (Value::const_use_iterator UI = Inst->use_begin(),E = Inst->use_end(); - UI != E; ++UI) { - const Instruction *I = cast<Instruction>(*UI); - if (I->getParent() != BB || isa<PHINode>(I)) + bool valueEscapes(const Instruction *Inst) const { + const BasicBlock *BB = Inst->getParent(); + for (const User *U : Inst->users()) { + const Instruction *UI = cast<Instruction>(U); + if (UI->getParent() != BB || isa<PHINode>(UI)) return true; } return false; |