[PATCH] D11208: Fix mergefunc infinite loop
    Nick Lewycky 
    nlewycky at google.com
       
    Tue Jul 14 18:19:03 PDT 2015
    
    
  
nlewycky added inline comments.
================
Comment at: lib/Transforms/IPO/MergeFunctions.cpp:1517-1520
@@ -1516,4 +1516,6 @@
 void MergeFunctions::removeUsers(Value *V) {
   std::vector<Value *> Worklist;
   Worklist.push_back(V);
+  SmallSet<Value*, 8> visited;
+  visited.insert(V);
   while (!Worklist.empty()) {
----------------
Just FYI as an optional alternative. You could use a single SetVector for both, call insert() to insert into it, track your position with an increasing integer, and never remove from it.
The way you've written it here is more common in llvm, I think.
================
Comment at: lib/Transforms/IPO/MergeFunctions.cpp:1520
@@ -1519,1 +1519,3 @@
+  SmallSet<Value*, 8> visited;
+  visited.insert(V);
   while (!Worklist.empty()) {
----------------
"Variable names should be nouns (as they represent state). The name should be camel case, and start with an upper case letter (e.g. Leader or Boats)."  - http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
http://reviews.llvm.org/D11208
    
    
More information about the llvm-commits
mailing list