-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR] Add limited support for array new (#1286)
This change adds initial support for array new expressions where the array size is constant and the element does not require a cookie.
- Loading branch information
1 parent
6ea1d14
commit 3c3b096
Showing
6 changed files
with
208 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll | ||
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM | ||
|
||
void t_new_constant_size() { | ||
auto p = new double[16]; | ||
} | ||
|
||
// LLVM: @_Z19t_new_constant_sizev() | ||
// LLVM: %[[ALLOCA:.*]] = alloca ptr, i64 1, align 8 | ||
// LLVM: %[[ADDR:.*]] = call ptr @_Znam(i64 128) | ||
// LLVM: store ptr %[[ADDR]], ptr %[[ALLOCA]], align 8 | ||
|
||
void t_new_multidim_constant_size() { | ||
auto p = new double[2][3][4]; | ||
} | ||
|
||
// LLVM: @_Z28t_new_multidim_constant_sizev() | ||
// LLVM: %[[ALLOCA:.*]] = alloca ptr, i64 1, align 8 | ||
// LLVM: %[[ADDR:.*]] = call ptr @_Znam(i64 192) | ||
// LLVM: store ptr %[[ADDR]], ptr %[[ALLOCA]], align 8 |