From 8b01c82f25aaea12340f53789ba59a2527713b9e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 28 Jan 2012 06:22:14 +0000 Subject: [PATCH] Small improvement to the recursion detection logic from the previous commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149175 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/AsmParser.cpp | 4 +++- test/MC/AsmParser/variables-invalid.s | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 8acdf384004..c5a483c1448 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1565,7 +1565,9 @@ static bool IsUsedIn(const MCSymbol *Sym, const MCExpr *Value) { return false; case MCExpr::SymbolRef: { const MCSymbol &S = static_cast(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(Value)->getSubExpr()); diff --git a/test/MC/AsmParser/variables-invalid.s b/test/MC/AsmParser/variables-invalid.s index c0f6c398767..21758d20c8b 100644 --- a/test/MC/AsmParser/variables-invalid.s +++ b/test/MC/AsmParser/variables-invalid.s @@ -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