Let Verifier check aliasees
[oota-llvm.git] / 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);
 }