[llvm-commits] [llvm] r56855 - /llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp

Gabor Greif ggreif at gmail.com
Tue Sep 30 09:58:45 PDT 2008


Author: ggreif
Date: Tue Sep 30 11:58:44 2008
New Revision: 56855

URL: http://llvm.org/viewvc/llvm-project?rev=56855&view=rev
Log:
be sure to punchAwayDigits before repainting
also comment on the mild assumption I am relying on

Modified:
    llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp

Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56855&r1=56854&r2=56855&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Tue Sep 30 11:58:44 2008
@@ -123,12 +123,13 @@
         int digits = requiredSteps;
         Acc = 0;
 	Use* Tagspace = 0;
-        Use* OrigTagspace(Next);
+        Use* Orig(Next);
 
         while (1) {
 	    if (!digits) {
 	        if (Tagspace && Cushion <= -requiredSteps) {
-		    repaintByCopying(Tagspace, OrigTagspace);
+		    punchAwayDigits(Orig->Prev);
+		    repaintByCopying(Tagspace, Orig);
 	        }
                 return reinterpret_cast<Value*>(Acc << spareBits);
 	    }
@@ -151,9 +152,15 @@
                     goto efficiency;
                 }
                 default:
-		    if (digits == requiredSteps /*!Tagspace*/) {
-		        Tagspace = OrigTagspace;
-			OrigTagspace = (Use*)stripTag<Use::tagMask>(U->Prev);
+		    if (!Tagspace) {
+		        Tagspace = Orig;
+			// Exploit the fact that a pointer to Use::Next
+			// is identical to the pointer to the previous Use.
+			// This is a mild hack assuming Use::Next being the
+			// first member. At this point we can be certain
+			// that U->Prev points into a Use, because we have
+			// already seen a stop tag (precondition).
+			Orig = (Use*)stripTag<Use::tagMask>(U->Prev);
 		    }
                     --digits;
                     Acc = (Acc << 1) | (Tag & 1);





More information about the llvm-commits mailing list