Let Verifier check aliasees
authorAnton Korobeynikov <asl@math.spbu.ru>
Sat, 28 Apr 2007 14:35:41 +0000 (14:35 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sat, 28 Apr 2007 14:35:41 +0000 (14:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36540 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 01eb860f911b108db91028ebcdcf2389bb12fcbe..c580e70d84eaabdba4577a669ec8b03a194b6162 100644 (file)
@@ -319,6 +319,13 @@ void Verifier::visitGlobalAlias(GlobalAlias &GA) {
   Assert1(GA.getType() == GA.getAliasee()->getType(),
           "Alias and aliasee types should match!", &GA);
   
+  if (!isa<GlobalValue>(GA.getAliasee())) {
+    const ConstantExpr *CE = dyn_cast<ConstantExpr>(GA.getAliasee());
+    Assert1(CE && CE->getOpcode() == Instruction::BitCast,
+            "Aliasee should be either GlobalValue or bitcast of GlobalValue",
+            &GA);
+  }
+  
   visitGlobalValue(GA);
 }