From 79d1854dc2fa09a7975e03006d7c28124aeecb6e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 12 Mar 2014 18:08:14 +0000 Subject: [PATCH] Avoid repeated calls to CE->getOperand(0). No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203686 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Verifier.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 4bdc1c13d03..fcdbac2f9f6 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -479,20 +479,21 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) { Assert1(!GA.getAlignment(), "Alias connot have an alignment", &GA); const Constant *Aliasee = GA.getAliasee(); + const GlobalValue *GV = dyn_cast(Aliasee); - if (!isa(Aliasee)) { + if (!GV) { const ConstantExpr *CE = dyn_cast(Aliasee); - Assert1(CE && - (CE->getOpcode() == Instruction::BitCast || - CE->getOpcode() == Instruction::AddrSpaceCast || - CE->getOpcode() == Instruction::GetElementPtr) && - isa(CE->getOperand(0)), - "Aliasee should be either GlobalValue, bitcast or " - "addrspacecast of GlobalValue", + if (CE && (CE->getOpcode() == Instruction::BitCast || + CE->getOpcode() == Instruction::AddrSpaceCast || + CE->getOpcode() == Instruction::GetElementPtr)) + GV = dyn_cast(CE->getOperand(0)); + + Assert1(GV, "Aliasee should be either GlobalValue, bitcast or " + "addrspacecast of GlobalValue", &GA); if (CE->getOpcode() == Instruction::BitCast) { - unsigned SrcAS = CE->getOperand(0)->getType()->getPointerAddressSpace(); + unsigned SrcAS = GV->getType()->getPointerAddressSpace(); unsigned DstAS = CE->getType()->getPointerAddressSpace(); Assert1(SrcAS == DstAS,