[llvm-commits] [llvm] r102196 - in /llvm/trunk: include/llvm/Transforms/Utils/Cloning.h lib/Transforms/IPO/Inliner.cpp lib/Transforms/Utils/InlineFunction.cpp

Chris Lattner sabre at nondot.org
Fri Apr 23 11:37:02 PDT 2010


Author: lattner
Date: Fri Apr 23 13:37:01 2010
New Revision: 102196

URL: http://llvm.org/viewvc/llvm-project?rev=102196&view=rev
Log:
switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.
This fixes a bug where calls inlined into an invoke would get
changed into an invoke but the array would keep pointing to
the (now dead) call.  The improved inliner behavior is still
disabled for now.

Modified:
    llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp
    llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp

Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=102196&r1=102195&r2=102196&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Fri Apr 23 13:37:01 2010
@@ -21,6 +21,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 
@@ -178,7 +179,7 @@
   /// DevirtualizedCalls - InlineFunction fills this in with callsites that were
   /// inlined from the callee that went from being indirect calls to direct
   /// calls due to inlining.  This is only filled in if CG is non-null.
-  SmallVector<Instruction*, 2> DevirtualizedCalls;
+  SmallVector<WeakVH, 2> DevirtualizedCalls;
   
   void reset() {
     StaticAllocas.clear();

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=102196&r1=102195&r2=102196&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Fri Apr 23 13:37:01 2010
@@ -392,8 +392,10 @@
         // onto our worklist to process.  They are useful inline candidates.
 #if 0
         for (unsigned i = 0, e = InlineInfo.DevirtualizedCalls.size();
-             i != e; ++i)
-          CallSites.push_back(CallSite(InlineInfo.DevirtualizedCalls[i]));
+             i != e; ++i) {
+          Value *Ptr = InlineInfo.DevirtualizedCalls[i];
+          CallSites.push_back(CallSite(Ptr));
+        }
 #endif
         
         // Update the cached cost info with the inlined call.

Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=102196&r1=102195&r2=102196&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Fri Apr 23 13:37:01 2010
@@ -72,7 +72,7 @@
     II->setAttributes(CI->getAttributes());
     
     // Make sure that anything using the call now uses the invoke!  This also
-    // updates the CallGraph if present.
+    // updates the CallGraph if present, because it uses a WeakVH.
     CI->replaceAllUsesWith(II);
     
     // Delete the unconditional branch inserted by splitBasicBlock





More information about the llvm-commits mailing list