[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-17 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 edited https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-17 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 closed https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-17 Thread Youngsuk Kim via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -target-cpu gfx906 -fopenmp -nogpulib -fopenmp-is-target-device -emit-llvm %s -o - | FileCheck %s + +// Don't crash with assertions build. + +// CHECK: @MyGlobVar = external

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-16 Thread Matt Arsenault via cfe-commits
https://github.com/arsenm approved this pull request. https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-16 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -target-cpu gfx906 -fopenmp -nogpulib -fopenmp-is-target-device -emit-llvm %s -o - | FileCheck %s + +// Don't crash with assertions build. + +// CHECK: @MyGlobVar = external

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-16 Thread Youngsuk Kim via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -disable-llvm-passes -fopenmp-targets=amdgcn-amd-amdhsa -x c++ -emit-llvm-bc %s -o %t-x86-host.bc +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -target-

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-16 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 updated https://github.com/llvm/llvm-project/pull/119246 >From 9dbcf65775a979553bee2c95b16e3e2328e957a1 Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Mon, 9 Dec 2024 10:33:18 -0600 Subject: [PATCH 1/4] [clang] Recover necessary AddrSpaceCast A necessary AddrSpace

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-15 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -disable-llvm-passes -fopenmp-targets=amdgcn-amd-amdhsa -x c++ -emit-llvm-bc %s -o %t-x86-host.bc +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -target-

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-15 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 updated https://github.com/llvm/llvm-project/pull/119246 >From 9dbcf65775a979553bee2c95b16e3e2328e957a1 Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Mon, 9 Dec 2024 10:33:18 -0600 Subject: [PATCH 1/3] [clang] Recover necessary AddrSpaceCast A necessary AddrSpace

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The function in question is part of the Itanium C++ ABI; the ABI itself doesn't say anything about address-spaces, so by default we assume everything related to the C++ ABI is in the flat address-space. If we start messing with that, we'll need to write a specification so

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Matt Arsenault via cfe-commits
arsenm wrote: > I mean, why do we have to watch for type mismatches and fix them instead of > creating the correct type in the first place? There is > `getPointerType(RetQT)` just above, shouldn't it be something like > `getPointerType(RetQT, )`? Or RetQT should have had > the correct address

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,11 @@ +// REQUIRES: asserts arsenm wrote: The test should not crash under any build. It does not matter what the symptoms are today https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing l

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Sergei Barannikov via cfe-commits
s-barannikov wrote: > I'm unfamiliar with Clang Qualtypes I see. Well, neither am I :) I brought this up in case someone else could suggest the preferred way to fix the issue. I don't have objections against the current approach, but I'm not qualified to review it either. https://github.com/

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Youngsuk Kim via cfe-commits
JOE1994 wrote: > I mean, why do we have to watch for type mismatches and fix them instead of > creating the correct type in the first place? There is getPointerType(RetQT) just above, shouldn't it be something like getPointerType(RetQT, )? Or RetQT should have had the correct address space, but

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Sergei Barannikov via cfe-commits
s-barannikov wrote: > Updating the wrapper function's return type as below also fixes the error: I mean, why do we have to watch for type mismatches and fix them instead of creating the correct type in the first place? There is `getPointerType(RetQT)` just above, shouldn't it be something like

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 updated https://github.com/llvm/llvm-project/pull/119246 >From 9dbcf65775a979553bee2c95b16e3e2328e957a1 Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Mon, 9 Dec 2024 10:33:18 -0600 Subject: [PATCH 1/2] [clang] Recover necessary AddrSpaceCast A necessary AddrSpace

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Youngsuk Kim via cfe-commits
JOE1994 wrote: > May it be possible that the wrapper function's return type is invalid and the > cast isn't needed? LLVM-IR (from llvm without assertions, before this revision) shows that the wrapper function returns `ptr` while `MyGlobVar` has `addrspace(1)`. ```llvm $thread-local wrapper ro

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Shilei Tian via cfe-commits
@@ -0,0 +1,11 @@ +// REQUIRES: asserts + +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -disable-llvm-passes -fopenmp-targets=amdgcn-amd-amdhsa -x c++ -emit-llvm-bc %s -o %t-x86-host.bc +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-un

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 edited https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Youngsuk Kim via cfe-commits
@@ -0,0 +1,11 @@ +// REQUIRES: asserts JOE1994 wrote: The test crashes with an error only with an `asserts` build. Should I just that aspect in a comment, and remove the `asserts` requirement? https://github.com/llvm/llvm-project/pull/119246

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,11 @@ +// REQUIRES: asserts + +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -disable-llvm-passes -fopenmp-targets=amdgcn-amd-amdhsa -x c++ -emit-llvm-bc %s -o %t-x86-host.bc +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-un

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Matt Arsenault via cfe-commits
@@ -0,0 +1,11 @@ +// REQUIRES: asserts arsenm wrote: This does not require asserts https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-12 Thread Matt Arsenault via cfe-commits
@@ -3302,6 +3302,9 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs( CharUnits Align = CGM.getContext().getDeclAlign(VD); Val = Builder.CreateAlignedLoad(Var->getValueType(), Val, Align); } +if (Val->getType() != Wrapper->getReturnType()) { + Val = Build

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread Sergei Barannikov via cfe-commits
https://github.com/s-barannikov commented: May it be possible that the wrapper function's return type is invalid and the cast isn't needed? https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread Sergei Barannikov via cfe-commits
https://github.com/s-barannikov edited https://github.com/llvm/llvm-project/pull/119246 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread Sergei Barannikov via cfe-commits
@@ -3302,6 +3302,9 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs( CharUnits Align = CGM.getContext().getDeclAlign(VD); Val = Builder.CreateAlignedLoad(Var->getValueType(), Val, Align); } +if (Val->getType() != Wrapper->getReturnType()) { + Val = Build

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Youngsuk Kim (JOE1994) Changes A necessary AddrSpaceCast was wrongfully deleted in 5c91b2886f6bf400b60ca7839069839ac3980f8f . Recover the AddrSpaceCast. This fixes #86791 . --- Full diff: https://github.com/llvm/llvm-project/pull

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-backend-amdgpu Author: Youngsuk Kim (JOE1994) Changes A necessary AddrSpaceCast was wrongfully deleted in 5c91b2886f6bf400b60ca7839069839ac3980f8f . Recover the AddrSpaceCast. This fixes #86791 . --- Full diff: https://github.com/llvm/llvm-project/pul

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Youngsuk Kim (JOE1994) Changes A necessary AddrSpaceCast was wrongfully deleted in 5c91b2886f6bf400b60ca7839069839ac3980f8f . Recover the AddrSpaceCast. This fixes #86791 . --- Full diff: https://github.com/llvm/llvm-project/pull/119246.

[clang] [clang] Recover necessary AddrSpaceCast (PR #119246)

2024-12-09 Thread Youngsuk Kim via cfe-commits
https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/119246 A necessary AddrSpaceCast was wrongfully deleted in 5c91b2886f6bf400b60ca7839069839ac3980f8f . Recover the AddrSpaceCast. This fixes #86791 . >From 9dbcf65775a979553bee2c95b16e3e2328e957a1 Mon Sep 17 00:00:00