[PATCH] Allow addrspacecast in global aliases
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Dec 13 09:54:19 PST 2013
http://llvm-reviews.chandlerc.com/D2404
Files:
lib/IR/Globals.cpp
lib/IR/Verifier.cpp
test/Verifier/addrspacecast-alias.ll
Index: lib/IR/Globals.cpp
===================================================================
--- lib/IR/Globals.cpp
+++ lib/IR/Globals.cpp
@@ -237,7 +237,8 @@
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");
Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -550,9 +550,11 @@
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) {
Index: test/Verifier/addrspacecast-alias.ll
===================================================================
--- /dev/null
+++ test/Verifier/addrspacecast-alias.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-as -verify -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)*)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2404.1.patch
Type: text/x-patch
Size: 1663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131213/cf2c9c0c/attachment.bin>
More information about the llvm-commits
mailing list