rust/compiler/rustc_codegen_ssa/src
bors dfdfaa1f04 Auto merge of #80200 - mahkoh:dst-offset, r=nagisa
Optimize DST field access

For

    struct X<T: ?Sized>(T)
    struct Y<T: ?Sized>(u8, T)

the offset of the unsized field is

    0
    mem::align_of_val(&self.1)

respectively. This patch changes the expression used to compute these
offsets so that the optimizer can perform this optimization.

Consider

```rust
fn f(x: &X<dyn Any>) -> &dyn Any {
    &x.0
}
```

Before:

```asm
test:
	movq	%rsi, %rdx
	movq	16(%rsi), %rax
	leaq	-1(%rax), %rcx
	negq	%rax
	andq	%rcx, %rax
	addq	%rdi, %rax
	retq
```

After:

```asm
test:
	movq	%rsi, %rdx
	movq	%rdi, %rax
	retq
```
2021-01-07 03:13:21 +00:00
..
back Merge remote-tracking branch 'origin/master' into frewsxcv-san 2020-12-31 23:27:33 -05:00
coverageinfo Updated links to LLVM 11 docs and types 2020-11-23 19:15:10 -08:00
debuginfo Stop adding '*' at the end of type names for Ref and Slice when computing debug info for MSVC debuggers 2020-11-30 14:31:34 -08:00
mir Auto merge of #80200 - mahkoh:dst-offset, r=nagisa 2021-01-07 03:13:21 +00:00
traits cg_ssa: introduce TargetMachineFactoryFn alias 2020-12-16 10:33:43 +00:00
base.rs Rollup merge of #80323 - camelid:codegen-base-docs, r=nagisa 2020-12-31 22:20:43 +01:00
common.rs Remove unused #[allow(...)] statements from compiler/ 2020-09-26 01:25:55 +02:00
glue.rs Change ty.kind to a method 2020-09-04 17:47:51 +02:00
lib.rs don't clone copy types 2020-12-29 19:40:03 +01:00
meth.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
mono_item.rs ty: remove obsolete printer 2020-08-30 18:59:07 +01:00
target_features.rs Rollup merge of #78361 - DevJPM:master, r=workingjubilee 2020-11-18 15:46:19 +01:00