[clang] [coroutine] Fix type of an ImplicitParamDecl used in generateAwaitSuspendWrapper (PR #87134)

2024-03-31 Thread Chuanqi Xu via cfe-commits

https://github.com/ChuanqiXu9 commented:

The change itself looks good to me. It will be better if we can have a reduced 
test case.

https://github.com/llvm/llvm-project/pull/87134
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [coroutine] Fix type of an ImplicitParamDecl used in generateAwaitSuspendWrapper (PR #87134)

2024-03-29 Thread Akira Hatanaka via cfe-commits

ahatanak wrote:

I don't have a test case yet. I'll see if I can come up with one.

https://github.com/llvm/llvm-project/pull/87134
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [coroutine] Fix type of an ImplicitParamDecl used in generateAwaitSuspendWrapper (PR #87134)

2024-03-29 Thread via cfe-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-clang

Author: Akira Hatanaka (ahatanak)


Changes

Use the correct type for AwaiterDecl instead of using `void *`.

See the discussion here:
https://github.com/llvm/llvm-project/pull/79712#discussion_r1544153100

---
Full diff: https://github.com/llvm/llvm-project/pull/87134.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGCoroutine.cpp (+4-3) 


``diff
diff --git a/clang/lib/CodeGen/CGCoroutine.cpp 
b/clang/lib/CodeGen/CGCoroutine.cpp
index 93ca711f716fce..dd005fdaa8f745 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -422,7 +422,9 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const 
,
 
   FunctionArgList args;
 
-  ImplicitParamDecl AwaiterDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
+  QualType AwaiterType = S.getOpaqueValue()->getType();
+  ImplicitParamDecl AwaiterDecl(C, C.getPointerType(AwaiterType),
+ImplicitParamKind::Other);
   ImplicitParamDecl FrameDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
   QualType ReturnTy = S.getSuspendExpr()->getType();
 
@@ -449,8 +451,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const 
,
 
   // FIXME: add TBAA metadata to the loads
   llvm::Value *AwaiterPtr = 
Builder.CreateLoad(GetAddrOfLocalVar());
-  auto AwaiterLValue =
-  MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterDecl.getType());
+  auto AwaiterLValue = MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterType);
 
   CurAwaitSuspendWrapper.FramePtr =
   Builder.CreateLoad(GetAddrOfLocalVar());

``




https://github.com/llvm/llvm-project/pull/87134
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [coroutine] Fix type of an ImplicitParamDecl used in generateAwaitSuspendWrapper (PR #87134)

2024-03-29 Thread Akira Hatanaka via cfe-commits

https://github.com/ahatanak created 
https://github.com/llvm/llvm-project/pull/87134

Use the correct type for AwaiterDecl instead of using `void *`.

See the discussion here:
https://github.com/llvm/llvm-project/pull/79712#discussion_r1544153100

>From 0f3f51dfe8a63c76c7d006511a8f329526123f54 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka 
Date: Fri, 29 Mar 2024 15:23:30 -0700
Subject: [PATCH] [coroutine] Fix type of an ImplicitParamDecl used in
 generateAwaitSuspendWrapper

Use the correct type for AwaiterDecl instead of using `void *`.

See the discussion here:
https://github.com/llvm/llvm-project/pull/79712#discussion_r1544153100
---
 clang/lib/CodeGen/CGCoroutine.cpp | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CodeGen/CGCoroutine.cpp 
b/clang/lib/CodeGen/CGCoroutine.cpp
index 93ca711f716fce..dd005fdaa8f745 100644
--- a/clang/lib/CodeGen/CGCoroutine.cpp
+++ b/clang/lib/CodeGen/CGCoroutine.cpp
@@ -422,7 +422,9 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const 
,
 
   FunctionArgList args;
 
-  ImplicitParamDecl AwaiterDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
+  QualType AwaiterType = S.getOpaqueValue()->getType();
+  ImplicitParamDecl AwaiterDecl(C, C.getPointerType(AwaiterType),
+ImplicitParamKind::Other);
   ImplicitParamDecl FrameDecl(C, C.VoidPtrTy, ImplicitParamKind::Other);
   QualType ReturnTy = S.getSuspendExpr()->getType();
 
@@ -449,8 +451,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const 
,
 
   // FIXME: add TBAA metadata to the loads
   llvm::Value *AwaiterPtr = 
Builder.CreateLoad(GetAddrOfLocalVar());
-  auto AwaiterLValue =
-  MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterDecl.getType());
+  auto AwaiterLValue = MakeNaturalAlignAddrLValue(AwaiterPtr, AwaiterType);
 
   CurAwaitSuspendWrapper.FramePtr =
   Builder.CreateLoad(GetAddrOfLocalVar());

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits