[clang] [llvm] [clang] Replace uses of CreatePointerBitCastOrAddrSpaceCast (NFC) (PR #68277)

Youngsuk Kim via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 11 04:03:17 PST 2023


================
@@ -1123,9 +1123,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
     if (!CurFnInfo->getReturnInfo().getIndirectByVal()) {
       ReturnValuePointer =
           CreateDefaultAlignTempAlloca(Int8PtrTy, "result.ptr");
-      Builder.CreateStore(Builder.CreatePointerBitCastOrAddrSpaceCast(
-                              ReturnValue.getPointer(), Int8PtrTy),
-                          ReturnValuePointer);
+      Builder.CreateStore(ReturnValue.getPointer(), ReturnValuePointer);
----------------
JOE1994 wrote:

> But even if it would cast away an address space it seems a bit weird.

Yes, I agree..

> (And maybe the "result.ptr" should be created with ReturnValue.getPointer().getType() rather than using Int8PtrTy. Although I consider that as out of scope for this patch.)

I also agree.
Since, adding the change to this revision doesn't add new failures with `ninja check-clang`, I think it can be merged to this patch. I'll add the change to this revision.

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


More information about the llvm-commits mailing list