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

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 11:54:54 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:

> > I don't think mixing languages with different LangAS maps is sound
> 
> It is entirely sound, and required for this entire system to work

I am aware of what we decided to do. Whether or not that is actually sound is a different kettle of fish, but let's agree to disagree and move on. Stepping back, I'm trying to figure out what the actual suggestion is. Reverting the change is wrong, because there are other targets where for which 0 is definitely not a sound default, and this impacts more than the `used`/`compiler.used` arrays. Seems like there are two viable options:

1. I'm going to propose changing `emitUsed` anyway, since that makes sense even if the AS is indeed mostly meaningless there
2. IMHO OCL should default to `AMDGPUDefIsGenMap` for its LangAS map, which would "fix" this as well.
 
If there's some third reasonable solution, I apologise for missing it - please share!

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


More information about the cfe-commits mailing list