diff options
| author | bors <bors@rust-lang.org> | 2023-06-27 15:01:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-27 15:01:56 +0000 |
| commit | 3c554f5cb4965a08f2a2b45ab4bba321a5f249fa (patch) | |
| tree | f432874eae2a771a43c8a341a9f77aa21eae847a /tests/codegen | |
| parent | f42f19b6d3d785a74dbe57aa395b6c288437dd51 (diff) | |
| parent | bd0aae92dc76d9336cf09c097ac5a49fd619da44 (diff) | |
| download | rust-3c554f5cb4965a08f2a2b45ab4bba321a5f249fa.tar.gz rust-3c554f5cb4965a08f2a2b45ab4bba321a5f249fa.zip | |
Auto merge of #112516 - erikdesjardins:loop, r=davidtwco
cg_llvm: use index-based loop in write_operand_repeatedly This should be easier for LLVM to analyze. Fixes #111603 This needs a perf run. [cc](https://github.com/rust-lang/rust/issues/111603#issuecomment-1567531178) `@caojoshua`
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/issues/issue-111603.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen/issues/issue-111603.rs index 90b3c314d2f..06429ed3fa9 100644 --- a/tests/codegen/issues/issue-111603.rs +++ b/tests/codegen/issues/issue-111603.rs @@ -5,6 +5,18 @@ use std::sync::Arc; +// CHECK-LABEL: @new_from_array +#[no_mangle] +pub fn new_from_array(x: u64) -> Arc<[u64]> { + // Ensure that we only generate one alloca for the array. + + // CHECK: alloca + // CHECK-SAME: [1000 x i64] + // CHECK-NOT: alloca + let array = [x; 1000]; + Arc::new(array) +} + // CHECK-LABEL: @new_uninit #[no_mangle] pub fn new_uninit(x: u64) -> Arc<[u64; 1000]> { |
