]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_codegen_llvm/src/common.rs
Auto merge of #101307 - jyn514:simplify-storage, r=cjgillot
[rust.git] / compiler / rustc_codegen_llvm / src / common.rs
index 13e437cfbf7fb1b52d06589eb20c068ad140a131..acee9134fb96e48a26c3d4eb7a465c8d66ac6bf9 100644 (file)
@@ -215,7 +215,11 @@ fn const_struct(&self, elts: &[&'ll Value], packed: bool) -> &'ll Value {
     }
 
     fn const_to_opt_uint(&self, v: &'ll Value) -> Option<u64> {
-        try_as_const_integral(v).map(|v| unsafe { llvm::LLVMConstIntGetZExtValue(v) })
+        try_as_const_integral(v).and_then(|v| unsafe {
+            let mut i = 0u64;
+            let success = llvm::LLVMRustConstIntGetZExtValue(v, &mut i);
+            success.then_some(i)
+        })
     }
 
     fn const_to_opt_u128(&self, v: &'ll Value, sign_ext: bool) -> Option<u128> {
@@ -226,10 +230,6 @@ fn const_to_opt_u128(&self, v: &'ll Value, sign_ext: bool) -> Option<u128> {
         })
     }
 
-    fn zst_to_backend(&self, _llty: &'ll Type) -> &'ll Value {
-        self.const_undef(self.type_ix(0))
-    }
-
     fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: &'ll Type) -> &'ll Value {
         let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
         match cv {