Skip to content

Commit b33cb65

Browse files
committed
Add more comments and link LLVM issue
1 parent 5718dda commit b33cb65

File tree

1 file changed

+6
-3
lines changed
  • compiler/rustc_codegen_ssa/src/mir

1 file changed

+6
-3
lines changed

compiler/rustc_codegen_ssa/src/mir/place.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,17 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
293293
}
294294

295295
let (niche_llty, tag) = match tag_scalar.primitive() {
296-
// Operations on u8/u16 directly result in some additional movzxs, pretend the tag
297-
// is cast_to type (usize) instead.
298-
// FIXUP this is very x86 specific assumption
296+
// Operations on u8/u16 directly result in some additional movzxs
297+
// (https://github.com/llvm/llvm-project/issues/58338), pretend the tag is
298+
// cast_to type (usize) instead.
299+
// FIXUP this is very x86-specific assumption
299300
Int(Integer::I8 | Integer::I16, _) => {
300301
(cast_to, bx.intcast(tag, cast_to, false))
301302
}
302303
_ => (niche_llty, tag),
303304
};
305+
// Thanks to the cast above, we can guarantee that all variant indexes fit in
306+
// niche_llty (as they're u32s).
304307

305308
let is_untagged = bx.icmp(
306309
IntPredicate::IntULT,

0 commit comments

Comments
 (0)