diff options
| author | bors <bors@rust-lang.org> | 2023-05-30 10:31:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-30 10:31:10 +0000 |
| commit | 3266c36624e804f9f086ebd40db19039b55a4ec1 (patch) | |
| tree | 782ea7ea40d2ff1cc691626e5ab7c1a2189af2ce /tests/codegen | |
| parent | 578bcbc2b42191556c4438b80ba37fafa4193e82 (diff) | |
| parent | 164d041e303e9c98daaf35301fa88ba6844277dd (diff) | |
| download | rust-3266c36624e804f9f086ebd40db19039b55a4ec1.tar.gz rust-3266c36624e804f9f086ebd40db19039b55a4ec1.zip | |
Auto merge of #111768 - oli-obk:pair_const_llvm, r=cjgillot
Optimize scalar and scalar pair representations loaded from ByRef in llvm in https://github.com/rust-lang/rust/pull/105653 I noticed that we were generating suboptimal LLVM IR if we had a `ConstValue::ByRef` that could be represented by a `ScalarPair`. Before https://github.com/rust-lang/rust/pull/105653 this is probably rare, but after it, every slice will go down this suboptimal code path that requires LLVM to untangle a bunch of indirections and translate static allocations that are only used once to read a scalar pair from.
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/const_scalar_pair.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/codegen/const_scalar_pair.rs b/tests/codegen/const_scalar_pair.rs new file mode 100644 index 00000000000..8f32c50b798 --- /dev/null +++ b/tests/codegen/const_scalar_pair.rs @@ -0,0 +1,8 @@ +// compile-flags: --crate-type=lib -Copt-level=0 -Zmir-opt-level=0 -C debuginfo=2 + +#![feature(inline_const)] + +pub fn foo() -> (i32, i32) { + // CHECK: ret { i32, i32 } { i32 1, i32 2 } + const { (1, 2) } +} |
