From 8f8c90e5b5b9d005999c18257f3844e92bc89eee Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Sat, 27 Jun 2020 14:03:32 +0200 Subject: [PATCH] Add comments and format the code --- src/librustc_codegen_llvm/builder.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 83cd0dbfcd47e..eed327d0bc156 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -479,11 +479,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let llptr = self.struct_gep(place.llval, i as u64); let load = self.load(llptr, align); scalar_load_metadata(self, load, scalar); - if scalar.is_bool() { - self.trunc(load, self.type_i1()) - } else { - load - } + if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load } }; OperandValue::Pair( @@ -658,6 +654,9 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> { + // WebAssembly has saturating floating point to integer casts if the + // `nontrapping-fptoint` target feature is activated. We'll use those if + // they are available. if self.sess().target.target.arch == "wasm32" && self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint) { @@ -680,6 +679,9 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> { + // WebAssembly has saturating floating point to integer casts if the + // `nontrapping-fptoint` target feature is activated. We'll use those if + // they are available. if self.sess().target.target.arch == "wasm32" && self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint) {