[Mesa-dev] [PATCH 1/2] R600: Fix use iterator in custom select of ISD::Constant

Tom Stellard tom at stellard.net
Thu Dec 6 14:09:50 PST 2012


From: Tom Stellard <thomas.stellard at amd.com>

The use list may change during the execution of the loop, so we
need to manually keep track of the next item in the list.
---
 lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp b/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp
index a765438..5a98463 100644
--- a/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp
+++ b/lib/Target/AMDGPU/AMDILISelDAGToDAG.cpp
@@ -208,8 +208,9 @@ SDNode *AMDGPUDAGToDAGISel::Select(SDNode *N) {
       }
     }
 
-    for (SDNode::use_iterator Use = N->use_begin(), E = SDNode::use_end();
-                                                    Use != E; ++Use) {
+    for (SDNode::use_iterator Use = N->use_begin(), Next = llvm::next(Use);
+                              Use != SDNode::use_end(); Use = Next) {
+      Next = llvm::next(Use);
       std::vector<SDValue> Ops;
       for (unsigned i = 0; i < Use->getNumOperands(); ++i) {
         Ops.push_back(Use->getOperand(i));
-- 
1.7.11.4



More information about the mesa-dev mailing list