[llvm] r321813 - [DAGCombine] Ensure SDNode use iterator is incremented properly.

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 10:38:45 PST 2018


Author: aemerson
Date: Thu Jan  4 10:38:45 2018
New Revision: 321813

URL: http://llvm.org/viewvc/llvm-project?rev=321813&view=rev
Log:
[DAGCombine] Ensure SDNode use iterator is incremented properly.

Fixes an ASAN bug found by oss-fuzz.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=321813&r1=321812&r2=321813&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Jan  4 10:38:45 2018
@@ -2816,8 +2816,8 @@ SDValue DAGCombiner::useDivRem(SDNode *N
   SDValue Op1 = Node->getOperand(1);
   SDValue combined;
   for (SDNode::use_iterator UI = Op0.getNode()->use_begin(),
-         UE = Op0.getNode()->use_end(); UI != UE;) {
-    SDNode *User = *UI++;
+         UE = Op0.getNode()->use_end(); UI != UE; ++UI) {
+    SDNode *User = *UI;
     if (User == Node || User->use_empty())
       continue;
     // Convert the other matching node(s), too;




More information about the llvm-commits mailing list