Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions crates/rustc_codegen_spirv/src/builder/builder_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,13 +934,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
llptr,
align,
);
// WARN! This does not go through to_immediate due to only having a Scalar, not a Ty, but it still does
// whatever to_immediate does!
if scalar.is_bool() {
self.trunc(load, SpirvType::Bool.def(self.span(), self))
} else {
load
}
self.to_immediate_scalar(load, *scalar)
};

OperandValue::Pair(
Expand Down
12 changes: 1 addition & 11 deletions crates/rustc_codegen_spirv/src/codegen_cx/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ impl<'tcx> StaticMethods for CodegenCx<'tcx> {

fn codegen_static(&self, def_id: DefId, _is_mutable: bool) {
let g = self.get_static(def_id);
let span = self.tcx.def_span(def_id);

let alloc = match self.tcx.eval_static_initializer(def_id) {
Ok(alloc) => alloc,
Expand All @@ -277,16 +276,7 @@ impl<'tcx> StaticMethods for CodegenCx<'tcx> {
other.debug(g.ty, self)
)),
};
let mut v = self.create_const_alloc(alloc, value_ty);

if self.lookup_type(v.ty) == SpirvType::Bool {
let val_int = match self.builder.lookup_const(v).unwrap() {
SpirvConst::Bool(val) => val as u8,
_ => bug!(),
};
v = self.constant_u8(span, val_int);
}

let v = self.create_const_alloc(alloc, value_ty);
assert_ty_eq!(self, value_ty, v.ty);
self.builder
.set_global_initializer(g.def_cx(self), v.def_cx(self));
Expand Down