mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Allow aliasee to be a GEP or bitcast instead of just a bitcast.
The real fix for this whole mess is to require the operand of the alias to be a *GlobalValue* (not a general constant, including constant exprs) but allow the operand and the alias type to be unrelated. This fixes PR4066 llvm-svn: 70079
This commit is contained in:
parent
c23e28732d
commit
034358326a
@ -1317,12 +1317,12 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
|
||||
Out << ' ';
|
||||
PrintLLVMName(Out, GA);
|
||||
} else {
|
||||
const ConstantExpr *CE = 0;
|
||||
if ((CE = dyn_cast<ConstantExpr>(Aliasee)) &&
|
||||
(CE->getOpcode() == Instruction::BitCast)) {
|
||||
writeOperand(CE, false);
|
||||
} else
|
||||
assert(0 && "Unsupported aliasee");
|
||||
const ConstantExpr *CE = cast<ConstantExpr>(Aliasee);
|
||||
// The only valid GEP is an all zero GEP.
|
||||
assert((CE->getOpcode() == Instruction::BitCast ||
|
||||
CE->getOpcode() == Instruction::GetElementPtr) &&
|
||||
"Unsupported aliasee");
|
||||
writeOperand(CE, false);
|
||||
}
|
||||
|
||||
printInfoComment(*GA);
|
||||
|
@ -427,7 +427,9 @@ void Verifier::visitGlobalAlias(GlobalAlias &GA) {
|
||||
|
||||
if (!isa<GlobalValue>(GA.getAliasee())) {
|
||||
const ConstantExpr *CE = dyn_cast<ConstantExpr>(GA.getAliasee());
|
||||
Assert1(CE && CE->getOpcode() == Instruction::BitCast &&
|
||||
Assert1(CE &&
|
||||
(CE->getOpcode() == Instruction::BitCast ||
|
||||
CE->getOpcode() == Instruction::GetElementPtr) &&
|
||||
isa<GlobalValue>(CE->getOperand(0)),
|
||||
"Aliasee should be either GlobalValue or bitcast of GlobalValue",
|
||||
&GA);
|
||||
|
Loading…
x
Reference in New Issue
Block a user