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
6 changes: 5 additions & 1 deletion crates/rustc_codegen_nvvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,11 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
// Helper function to check if a value is 128-bit integer
fn is_i128(&self, val: &'ll Value) -> bool {
let ty = self.val_ty(val);
unsafe { llvm::LLVMGetIntTypeWidth(ty) == 128 }
if unsafe { llvm::LLVMRustGetTypeKind(ty) == llvm::TypeKind::Integer } {
unsafe { llvm::LLVMGetIntTypeWidth(ty) == 128 }
} else {
false
}
}

// Helper to split i128 into low and high u64 parts
Expand Down
5 changes: 4 additions & 1 deletion crates/rustc_codegen_nvvm/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ impl<'ll, 'tcx> BaseTypeCodegenMethods for CodegenCx<'ll, 'tcx> {
}

fn int_width(&self, ty: &'ll Type) -> u64 {
unsafe { llvm::LLVMGetIntTypeWidth(ty) as u64 }
match self.type_kind(ty) {
TypeKind::Integer => unsafe { llvm::LLVMGetIntTypeWidth(ty) as u64 },
_ => bug!("llvm_int_width called on a non-integer type"),
}
}

fn val_ty(&self, v: &'ll Value) -> &'ll Type {
Expand Down
Loading