Remove useless parameter to operand_from_scalar.
This commit is contained in:
parent
d94ec3091e
commit
8179b2e5f8
1 changed files with 5 additions and 14 deletions
|
@ -458,11 +458,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
scalar,
|
scalar,
|
||||||
)) = *value
|
)) = *value
|
||||||
{
|
{
|
||||||
*operand = self.operand_from_scalar(
|
*operand = self.operand_from_scalar(scalar, value.layout.ty);
|
||||||
scalar,
|
|
||||||
value.layout.ty,
|
|
||||||
DUMMY_SP,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,9 +583,9 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `Operand::Constant` from a `Scalar` value
|
/// Creates a new `Operand::Constant` from a `Scalar` value
|
||||||
fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>, span: Span) -> Operand<'tcx> {
|
fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>) -> Operand<'tcx> {
|
||||||
Operand::Constant(Box::new(Constant {
|
Operand::Constant(Box::new(Constant {
|
||||||
span,
|
span: DUMMY_SP,
|
||||||
user_ty: None,
|
user_ty: None,
|
||||||
literal: ConstantKind::from_scalar(self.tcx, scalar, ty),
|
literal: ConstantKind::from_scalar(self.tcx, scalar, ty),
|
||||||
}))
|
}))
|
||||||
|
@ -634,8 +630,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
if let Some(Right(imm)) = imm {
|
if let Some(Right(imm)) = imm {
|
||||||
match *imm {
|
match *imm {
|
||||||
interpret::Immediate::Scalar(scalar) => {
|
interpret::Immediate::Scalar(scalar) => {
|
||||||
*rval =
|
*rval = Rvalue::Use(self.operand_from_scalar(scalar, value.layout.ty));
|
||||||
Rvalue::Use(self.operand_from_scalar(scalar, value.layout.ty, DUMMY_SP));
|
|
||||||
}
|
}
|
||||||
Immediate::ScalarPair(..) => {
|
Immediate::ScalarPair(..) => {
|
||||||
// Found a value represented as a pair. For now only do const-prop if the type
|
// Found a value represented as a pair. For now only do const-prop if the type
|
||||||
|
@ -933,11 +928,7 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> {
|
||||||
&& self.should_const_prop(value)
|
&& self.should_const_prop(value)
|
||||||
{
|
{
|
||||||
trace!("assertion on {:?} should be {:?}", value, expected);
|
trace!("assertion on {:?} should be {:?}", value, expected);
|
||||||
*cond = self.operand_from_scalar(
|
*cond = self.operand_from_scalar(value_const, self.tcx.types.bool);
|
||||||
value_const,
|
|
||||||
self.tcx.types.bool,
|
|
||||||
DUMMY_SP,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TerminatorKind::SwitchInt { ref mut discr, .. } => {
|
TerminatorKind::SwitchInt { ref mut discr, .. } => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue