Skip to content

Commit

Permalink
[LLParser] Remove special handling for call address space
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nikic committed Jun 23, 2021
1 parent f0d43a2 commit 3ee6f1a
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PointerType>(Ty)) {
Type *TyInProgAS = cast<PointerType>(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;
}

Expand Down

0 comments on commit 3ee6f1a

Please sign in to comment.