mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Allow addrspacecast in global aliases
llvm-svn: 198349
This commit is contained in:
parent
91f4861f4f
commit
1933b66fad
@ -237,7 +237,8 @@ GlobalValue *GlobalAlias::getAliasedGlobal() {
|
||||
return GV;
|
||||
|
||||
ConstantExpr *CE = cast<ConstantExpr>(C);
|
||||
assert((CE->getOpcode() == Instruction::BitCast ||
|
||||
assert((CE->getOpcode() == Instruction::BitCast ||
|
||||
CE->getOpcode() == Instruction::AddrSpaceCast ||
|
||||
CE->getOpcode() == Instruction::GetElementPtr) &&
|
||||
"Unsupported aliasee");
|
||||
|
||||
|
@ -550,9 +550,11 @@ void Verifier::visitGlobalAlias(GlobalAlias &GA) {
|
||||
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 or bitcast of GlobalValue",
|
||||
"Aliasee should be either GlobalValue, bitcast or "
|
||||
"addrspacecast of GlobalValue",
|
||||
&GA);
|
||||
|
||||
if (CE->getOpcode() == Instruction::BitCast) {
|
||||
|
6
test/Assembler/addrspacecast-alias.ll
Normal file
6
test/Assembler/addrspacecast-alias.ll
Normal file
@ -0,0 +1,6 @@
|
||||
; RUN: llvm-as -disable-output %s
|
||||
|
||||
; Test that global aliases are allowed to be constant addrspacecast
|
||||
|
||||
@i = internal addrspace(1) global i8 42
|
||||
@ia = alias internal i8 addrspace(2)* addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)*)
|
Loading…
Reference in New Issue
Block a user