[PATCH] D145788: [CodeGen] Only consider innermost cast for !heapallocsite
Nikita Popov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 9 00:50:03 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcac4d7ff4652: [CodeGen] Only consider innermost cast for !heapallocsite (authored by nikic).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145788/new/
https://reviews.llvm.org/D145788
Files:
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/debug-info-codeview-heapallocsite.c
Index: clang/test/CodeGen/debug-info-codeview-heapallocsite.c
===================================================================
--- clang/test/CodeGen/debug-info-codeview-heapallocsite.c
+++ clang/test/CodeGen/debug-info-codeview-heapallocsite.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -S -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -fdeclspec -S -emit-llvm %s -o - | FileCheck %s
struct Foo;
struct Bar;
@@ -14,10 +14,10 @@
}
// CHECK-LABEL: define {{.*}}void @call_alloc
-// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG1:!.*]]
-// CHECK: call %struct.Foo* {{.*}}@alloc_foo{{.*}} !heapallocsite [[DBG2:!.*]]
-// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG2]]
-// CHECK: call i8* {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG3:!.*]]
+// CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG1:!.*]]
+// CHECK: call ptr {{.*}}@alloc_foo{{.*}} !heapallocsite [[DBG2:!.*]]
+// CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG2]]
+// CHECK: call ptr {{.*}}@alloc_void{{.*}} !heapallocsite [[DBG3:!.*]]
// CHECK: [[DBG2]] = !DICompositeType(tag: DW_TAG_structure_type,
// CHECK-SAME: name: "Foo"
Index: clang/lib/CodeGen/CGExprScalar.cpp
===================================================================
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -2098,7 +2098,8 @@
// Update heapallocsite metadata when there is an explicit pointer cast.
if (auto *CI = dyn_cast<llvm::CallBase>(Src)) {
- if (CI->getMetadata("heapallocsite") && isa<ExplicitCastExpr>(CE)) {
+ if (CI->getMetadata("heapallocsite") && isa<ExplicitCastExpr>(CE) &&
+ !isa<CastExpr>(E)) {
QualType PointeeType = DestTy->getPointeeType();
if (!PointeeType.isNull())
CGF.getDebugInfo()->addHeapAllocSiteMetadata(CI, PointeeType,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145788.520616.patch
Type: text/x-patch
Size: 2046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230509/ac0a188b/attachment.bin>
More information about the cfe-commits
mailing list