Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2028,6 +2028,7 @@ // is reasonable to treat their delta as a 32-bit value. LLVM_FALLTHROUGH; case Instruction::BitCast: + case Instruction::AddrSpaceCast: return lowerConstant(CE->getOperand(0)); case Instruction::IntToPtr: { Index: test/CodeGen/X86/constant-with-addrspace-cast.ll =================================================================== --- /dev/null +++ test/CodeGen/X86/constant-with-addrspace-cast.ll @@ -0,0 +1,8 @@ +; RUN: llc -filetype=asm -mtriple x86_64 < %s + +; Check that the code below successfully compiled without getting +; "LLVM ERROR: Unsupported expression in static initializer: addrspacecast" + +@__block_literal_global = external addrspace(1) constant { i32, i32, i8 addrspace(4)* }, align 4 + +@block_A = addrspace(1) constant void (i8 addrspace(3)*) addrspace(4)* addrspacecast (void (i8 addrspace(3)*) addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* @__block_literal_global to void (i8 addrspace(3)*) addrspace(1)*) to void (i8 addrspace(3)*) addrspace(4)*), align 4