Commit Graph

849 Commits

Author SHA1 Message Date
antoyo
b6ccb55f56
Merge pull request #324 from GuillaumeGomez/no-alias-optimization
Only apply NoAlias attribute if optimization is enabled
2023-08-31 17:55:41 -04:00
Guillaume Gomez
03bcfff8b3 Only apply NoAlias attribute if optimization is enabled 2023-08-31 21:19:36 +02:00
antoyo
4e41a8a632
Merge pull request #278 from rust-lang/feature/lto_2023-05-12
Add support for Link-Time Optimization
2023-08-30 21:15:39 -04:00
Antoni Boucher
62867dc29f LTO implementation 2023-08-30 20:29:24 -04:00
antoyo
2b956f535e
Merge pull request #312 from GuillaumeGomez/fn-param-noalias
Add support for `noalias` function parameters
2023-08-29 18:03:38 -04:00
Matthias Krüger
13e402ed7c Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obk
Don't ICE on layout computation failure

Fixes #111176 regression.

r? `@oli-obk`
2023-08-29 20:49:02 +02:00
Guillaume Gomez
c83e5679b3 Don't generate __restrict__ attribute for ByValue arguments 2023-08-29 15:45:48 +02:00
Katherine Philip
642fae9409 Don't ICE on layout computation failure 2023-08-28 12:40:39 -07:00
Matthias Krüger
cdb012e0ba Rollup merge of #115240 - RalfJung:llvm-no-type, r=bjorn3
codegen_llvm/llvm_type: avoid matching on the Rust type

This `match` is highly suspicious. Looking at `scalar_llvm_type_at` I think it makes no difference. But if it were to make a difference that would be a huge problem, since it doesn't look through `repr(transparent)`!

Cc `@eddyb` `@bjorn3`
2023-08-28 19:53:55 +02:00
Ralf Jung
0d2cd6f650 remove an unused argument
it was already unused before, but due to the recursion the compiler did not realize
2023-08-28 18:21:16 +02:00
Ralf Jung
44401b89ad carry out the same changes in the gcc backend 2023-08-28 16:35:22 +02:00
Wesley Wiser
ec4a85e889 Revert "Use the same DISubprogram for each instance of the same inlined function within the caller"
This reverts commit 687bffa493.

Reverting to resolve ICEs reported on nightly.
2023-08-25 19:49:10 -04:00
Guillaume Gomez
189dd7022a Update gccjit dependency 2023-08-25 22:39:22 +02:00
Guillaume Gomez
5ac2530d3c Add support for noalias function parameters 2023-08-25 22:39:22 +02:00
bors
17b7f1e198 Auto merge of #114643 - dpaoliello:inlinedebuginfo, r=wesleywiser
Use the same DISubprogram for each instance of the same inlined function within a caller

# Issue Details:
The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this is inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together.

When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location.

As an example of this when building for x86_64 Windows (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction):

```
	.cv_loc	0 1 23 0                        # src\lib.rs:23:0
	addq	$40, %rsp
	retq
	leaq	.Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx
	leaq	.Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8
	movl	$43, %edx
	callq	_ZN4core9panicking5panic17h12e60b9063f6dee8E
	int3
```

# Fix Details:
Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again, this also requires caching the `DILexicalBlock` and `DIVariable` objects to avoid creating duplicates.

After this change the above assembly now looks like:

```
	.cv_loc	0 1 23 0                        # src\lib.rs:23:0
	addq	$40, %rsp
	retq
	.cv_inline_site_id 5 within 0 inlined_at 1 0 0
	.cv_inline_site_id 6 within 5 inlined_at 1 12 0
	.cv_loc	6 2 935 0                       # library\core\src\option.rs:935:0
	leaq	.Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx
	leaq	.Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8
	movl	$43, %edx
	callq	_ZN4core9panicking5panic17hde1558f32d5b1c04E
	int3
```
2023-08-22 20:15:29 +00:00
antoyo
4ffa4254e1
Merge pull request #319 from GuillaumeGomez/build-system
Rustify prepare.sh command
2023-08-21 17:48:50 -04:00
Guillaume Gomez
08eb006f71 Remove unused Cargo feature 2023-08-21 15:52:05 +02:00
Guillaume Gomez
c682e9ca94 Correctly set path 2023-08-20 00:49:31 +02:00
Guillaume Gomez
18d22d5698 Don't capture output on git commands 2023-08-19 21:10:21 +02:00
Guillaume Gomez
6b588cc007 Rustify prepare.sh command 2023-08-19 21:10:21 +02:00
antoyo
186320aa81
Merge pull request #311 from GuillaumeGomez/regen
Regenerate intrinsics
2023-08-17 17:14:50 -04:00
antoyo
4ad266a668
Merge pull request #318 from GuillaumeGomez/gcc-contribution
Add doc for sending patches to GCC
2023-08-17 17:13:53 -04:00
Guillaume Gomez
4748fdcbab Add doc for sending patches to GCC 2023-08-17 14:29:00 +02:00
antoyo
2b8fe8f38b
Merge pull request #317 from GuillaumeGomez/fix-command
Fix command to run custom rustc
2023-08-16 21:05:37 -04:00
Guillaume Gomez
4cbf1c76ff Fix command to run custom rustc 2023-08-16 13:55:22 +02:00
Guillaume Gomez
d929cf8ef1 Display run commands when using llvm-tblgen 2023-08-16 13:54:10 +02:00
Guillaume Gomez
033dc1f208 Regenerate intrinsics 2023-08-16 13:54:10 +02:00
antoyo
2f11b37c80
Merge pull request #313 from rust-lang/sync_from_rust_2023_08_12
Sync from rust 2023/08/12
2023-08-15 17:58:17 -04:00
Antoni Boucher
53d89e8918 Fix tests 2023-08-15 12:41:35 -04:00
Antoni Boucher
542c82ec37 Fix for libgccjit 12 2023-08-15 11:25:38 -04:00
Antoni Boucher
e3deac5c71 Fix tests 2023-08-15 11:11:57 -04:00
bors
afd4e1edd1 Auto merge of #114467 - Amanieu:asm-unstable-features, r=davidtwco
Use `unstable_target_features` when checking inline assembly

This is necessary to properly validate register classes even when the relevant target feature name is still unstable.
2023-08-15 11:59:02 +00:00
Dirreke
814c2e2cea add a csky-unknown-linux-gnuabiv2 target 2023-08-14 23:02:36 +08:00
Antoni Boucher
607ec893e7 Merge branch 'master' into sync_from_rust_2023_08_12 2023-08-13 09:59:34 -04:00
Antoni Boucher
43431e4db4 Update to nightly-2023-08-12 2023-08-13 09:37:32 -04:00
Daniel Paoliello
fb6ec5e510 Use the same DISubprogram for each instance of the same inlined function within the caller 2023-08-11 10:21:52 -07:00
Matthias Krüger
8a160d6fcd Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly

As discussed in #113435, this lets the backends be the place that can have the "don't call the function if n == 0" logic, if it's needed for the target.  (I didn't actually *add* those checks, though, since as I understood it we didn't actually need them on known targets?)

Doing this also let me make it `const` (unstable), which I don't think `extern "C" fn memcmp` can be.

cc `@RalfJung` `@Amanieu`
2023-08-07 05:29:12 +02:00
scottmcm
b132a7e6d4 Apply suggestions from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-06 15:47:40 -07:00
Scott McMurray
9c8ae2f153 Add a new compare_bytes intrinsic instead of calling memcmp directly 2023-08-06 15:47:40 -07:00
David Tolnay
fe6a4773a1 Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
Matthias Krüger
7ebcd4d5de Rollup merge of #114450 - chenyukang:yukang-fix-114435, r=compiler-errors
Fix ICE failed to get layout for ReferencesError

Fixes #114435

r? `@compiler-errors`
2023-08-04 21:31:57 +02:00
yukang
46062cd68d Fix ICE failed to get layout for ReferencesError 2023-08-05 01:38:14 +08:00
Amanieu d'Antras
913fcf50ee Use unstable_target_features when checking inline assembly
This is necessary to properly validate register classes even when the
relevant target feature name is still unstable.
2023-08-04 16:09:54 +01:00
Oli Scherer
de69c67ffa Forbid old-style simd_shuffleN intrinsics 2023-08-03 09:29:00 +00:00
bors
3cde1943af Auto merge of #105545 - erikdesjardins:ptrclean, r=bjorn3
cleanup: remove pointee types

This can't be merged until the oldest LLVM version we support uses opaque pointers, which will be the case after #114148. (Also note `-Cllvm-args="-opaque-pointers=0"` can technically be used in LLVM 15, though I don't think we should support that configuration.)

I initially hoped this would provide some minor perf win, but in https://github.com/rust-lang/rust/pull/105412#issuecomment-1341224450 it had very little impact, so this is only valuable as a cleanup.

As a followup, this will enable #96242 to be resolved.

r? `@ghost`

`@rustbot` label S-blocked
2023-08-01 19:44:17 +00:00
Nicholas Nethercote
e94abcdf3d Use standard Rust capitalization rules for names containing "LTO". 2023-07-31 16:21:02 +10:00
Erik Desjardins
bc4a65d47f cg_ssa: remove pointee types and pointercast/bitcast-of-ptr 2023-07-29 13:18:20 -04:00
Antoni Boucher
52716d237c Add back link to IRC 2023-07-27 19:21:00 -04:00
Antoni Boucher
14964ed2f6 Update the IRC link to the link of the Matrix channel 2023-07-24 13:50:04 -04:00
bors
9e58bacf90 Auto merge of #113877 - JhonnyBillM:reuse-codegen-ssa-monomorphization-errors-in-gcc, r=davidtwco
Reuse `codegen_ssa` monomorphization errors in `codegen_gcc`

Removes monomorphization errors duplication by reusing the ones defined in `codegen_ssa`.

Also updates `expected_simd` errors usage in `codegen_gcc` by assuming we want to treat those parameters as translatable. See 7a888fb56e
2023-07-24 11:29:59 +00:00