[llvm] r198349 - Allow addrspacecast in global aliases
Matt Arsenault
Matthew.Arsenault at amd.com
Thu Jan 2 12:55:01 PST 2014
Author: arsenm
Date: Thu Jan 2 14:55:01 2014
New Revision: 198349
URL: http://llvm.org/viewvc/llvm-project?rev=198349&view=rev
Log:
Allow addrspacecast in global aliases
Added:
llvm/trunk/test/Assembler/addrspacecast-alias.ll
Modified:
llvm/trunk/lib/IR/Globals.cpp
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/lib/IR/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=198349&r1=198348&r2=198349&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Globals.cpp (original)
+++ llvm/trunk/lib/IR/Globals.cpp Thu Jan 2 14:55:01 2014
@@ -237,7 +237,8 @@ GlobalValue *GlobalAlias::getAliasedGlob
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");
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=198349&r1=198348&r2=198349&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Thu Jan 2 14:55:01 2014
@@ -550,9 +550,11 @@ void Verifier::visitGlobalAlias(GlobalAl
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) {
Added: llvm/trunk/test/Assembler/addrspacecast-alias.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/addrspacecast-alias.ll?rev=198349&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/addrspacecast-alias.ll (added)
+++ llvm/trunk/test/Assembler/addrspacecast-alias.ll Thu Jan 2 14:55:01 2014
@@ -0,0 +1,6 @@
+; RUN: llvm-as -disable-output %s
+
+; Test that global aliases are allowed to be constant addrspacecast
+
+ at i = internal addrspace(1) global i8 42
+ at ia = alias internal i8 addrspace(2)* addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)*)
More information about the llvm-commits
mailing list