Commit Graph

29 Commits

Author SHA1 Message Date
AngelicosPhosphoros
8f432d4ae6 Add assume into NonZeroIntX::get
LLVM currently don't support range metadata for function arguments so it fails to optimize non zero integers using their invariant if they are provided using by-value function arguments.

Related to https://github.com/rust-lang/rust/issues/119422
Related to https://github.com/llvm/llvm-project/issues/76628
Related to https://github.com/rust-lang/rust/issues/49572
2024-01-06 14:26:37 +01:00
The 8472
502df1b7d4 add more niches to rawvec 2023-12-11 23:38:48 +01:00
bendn
73afc00cf9
use assume(idx < self.len()) in [T]::get_unchecked 2023-12-04 06:00:12 +07:00
Dario Nieuwenhuis
7de6d04bc8 Update the minimum external LLVM to 16. 2023-11-21 22:40:16 +01:00
Ralf Jung
c4ec12f4b7 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
David Koloski
ddd8878d69 Address feedback 2023-09-06 22:16:22 +00:00
David Koloski
c18da3ccd4 Add regression test for LLVM 17-rc3 miscompile
See #115385 for more details.
2023-09-06 02:23:48 +00:00
DianQK
c12c0841ad Cherry-pick test for issue #114312 2023-08-15 11:33:45 +02:00
Josh Stone
da47736f42 CHECK only for opaque ptr 2023-07-27 14:44:13 -07:00
Josh Stone
190ded8443 Update the minimum external LLVM to 15 2023-07-27 14:07:08 -07:00
Erik Desjardins
bd0aae92dc cg_llvm: use index-based loop in write_operand_repeatedly
This is easier for LLVM to analyze.
2023-06-11 00:04:53 -04:00
Matthias Krüger
bdf9ed497a
Rollup merge of #111878 - ferrocene:pa-codegen-tests, r=Mark-Simulacrum
Fix codegen test suite for bare-metal-like targets

For Ferrocene I needed to run the test suite for custom target with no unwinding and static relocation. Running the tests uncovered ~20 failures due to the test suite not accounting for these options. This PR fixes them by:

* Fixing `CHECK`s to account for functions having extra LLVM IR attributes (in this case `nounwind`).
* Fixing `CHECK`s to account for the `dso_local` LLVM IR modifier, which is [added to every item when relocation is static](f3d597b31c/compiler/rustc_codegen_llvm/src/mono_item.rs (L139-L142)).
* Fixing `CHECK`s to account for missing `uwtables` attributes.
* Added the `needs-unwind` attributes for tests that are designed to check unwinding.

There is no part of Rust CI that checks this unfortunately, and testing whether the PR works locally is kinda hard because you need a target with std enabled but no unwinding and static relocations. Still, this works in my local testing, and if future PRs accidentally break this Ferrocene will take care of sending followup PRs.
2023-06-03 20:38:11 +02:00
Ben Kimock
79ba7b307d Enable ScalarReplacementOfAggregates 2023-05-31 19:18:16 -04:00
Pietro Albini
dc1ed9ddd7
codegen: allow the dso_local attribute
The attribute is injected into most items when static relocation is
enabled in a target.
2023-05-23 16:54:33 +02:00
bors
2fe47b966a Auto merge of #111634 - marc0246:arc-new-uninit-bloat, r=thomcc
Fix duplicate `arcinner_layout_for_value_layout` calls when using the uninit `Arc` constructors

What this fixes is the duplicate calls to `arcinner_layout_for_value_layout` seen here: https://godbolt.org/z/jr5Gxozhj

The issue was discovered alongside #111603 but is otherwise unrelated to the duplicate `alloca`s, which remain unsolved. Everything I tried to solve said main issue has failed.

As for the duplicate layout calculations, I also tried slapping `#[inline]` and `#[inline(always)]` on everything in sight but the only thing that worked in the end is to dedup the calls by hand.
2023-05-22 15:06:32 +00:00
marc0246
2a466466c7
Fix duplicate arcinner_layout_for_value_layout calls 2023-05-16 08:53:05 +02:00
Scott McMurray
a9570a34cd Stop checking for the absense of something that doesn't exist
A couple of codegen tests are doing
```
// CHECK-NOT: slice_index_len_fail
```

However, that function no longer exists: [the only places](https://github.com/search?q=repo%3Arust-lang%2Frust+slice_index_len_fail&type=code) it occurs in the repo are in those tests.

So this PR updates the tests to check for the absense of the functions that are actually used today to panic for out-of-bounds indexing.
2023-05-12 21:59:26 -07:00
The 8472
67a835d755 fix codegen test 2023-04-28 23:08:54 +02:00
The 8472
1a51ec6864 bless tests 2023-04-27 22:29:04 +02:00
bors
13d1802b88 Auto merge of #109895 - nikic:llvm-16-tests, r=cuviper
Add codegen tests for issues fixed by LLVM 16

Fixes #75978.
Fixes #99960.
Fixes #101048.
Fixes #101082.
Fixes #101814.
Fixes #103132.
Fixes #103327.
2023-04-12 02:30:21 +00:00
Nikita Popov
83f525cc28 Make test compatible with 32-bit 2023-04-11 17:19:07 +02:00
Nikita Popov
ec635c002b Add ignore-debug to two tests
These don't optimize with debug assertions. For one of them, this
is due to the new alignment checks, for the other I'm not sure
what specifically blocks it.
2023-04-11 11:22:15 +02:00
Nikita Popov
73f40d4293 Add codegen tests for issues fixed by LLVM 16
Fixes #75978.
Fixes #99960.
Fixes #101048.
Fixes #101082.
Fixes #101814.
Fixes #103132.
Fixes #103327.
2023-04-03 17:02:57 +02:00
Pietro Albini
3602200d50
make 32bit ignore more accurate 2023-04-03 10:23:08 +02:00
Ben Kimock
8ccf53332e A MIR transform that checks pointers are aligned 2023-03-23 18:23:06 -04:00
Scott McMurray
48011e2aa4 Also move the auxiliary file 2023-03-20 10:25:29 +00:00
Scott McMurray
5dfe37a504 mv tests/codegen/issue-* tests/codegen/issues/ 2023-03-20 10:25:29 +00:00
Scott McMurray
1f70bb8c43 Add a codegen test to confirm this fixes 73258 2023-03-12 13:23:22 -07:00
Scott McMurray
0b96fee343 Add a codegen test to confirm this fixes 106369 2023-03-12 12:57:40 -07:00