Make HValue::ActualValue() traverse all idefs.
authortitzer@chromium.org <titzer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 16 Sep 2013 12:44:28 +0000 (12:44 +0000)
committertitzer@chromium.org <titzer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 16 Sep 2013 12:44:28 +0000 (12:44 +0000)
BUG=
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/23691064

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16732 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-alias-analysis.h
src/hydrogen-instructions.h

index 73e116e..21a5462 100644 (file)
@@ -88,15 +88,6 @@ class HAliasAnalyzer : public ZoneObject {
   inline bool NoAlias(HValue* a, HValue* b) {
     return Query(a, b) == kNoAlias;
   }
-
-  // Returns the actual value of an instruction. In the case of a chain
-  // of informative definitions, return the root of the chain.
-  HValue* ActualValue(HValue* obj) {
-    while (obj->IsInformativeDefinition()) {  // Walk a chain of idefs.
-      obj = obj->RedefinedOperand();
-    }
-    return obj;
-  }
 };
 
 
index 7d3b879..4a502ba 100644 (file)
@@ -782,11 +782,15 @@ class HValue : public ZoneObject {
   // phase (so that live ranges will be shorter).
   virtual bool IsPurelyInformativeDefinition() { return false; }
 
-  // This method must always return the original HValue SSA definition
-  // (regardless of any iDef of this value).
+  // This method must always return the original HValue SSA definition,
+  // regardless of any chain of iDefs of this value.
   HValue* ActualValue() {
-    int index = RedefinedOperandIndex();
-    return index == kNoRedefinedOperand ? this : OperandAt(index);
+    HValue* value = this;
+    int index;
+    while ((index = value->RedefinedOperandIndex()) != kNoRedefinedOperand) {
+      value = value->OperandAt(index);
+    }
+    return value;
   }
 
   bool IsInteger32Constant();