-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CIR] Upstream handling for delete array #165225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4089,6 +4089,24 @@ def CIR_PrefetchOp : CIR_Op<"prefetch"> { | |||||
| }]; | ||||||
| } | ||||||
|
|
||||||
| //===----------------------------------------------------------------------===// | ||||||
| // DeleteArrayOp | ||||||
| //===----------------------------------------------------------------------===// | ||||||
|
|
||||||
| def CIR_DeleteArrayOp : CIR_Op<"delete.array"> { | ||||||
| let summary = "Delete address representing an array"; | ||||||
| let description = [{ | ||||||
| `cir.delete.array` operation deletes an array. For example, `delete[] ptr;` | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| will be translated to `cir.delete.array %ptr`. | ||||||
| }]; | ||||||
|
|
||||||
| let arguments = (ins CIR_PointerType:$address); | ||||||
|
|
||||||
| let assemblyFormat = [{ | ||||||
| $address `:` type($address) attr-dict | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }]; | ||||||
| } | ||||||
|
|
||||||
| //===----------------------------------------------------------------------===// | ||||||
| // PtrDiffOp | ||||||
| //===----------------------------------------------------------------------===// | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -emit-cir %s -o %t.cir | ||
| // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -emit-llvm %s -o %t-cir.ll | ||
| // RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -emit-llvm %s -o %t.ll | ||
| // RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s | ||
|
|
||
| void test_delete_array(int *ptr) { | ||
| delete[] ptr; | ||
| } | ||
|
|
||
| // CIR: cir.delete.array | ||
|
|
||
| // LLVM: call void @_ZdaPv{{(m)?}}(ptr | ||
|
|
||
| // OGCG: call void @_ZdaPv{{(m)?}}(ptr | ||
|
Comment on lines
+12
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make more explicit checks |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.