about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-07-28 13:44:11 +0200
committerRalf Jung <post@ralfj.de>2019-08-02 23:02:53 +0200
commite590b849b83dd97fe98a39971cd91b692a0cf2a8 (patch)
tree622391b54d6779c4065cbf9822956f0effd19ae4 /src/librustc_codegen_llvm
parentcf048cc115860cc110865f460f3f2b9b4308ad92 (diff)
downloadrust-e590b849b83dd97fe98a39971cd91b692a0cf2a8.tar.gz
rust-e590b849b83dd97fe98a39971cd91b692a0cf2a8.zip
CTFE: simplify Value type by not checking for alignment
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/common.rs4
-rw-r--r--src/librustc_codegen_llvm/consts.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs
index f00624f3811..19b051a4f38 100644
--- a/src/librustc_codegen_llvm/common.rs
+++ b/src/librustc_codegen_llvm/common.rs
@@ -11,7 +11,7 @@ use crate::value::Value;
 use rustc_codegen_ssa::traits::*;
 
 use crate::consts::const_alloc_to_llvm;
-use rustc::ty::layout::{HasDataLayout, LayoutOf, self, TyLayout, Size, Align};
+use rustc::ty::layout::{HasDataLayout, LayoutOf, self, TyLayout, Size};
 use rustc::mir::interpret::{Scalar, GlobalAlloc, Allocation};
 use rustc_codegen_ssa::mir::place::PlaceRef;
 
@@ -329,10 +329,10 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
     fn from_const_alloc(
         &self,
         layout: TyLayout<'tcx>,
-        align: Align,
         alloc: &Allocation,
         offset: Size,
     ) -> PlaceRef<'tcx, &'ll Value> {
+        let align = alloc.align; // follow what CTFE did, not what the layout says
         let init = const_alloc_to_llvm(self, alloc);
         let base_addr = self.static_addr_of(init, align, None);
 
diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs
index e02d14a151e..0077df3cf5e 100644
--- a/src/librustc_codegen_llvm/consts.rs
+++ b/src/librustc_codegen_llvm/consts.rs
@@ -72,8 +72,8 @@ pub fn codegen_static_initializer(
 
     let alloc = match static_.val {
         ConstValue::ByRef {
-            offset, align, alloc,
-        } if offset.bytes() == 0 && align == alloc.align => {
+            alloc, offset,
+        } if offset.bytes() == 0 => {
             alloc
         },
         _ => bug!("static const eval returned {:#?}", static_),