Make inlining carry over unevaluated consts
This commit is contained in:
parent
db18b42343
commit
5313e2e929
@ -8,7 +8,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
|||||||
use rustc_middle::mir::visit::*;
|
use rustc_middle::mir::visit::*;
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::ty::subst::{Subst, SubstsRef};
|
use rustc_middle::ty::subst::{Subst, SubstsRef};
|
||||||
use rustc_middle::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
|
use rustc_middle::ty::{self, ConstKind, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
|
||||||
use rustc_session::config::Sanitizer;
|
use rustc_session::config::Sanitizer;
|
||||||
use rustc_target::spec::abi::Abi;
|
use rustc_target::spec::abi::Abi;
|
||||||
|
|
||||||
@ -123,6 +123,14 @@ impl Inliner<'tcx> {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Copy only unevaluated constants from the callee_body into the caller_body.
|
||||||
|
// Although we are only pushing `ConstKind::Unevaluated` consts to uneval_consts,
|
||||||
|
// here we may not only have `ConstKind::Unevaluated` because we are calling
|
||||||
|
// `subst_and_normalize_erasing_regions`.
|
||||||
|
caller_body.uneval_consts.extend(callee_body.uneval_consts.iter().copied().filter(
|
||||||
|
|&constant| matches!(constant.literal.val, ConstKind::Unevaluated(_, _, _)),
|
||||||
|
));
|
||||||
|
|
||||||
let start = caller_body.basic_blocks().len();
|
let start = caller_body.basic_blocks().len();
|
||||||
debug!("attempting to inline callsite {:?} - body={:?}", callsite, callee_body);
|
debug!("attempting to inline callsite {:?} - body={:?}", callsite, callee_body);
|
||||||
if !self.inline_call(callsite, caller_body, callee_body) {
|
if !self.inline_call(callsite, caller_body, callee_body) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user