diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-01-28 06:22:14 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-01-28 06:22:14 +0000 |
commit | 004725876e928b1f8ee6bd1a7c487faaa0be4ac4 (patch) | |
tree | 1c21bef63b72ffe4923eaedc08496408637045f9 | |
parent | 72f5f170c6bd1503dfebf7200e815e0952584064 (diff) | |
download | bcm5719-llvm-004725876e928b1f8ee6bd1a7c487faaa0be4ac4.tar.gz bcm5719-llvm-004725876e928b1f8ee6bd1a7c487faaa0be4ac4.zip |
Small improvement to the recursion detection logic from the previous commit.
llvm-svn: 149175
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 4 | ||||
-rw-r--r-- | llvm/test/MC/AsmParser/variables-invalid.s | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 8acdf384004..c5a483c1448 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/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<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()); diff --git a/llvm/test/MC/AsmParser/variables-invalid.s b/llvm/test/MC/AsmParser/variables-invalid.s index c0f6c398767..21758d20c8b 100644 --- a/llvm/test/MC/AsmParser/variables-invalid.s +++ b/llvm/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 |