diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-07-20 08:53:09 +0000 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2023-08-17 19:38:42 -0700 |
| commit | 402cc350c12865e3e4a17c0f6005396c89eee546 (patch) | |
| tree | 5898982c59c0addfea61e5157a87136a3ed4d871 | |
| parent | 5905d9cdba0250a529b4fe33d5852ce2dcb7f9e9 (diff) | |
| download | rust-402cc350c12865e3e4a17c0f6005396c89eee546.tar.gz rust-402cc350c12865e3e4a17c0f6005396c89eee546.zip | |
Monomorphize constants before inspecting them
(cherry picked from commit c7428d50520446ccd44ca89bbbf4ff7a4725570e)
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/constant.rs | 2 | ||||
| -rw-r--r-- | tests/ui/simd/shuffle.rs | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/constant.rs b/compiler/rustc_codegen_ssa/src/mir/constant.rs index 47a166e4e1b..babcf9bee24 100644 --- a/compiler/rustc_codegen_ssa/src/mir/constant.rs +++ b/compiler/rustc_codegen_ssa/src/mir/constant.rs @@ -65,7 +65,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { &self, constant: &mir::Constant<'tcx>, ) -> Result<Option<ty::ValTree<'tcx>>, ErrorHandled> { - let uv = match constant.literal { + let uv = match self.monomorphize(constant.literal) { mir::ConstantKind::Unevaluated(uv, _) => uv.shrink(), mir::ConstantKind::Ty(c) => match c.kind() { // A constant that came from a const generic but was then used as an argument to old-style diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs index de41c9e25dd..461243d4892 100644 --- a/tests/ui/simd/shuffle.rs +++ b/tests/ui/simd/shuffle.rs @@ -1,4 +1,7 @@ -//run-pass +// run-pass +// revisions: opt noopt +//[noopt] compile-flags: -Copt-level=0 +//[opt] compile-flags: -O #![feature(repr_simd, platform_intrinsics)] #![allow(incomplete_features)] #![feature(adt_const_params)] |
