summaryrefslogtreecommitdiff
path: root/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-12 18:08:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-12 18:08:14 +0000
commit79d1854dc2fa09a7975e03006d7c28124aeecb6e (patch)
tree2fb6e47666d78ec0a47db96de4440f4e2ee85ab4 /lib/IR/Verifier.cpp
parent77d21e8550c936b44dfe7d0e65fec19a5c56ea9f (diff)
downloadllvm-79d1854dc2fa09a7975e03006d7c28124aeecb6e.tar.gz
llvm-79d1854dc2fa09a7975e03006d7c28124aeecb6e.tar.bz2
llvm-79d1854dc2fa09a7975e03006d7c28124aeecb6e.tar.xz
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
Diffstat (limited to 'lib/IR/Verifier.cpp')
-rw-r--r--lib/IR/Verifier.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 4bdc1c13d0..fcdbac2f9f 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<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,