From 3ee6f1a4fa83fa1e737324e77c27d3cc967d36bc Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 22 Jun 2021 23:34:38 +0200 Subject: [PATCH] [LLParser] Remove special handling for call address space Spin-off from D104740: I don't think this special handling is needed anymore. Calls in textual IR are annotated with addrspace(N) (which defaults to the program address space from data layout) and specifies the expected pointer address space of the callee. There is no need to special-case the program address space on top of that, as it already is the default expected address space, and we shouldn't allow use of the program address space if the call was explicitly annotated with some other address space. The IsCall parameter is retained because it will be used again soon. Differential Revision: https://reviews.llvm.org/D104752 --- llvm/lib/AsmParser/LLParser.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index c188766..dccd1a7 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -1469,24 +1469,15 @@ static inline GlobalValue *createGlobalFwdRef(Module *M, PointerType *PTy, } Value *LLParser::checkValidVariableType(LocTy Loc, const Twine &Name, Type *Ty, - Value *Val, bool IsCall) { + Value *Val, bool /* IsCall */) { if (Val->getType() == Ty) return Val; - // For calls we also accept variables in the program address space. - Type *SuggestedTy = Ty; - if (IsCall && isa(Ty)) { - Type *TyInProgAS = cast(Ty)->getElementType()->getPointerTo( - M->getDataLayout().getProgramAddressSpace()); - SuggestedTy = TyInProgAS; - if (Val->getType() == TyInProgAS) - return Val; - } if (Ty->isLabelTy()) error(Loc, "'" + Name + "' is not a basic block"); else error(Loc, "'" + Name + "' defined with type '" + getTypeString(Val->getType()) + "' but expected '" + - getTypeString(SuggestedTy) + "'"); + getTypeString(Ty) + "'"); return nullptr; } -- 2.7.4