[c++11] Range'ify use list loops in DAGCombiner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2014-04-11 01:13:13 +00:00
parent a117c712c7
commit 84f004436a

View File

@ -120,9 +120,8 @@ namespace {
/// now. /// now.
/// ///
void AddUsersToWorkList(SDNode *N) { void AddUsersToWorkList(SDNode *N) {
for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end(); for (SDNode *Node : N->uses())
UI != UE; ++UI) AddToWorkList(Node);
AddToWorkList(*UI);
} }
/// visit - call the node-specific routine that knows how to fold each /// visit - call the node-specific routine that knows how to fold each
@ -7622,9 +7621,7 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
// a copy of the original base pointer. // a copy of the original base pointer.
SmallVector<SDNode *, 16> OtherUses; SmallVector<SDNode *, 16> OtherUses;
if (isa<ConstantSDNode>(Offset)) if (isa<ConstantSDNode>(Offset))
for (SDNode::use_iterator I = BasePtr.getNode()->use_begin(), for (SDNode *Use : BasePtr.getNode()->uses()) {
E = BasePtr.getNode()->use_end(); I != E; ++I) {
SDNode *Use = *I;
if (Use == Ptr.getNode()) if (Use == Ptr.getNode())
continue; continue;
@ -7666,9 +7663,7 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
SmallPtrSet<const SDNode *, 32> Visited; SmallPtrSet<const SDNode *, 32> Visited;
SmallVector<const SDNode *, 16> Worklist; SmallVector<const SDNode *, 16> Worklist;
for (SDNode::use_iterator I = Ptr.getNode()->use_begin(), for (SDNode *Use : Ptr.getNode()->uses()) {
E = Ptr.getNode()->use_end(); I != E; ++I) {
SDNode *Use = *I;
if (Use == N) if (Use == N)
continue; continue;
if (N->hasPredecessorHelper(Use, Visited, Worklist)) if (N->hasPredecessorHelper(Use, Visited, Worklist))
@ -7804,9 +7799,7 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) {
if (Ptr.getNode()->hasOneUse()) if (Ptr.getNode()->hasOneUse())
return false; return false;
for (SDNode::use_iterator I = Ptr.getNode()->use_begin(), for (SDNode *Op : Ptr.getNode()->uses()) {
E = Ptr.getNode()->use_end(); I != E; ++I) {
SDNode *Op = *I;
if (Op == N || if (Op == N ||
(Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB)) (Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB))
continue; continue;
@ -7832,9 +7825,7 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) {
// Check for #1. // Check for #1.
bool TryNext = false; bool TryNext = false;
for (SDNode::use_iterator II = BasePtr.getNode()->use_begin(), for (SDNode *Use : BasePtr.getNode()->uses()) {
EE = BasePtr.getNode()->use_end(); II != EE; ++II) {
SDNode *Use = *II;
if (Use == Ptr.getNode()) if (Use == Ptr.getNode())
continue; continue;
@ -7842,9 +7833,7 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) {
// transformation. // transformation.
if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){
bool RealUse = false; bool RealUse = false;
for (SDNode::use_iterator III = Use->use_begin(), for (SDNode *UseUse : Use->uses()) {
EEE = Use->use_end(); III != EEE; ++III) {
SDNode *UseUse = *III;
if (!canFoldInAddressingMode(Use, UseUse, DAG, TLI)) if (!canFoldInAddressingMode(Use, UseUse, DAG, TLI))
RealUse = true; RealUse = true;
} }