[llvm-commits] [llvm] r56224 - in /llvm/branches/ggreif/use-diet: include/llvm/Use.h lib/VMCore/getValue.cpp

Gabor Greif ggreif at gmail.com
Mon Sep 15 12:15:30 PDT 2008


Author: ggreif
Date: Mon Sep 15 14:15:29 2008
New Revision: 56224

URL: http://llvm.org/viewvc/llvm-project?rev=56224&view=rev
Log:
simplify

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

Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56224&r1=56223&r2=56224&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Mon Sep 15 14:15:29 2008
@@ -115,17 +115,9 @@
     bool P[] = { true, false, false, true };
     return P[T];
   }
-  inline Value *getFastValueMaybe() const;
 public:
-
-
   operator Value*() const { return get(); }
-  Value *get() const; /*{
-    if (Value *V = getFastValueMaybe())
-      return V;
-    else
-      return Val1; // for now :-)
-    }*/
+  inline Value *get() const;
   User *getUser() const;
   const Use* getImpliedUser() const;
   static Use *initTags(Use *Start, Use *Stop, ptrdiff_t Done = 0);
@@ -247,14 +239,12 @@
   unsigned getOperandNo() const;
 };
 
-Value *Use::getFastValueMaybe() const {
-  if (fullStopTagN == extractTag<NextPtrTag, tagMaskN>(Next)) {
-    return reinterpret_cast<Value*>(stripTag<tagMaskN>(Next));
-  }
-  return 0;
+Value *Use::get() const {
+  return fullStopTagN == extractTag<NextPtrTag, tagMaskN>(Next)
+    ? reinterpret_cast<Value*>(stripTag<tagMaskN>(Next))
+    : (Val1 == getValue() ? Val1 : 0); // should crash if not equal!
 }
 
-
 template<> struct simplify_type<value_use_iterator<User> > {
   typedef User* SimpleType;
   

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=56224&r1=56223&r2=56224&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Mon Sep 15 14:15:29 2008
@@ -63,11 +63,11 @@
 /// begins with a stop
 ///
 static inline void punchAwayDigits(Use *PrevU, Use **Uprev) {
+  Uprev = stripTag<Use::tagMask>(Uprev);
   if (PrevU)
-    assert(&PrevU->Next == stripTag<Use::tagMask>(Uprev) && "U->Prev differs from PrevU?");
+    assert(&PrevU->Next == Uprev && "U->Prev differs from PrevU?");
 
-    if (PrevU)
-        PrevU->Next = stripTag<Use::tagMaskN>(PrevU->Next);
+    *Uprev = stripTag<Use::tagMaskN>(*Uprev);
 }
 
 
@@ -292,20 +292,6 @@
   }
 }
 
-static bool again(false);
-
-Value *Use::get() const {
-  Value *V(Val1);
-  //  if ((size_t)V == 0x5b0d150)
-  //    getValue();
-  Value *ValComp(getValue());
-  if (V != ValComp)
-    assert(V == ValComp && "Computed Value wrong?");
-  if (again)
-    getValue();
-  return V;
-}
-
 static char TagChar(int Tag) {
   return "s10S"[Tag];
 }





More information about the llvm-commits mailing list