diff options
| author | bors <bors@rust-lang.org> | 2024-01-25 05:16:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-25 05:16:53 +0000 |
| commit | 039d887928361df98ca530471b609378be93983a (patch) | |
| tree | a06e4735c666d23260c03f360fb45af94745ff53 /compiler/rustc_hir_analysis/src | |
| parent | 68411c955458ffbc98649d6dd057c4be3b187f38 (diff) | |
| parent | 9dccd5dce11f2fcce81fc77f4271eaf2359e2626 (diff) | |
| download | rust-039d887928361df98ca530471b609378be93983a.tar.gz rust-039d887928361df98ca530471b609378be93983a.zip | |
Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obk
Replacement of #114390: Add new intrinsic `is_var_statically_known` and optimize pow for powers of two This adds a new intrinsic `is_val_statically_known` that lowers to [``@llvm.is.constant.*`](https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic).` It also applies the intrinsic in the int_pow methods to recognize and optimize the idiom `2isize.pow(x)`. See #114390 for more discussion. While I have extended the scope of the power of two optimization from #114390, I haven't added any new uses for the intrinsic. That can be done in later pull requests. Note: When testing or using the library, be sure to use `--stage 1` or higher. Otherwise, the intrinsic will be a noop and the doctests will be skipped. If you are trying out edits, you may be interested in [`--keep-stage 0`](https://rustc-dev-guide.rust-lang.org/building/suggested.html#faster-builds-with---keep-stage). Fixes #47234 Resolves #114390 `@Centri3`
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/intrinsic.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 7c3e296dfce..60e4403c1c7 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -453,6 +453,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { sym::black_box => (1, vec![param(0)], param(0)), + sym::is_val_statically_known => (1, vec![param(0)], tcx.types.bool), + sym::const_eval_select => (4, vec![param(0), param(1), param(2)], param(3)), sym::vtable_size | sym::vtable_align => { |
