1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Avoid repeated calls to CE->getOperand(0). No functionality change.

llvm-svn: 203686
This commit is contained in:
Rafael Espindola 2014-03-12 18:08:14 +00:00
parent 4305369df5
commit 8e9eeafecd

View File

@ -479,20 +479,21 @@ void Verifier::visitGlobalAlias(const GlobalAlias &GA) {
Assert1(!GA.getAlignment(), "Alias connot have an alignment", &GA); Assert1(!GA.getAlignment(), "Alias connot have an alignment", &GA);
const Constant *Aliasee = GA.getAliasee(); 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); const ConstantExpr *CE = dyn_cast<ConstantExpr>(Aliasee);
Assert1(CE && if (CE && (CE->getOpcode() == Instruction::BitCast ||
(CE->getOpcode() == Instruction::BitCast || CE->getOpcode() == Instruction::AddrSpaceCast ||
CE->getOpcode() == Instruction::AddrSpaceCast || CE->getOpcode() == Instruction::GetElementPtr))
CE->getOpcode() == Instruction::GetElementPtr) && GV = dyn_cast<GlobalValue>(CE->getOperand(0));
isa<GlobalValue>(CE->getOperand(0)),
"Aliasee should be either GlobalValue, bitcast or " Assert1(GV, "Aliasee should be either GlobalValue, bitcast or "
"addrspacecast of GlobalValue", "addrspacecast of GlobalValue",
&GA); &GA);
if (CE->getOpcode() == Instruction::BitCast) { if (CE->getOpcode() == Instruction::BitCast) {
unsigned SrcAS = CE->getOperand(0)->getType()->getPointerAddressSpace(); unsigned SrcAS = GV->getType()->getPointerAddressSpace();
unsigned DstAS = CE->getType()->getPointerAddressSpace(); unsigned DstAS = CE->getType()->getPointerAddressSpace();
Assert1(SrcAS == DstAS, Assert1(SrcAS == DstAS,