diff options
| author | Josh Stone <jistone@redhat.com> | 2018-06-15 15:47:54 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2018-07-05 09:59:52 -0700 |
| commit | e5789765606baebd983bd9b1c870cb8b57a0627b (patch) | |
| tree | 865811bcbcead24fb5448ee44e53ae0a07370aeb /src/test/codegen/function-arguments.rs | |
| parent | 94eb1760551096363ec04e42367b6b195592dbd8 (diff) | |
| download | rust-e5789765606baebd983bd9b1c870cb8b57a0627b.tar.gz rust-e5789765606baebd983bd9b1c870cb8b57a0627b.zip | |
Store scalar pair bools as i8 in memory
We represent `bool` as `i1` in a `ScalarPair`, unlike other aggregates,
to optimize IR for checked operators and the like. With this patch, we
still do so when the pair is an immediate value, but we use the `i8`
memory type when the value is loaded or stored as an LLVM aggregate.
So `(bool, bool)` looks like an `{ i1, i1 }` immediate, but `{ i8, i8 }`
in memory. When a pair is a direct function argument, `PassMode::Pair`,
it is still passed using the immediate `i1` type, but as a return value
it will use the `i8` memory type. Also, `bool`-like` enum tags will now
use scalar pairs when possible, where they were previously excluded due
to optimization issues.
Diffstat (limited to 'src/test/codegen/function-arguments.rs')
| -rw-r--r-- | src/test/codegen/function-arguments.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index e3fa7a7db39..c027dece014 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -149,7 +149,7 @@ pub fn enum_id_1(x: Option<Result<u16, u16>>) -> Option<Result<u16, u16>> { x } -// CHECK: i16 @enum_id_2(i16) +// CHECK: { i8, i8 } @enum_id_2(i1 zeroext %x.0, i8 %x.1) #[no_mangle] pub fn enum_id_2(x: Option<u8>) -> Option<u8> { x |
