[llvm] 3ee6f1a - [LLParser] Remove special handling for call address space
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 23 03:07:55 PDT 2021
Author: Nikita Popov
Date: 2021-06-23T12:07:44+02:00
New Revision: 3ee6f1a4fa83fa1e737324e77c27d3cc967d36bc
URL: https://github.com/llvm/llvm-project/commit/3ee6f1a4fa83fa1e737324e77c27d3cc967d36bc
DIFF: https://github.com/llvm/llvm-project/commit/3ee6f1a4fa83fa1e737324e77c27d3cc967d36bc.diff
LOG: [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
Added:
Modified:
llvm/lib/AsmParser/LLParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index c188766e0077a..dccd1a7ee23a4 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<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;
}
More information about the llvm-commits
mailing list