Small improvement to the recursion detection logic from the previous commit.
authorRafael Espindola <rafael.espindola@gmail.com>
Sat, 28 Jan 2012 06:22:14 +0000 (06:22 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sat, 28 Jan 2012 06:22:14 +0000 (06:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149175 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/variables-invalid.s

index 8acdf38400410b6ceea0234eafa8e2e194f5aa0e..c5a483c1448ad3c68266d4075b5d00dd26960b34 100644 (file)
@@ -1565,7 +1565,9 @@ static bool IsUsedIn(const MCSymbol *Sym, const MCExpr *Value) {
     return false;
   case MCExpr::SymbolRef: {
     const MCSymbol &S = static_cast<const MCSymbolRefExpr*>(Value)->getSymbol();
-    return &S.AliasedSymbol() == Sym;
+    if (S.isVariable())
+      return IsUsedIn(Sym, S.getVariableValue());
+    return &S == Sym;
   }
   case MCExpr::Unary:
     return IsUsedIn(Sym, static_cast<const MCUnaryExpr*>(Value)->getSubExpr());
index c0f6c3987676c18e0d0c93048738f52c32e83b29..21758d20c8b2644738fc6b50a5520c0f91137681 100644 (file)
@@ -21,3 +21,7 @@ t2_s0:
         t4_s0 = t4_s1
         t4_s1 = t4_s2
         t4_s2 = t4_s0
+
+// CHECK: Recursive use of 't5_s1'
+        t5_s0 = t5_s1 + 1
+        t5_s1 = t5_s0