[llvm-commits] CVS: llvm/lib/VMCore/iMemory.cpp

John Criswell criswell at cs.uiuc.edu
Thu May 6 16:19:02 PDT 2004


Changes in directory llvm/lib/VMCore:

iMemory.cpp updated: 1.36 -> 1.37

---
Log message:

Fix for PR#330.
When looking at getelementptr instructions, make sure to use a forwarded
type.  We want to do this because a DerivedType may drop its uses and then
refine its users, who may then use another user who hasn't been refined yet.
By getting the forwarded type, we always ensure that we're looking at a
Type that isn't in a halfway refined state.

Now, I should be able to put this stuff in PATypeHandle, but it doesn't work
for some reason.  This should do for now.



---
Diffs of the changes:  (+8 -0)

Index: llvm/lib/VMCore/iMemory.cpp
diff -u llvm/lib/VMCore/iMemory.cpp:1.36 llvm/lib/VMCore/iMemory.cpp:1.37
--- llvm/lib/VMCore/iMemory.cpp:1.36	Sun Apr  4 20:30:19 2004
+++ llvm/lib/VMCore/iMemory.cpp	Thu May  6 16:18:08 2004
@@ -156,6 +156,14 @@
       return 0;  // Can only index into pointer types at the first index!
     if (!CT->indexValid(Index)) return 0;
     Ptr = CT->getTypeAtIndex(Index);
+
+    // If the new type forwards to another type, then it is in the middle
+    // of being refined to another type (and hence, may have dropped all
+    // references to what it was using before).  So, use the new forwarded
+    // type.
+    if (Ptr->getForwardedType()) {
+      Ptr = Ptr->getForwardedType();
+    }
   }
   return CurIdx == Idx.size() ? Ptr : 0;
 }





More information about the llvm-commits mailing list