CTFE: simplify Value type by not checking for alignment

This commit is contained in:
Ralf Jung 2019-07-28 13:44:11 +02:00
parent cf048cc115
commit e590b849b8
14 changed files with 50 additions and 59 deletions

View file

@ -109,8 +109,8 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
let b_llval = bx.const_usize((end - start) as u64);
OperandValue::Pair(a_llval, b_llval)
},
ConstValue::ByRef { offset, align, alloc } => {
return bx.load_operand(bx.from_const_alloc(layout, align, alloc, offset));
ConstValue::ByRef { alloc, offset } => {
return bx.load_operand(bx.from_const_alloc(layout, alloc, offset));
},
};

View file

@ -466,8 +466,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let layout = cx.layout_of(self.monomorphize(&ty));
match bx.tcx().const_eval(param_env.and(cid)) {
Ok(val) => match val.val {
mir::interpret::ConstValue::ByRef { offset, align, alloc } => {
bx.cx().from_const_alloc(layout, align, alloc, offset)
mir::interpret::ConstValue::ByRef { alloc, offset } => {
bx.cx().from_const_alloc(layout, alloc, offset)
}
_ => bug!("promoteds should have an allocation: {:?}", val),
},

View file

@ -35,7 +35,6 @@ pub trait ConstMethods<'tcx>: BackendTypes {
fn from_const_alloc(
&self,
layout: layout::TyLayout<'tcx>,
align: layout::Align,
alloc: &Allocation,
offset: layout::Size,
) -> PlaceRef<'tcx, Self::Value>;