Teach llvm backend how to fall back to default bodies
This commit is contained in:
parent
432635a9ea
commit
9a0743747f
11 changed files with 109 additions and 103 deletions
|
@ -296,9 +296,9 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
|||
if args.is_empty() {
|
||||
return;
|
||||
}
|
||||
let ty = args.type_at(0);
|
||||
|
||||
let known_is_valid = intrinsic_assert_panics(self.tcx, self.param_env, ty, intrinsic_name);
|
||||
let known_is_valid =
|
||||
intrinsic_assert_panics(self.tcx, self.param_env, args[0], intrinsic_name);
|
||||
match known_is_valid {
|
||||
// We don't know the layout or it's not validity assertion at all, don't touch it
|
||||
None => {}
|
||||
|
@ -317,10 +317,11 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
|||
fn intrinsic_assert_panics<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
arg: ty::GenericArg<'tcx>,
|
||||
intrinsic_name: Symbol,
|
||||
) -> Option<bool> {
|
||||
let requirement = ValidityRequirement::from_intrinsic(intrinsic_name)?;
|
||||
let ty = arg.expect_ty();
|
||||
Some(!tcx.check_validity_requirement((requirement, param_env.and(ty))).ok()?)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue