Commit Graph

26 Commits

Author SHA1 Message Date
Wesley Wiser
4e8b642646 Turn on ConstDebugInfo pass. 2023-04-22 23:41:48 +02:00
Ben Kimock
8ec49ad19a Run combine_duplicate_switch_targets after the simplification that produces them 2023-04-20 20:40:01 -04:00
Deadbeef
dd025c3b56 fix codegen difference 2023-04-17 09:27:07 +00:00
Deadbeef
99851c48cf bless mir-opt 2023-04-17 01:19:29 +00:00
Tomasz Miąsko
7ddc245b14 ./x.py test --bless 2023-04-07 00:00:00 +00:00
Gary Guo
04126398c2 Ignore many tests on wasm32 2023-04-06 10:08:07 +01:00
Gary Guo
2a9d710d99 Bless tests 2023-04-06 09:34:17 +01:00
Thom Chiovoloni
0db1f54f89 Bless tests 2023-04-05 15:59:29 +00:00
bors
22a7a19f93 Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obk
Insert alignment checks for pointer dereferences when debug assertions are enabled

Closes https://github.com/rust-lang/rust/issues/54915

- [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit)
- [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue!
- [x] Implement a more helpful panic message like slice bounds checking.

r? `@oli-obk`
2023-03-31 08:50:35 +00:00
Ben Kimock
b932751984 Ignore the unwrap_unchecked test on wasm32-unknown-unknown 2023-03-25 19:33:19 -04:00
Ben Kimock
8ccf53332e A MIR transform that checks pointers are aligned 2023-03-23 18:23:06 -04:00
Ben Kimock
a98ddb6de1 Enable inlining of diverging functions 2023-03-18 14:29:13 -04:00
Camille GILLOT
19a8bb16c8 Generalize operation. 2023-03-13 18:22:55 +00:00
Camille GILLOT
9e3f091f2b Replace ZST operands and debuginfo by constants. 2023-03-13 18:19:57 +00:00
clubby789
dd7df04e16 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
Léo Lanteri Thauvin
bfe5189904 Revert "Stabilize #![feature(target_feature_11)]"
This reverts commit b379d216ee.
2023-03-02 13:41:17 +01:00
bors
b583ede652 Auto merge of #99767 - LeSeulArtichaut:stable-target-feature-11, r=estebank
Stabilize `#![feature(target_feature_11)]`

## Stabilization report

### Summary

Allows for safe functions to be marked with `#[target_feature]` attributes.

Functions marked with `#[target_feature]` are generally considered as unsafe functions: they are unsafe to call, cannot be assigned to safe function pointers, and don't implement the `Fn*` traits.

However, calling them from other `#[target_feature]` functions with a superset of features is safe.

```rust
// Demonstration function
#[target_feature(enable = "avx2")]
fn avx2() {}

fn foo() {
    // Calling `avx2` here is unsafe, as we must ensure
    // that AVX is available first.
    unsafe {
        avx2();
    }
}

#[target_feature(enable = "avx2")]
fn bar() {
    // Calling `avx2` here is safe.
    avx2();
}
```

### Test cases

Tests for this feature can be found in [`src/test/ui/rfcs/rfc-2396-target_feature-11/`](b67ba9ba20/src/test/ui/rfcs/rfc-2396-target_feature-11/).

### Edge cases

- https://github.com/rust-lang/rust/issues/73631

Closures defined inside functions marked with `#[target_feature]` inherit the target features of their parent function. They can still be assigned to safe function pointers and implement the appropriate `Fn*` traits.

```rust
#[target_feature(enable = "avx2")]
fn qux() {
    let my_closure = || avx2(); // this call to `avx2` is safe
    let f: fn() = my_closure;
}
```

This means that in order to call a function with `#[target_feature]`, you must show that the target-feature is available while the function executes *and* for as long as whatever may escape from that function lives.

### Documentation

- Reference: https://github.com/rust-lang/reference/pull/1181

---
cc tracking issue #69098
r? `@ghost`
2023-02-28 01:14:56 +00:00
Ben Kimock
1409cb59b2 Enable instcombine for mutable reborrows 2023-02-16 07:51:23 -05:00
Ben Kimock
640ede7b0a Enable CopyProp by default, tune the impl a bit 2023-02-12 13:23:53 -05:00
Camille GILLOT
10ec94930b Bless tests. 2023-02-02 23:26:26 +00:00
Camille GILLOT
6a0b218161 Stop deaggregating enums in MIR. 2023-02-02 23:20:27 +00:00
Léo Lanteri Thauvin
b379d216ee Stabilize #![feature(target_feature_11)] 2023-02-01 08:53:02 +01:00
Camille GILLOT
6ed9f8f62e Implement SSA CopyProp pass. 2023-01-27 18:22:45 +00:00
Camille GILLOT
de9a5b076a Make the inlining destination a Local. 2023-01-14 12:09:06 +00:00
Camille GILLOT
1c327e1133 Add test. 2023-01-14 11:41:22 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00