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
This commit is contained in:
Rafael Espindola 2014-03-12 18:08:14 +00:00
parent 77d21e8550
commit 79d1854dc2

View File

@ -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<GlobalValue>(Aliasee);
if (!isa<GlobalValue>(Aliasee)) {
if (!GV) {
const ConstantExpr *CE = dyn_cast<ConstantExpr>(Aliasee);
Assert1(CE &&
(CE->getOpcode() == Instruction::BitCast ||
CE->getOpcode() == Instruction::AddrSpaceCast ||
CE->getOpcode() == Instruction::GetElementPtr) &&
isa<GlobalValue>(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<GlobalValue>(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,