[PATCH] D104752: [LLParser] Remove special handling for call address space

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 14:40:09 PDT 2021


nikic created this revision.
nikic added reviewers: arsenm, aeubanks.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Spin-off from D104740 <https://reviews.llvm.org/D104740>: I don't think this special handling is needed at all. Calls are annotated with `addrspace(N)` which defaults to the program address space. The pointer address space of the callee should always match the specified `addrspace`.

No tests fail with this special handling removed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104752

Files:
  llvm/lib/AsmParser/LLParser.cpp


Index: llvm/lib/AsmParser/LLParser.cpp
===================================================================
--- llvm/lib/AsmParser/LLParser.cpp
+++ llvm/lib/AsmParser/LLParser.cpp
@@ -1472,21 +1472,12 @@
                                         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;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104752.353796.patch
Type: text/x-patch
Size: 1025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210622/a4da0936/attachment.bin>


More information about the llvm-commits mailing list