From d7313c560855555796a7a0e1ec39b7c2059e0542 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Sat, 23 Feb 2008 00:47:00 +0000 Subject: [PATCH] Use dyn_cast instead of isa + cast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47511 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Instructions.h | 6 +++++- lib/VMCore/AsmWriter.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 8d912f23702..1335031e5a3 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -2375,7 +2375,11 @@ public: return getOperand(0); } - unsigned getIndex() { + inline unsigned getIndex() { + return Idx; + } + + inline const unsigned getIndex() const { return Idx; } diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 8a7eec9b048..adbcd78c25f 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1291,7 +1291,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { writeOperand(I.getOperand(op ), false); Out << ','; writeOperand(I.getOperand(op+1), false); Out << " ]"; } - } else if (isa(I)) { + } else if (const GetResultInst *GRI = dyn_cast(&I)) { const StructType *STy = cast(I.getOperand(0)->getType()); unsigned NumElems = STy->getNumElements(); Out << " {"; @@ -1303,7 +1303,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { } Out << " }"; writeOperand(I.getOperand(0), false); - Out << ", " << cast(I).getIndex(); + Out << ", " << GRI->getIndex(); } else if (isa(I) && !Operand) { Out << " void"; } else if (const CallInst *CI = dyn_cast(&I)) {