[clang] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)

Alex Voicu via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 11:36:19 PDT 2024


================
@@ -368,7 +368,8 @@ CodeGenModule::CodeGenModule(ASTContext &C,
   IntTy = llvm::IntegerType::get(LLVMContext, C.getTargetInfo().getIntWidth());
   IntPtrTy = llvm::IntegerType::get(LLVMContext,
     C.getTargetInfo().getMaxPointerWidth());
-  Int8PtrTy = llvm::PointerType::get(LLVMContext, 0);
+  Int8PtrTy = llvm::PointerType::get(LLVMContext,
----------------
AlexVlx wrote:

> The IR address space is a pure target concept. Any address space error would be on the frontend emitting the wrong IR for the target

I don't think mixing languages with different LangAS maps is sound, OCL originating BC is not generic BC. There's no "error" here, the FE is doing what is asked of it (indiscriminately assuming that AS 0 is some generic/flat pointer that is valid everywhere is rather risque, as per prior conversation in this review). The actual problem is, AFAICT, that when we call `AMDGPUTargetInfo::adjust` we indiscriminately set private as default for any and all OCL compilations? There's a 6 year old `TODO`, which may or may not be vestigial at this point.

https://github.com/llvm/llvm-project/pull/88182


More information about the llvm-commits mailing list