[llvm-commits] [llvm] r152763 - /llvm/trunk/lib/Analysis/InlineCost.cpp

Chandler Carruth chandlerc at gmail.com
Wed Mar 14 17:50:22 PDT 2012


Author: chandlerc
Date: Wed Mar 14 19:50:21 2012
New Revision: 152763

URL: http://llvm.org/viewvc/llvm-project?rev=152763&view=rev
Log:
Don't assume that the arguments are processed in some particular order.
This appears to not be the case with dragonegg at least in some
contexts. Hopefully will fix the bootstrap assert failure there.

Modified:
    llvm/trunk/lib/Analysis/InlineCost.cpp

Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=152763&r1=152762&r2=152763&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Wed Mar 14 19:50:21 2012
@@ -434,9 +434,11 @@
         = PointerArgs.find(OtherArg);
       if (ArgIt == PointerArgs.end())
         continue;
-      assert(ArgIt->second < ArgIdx);
+      std::pair<unsigned, unsigned> ArgPair(ArgIt->second, ArgIdx);
+      if (ArgIt->second > ArgIdx)
+        std::swap(ArgPair.first, ArgPair.second);
 
-      PointerArgPairWeights[std::make_pair(ArgIt->second, ArgIdx)]
+      PointerArgPairWeights[ArgPair]
         += countCodeReductionForConstant(Metrics, I);
     }
   } while (!Worklist.empty());





More information about the llvm-commits mailing list