Skip to content

Commit 6f64296

Browse files
Mathieu BorderéMathieu Borderé
Mathieu Borderé
authored and
Mathieu Borderé
committed
Merge branch 'master' into mb/36812_ICHFunctionInterfaces
2 parents 4b5a9a3 + 3210fd5 commit 6f64296

File tree

15 files changed

+650
-556
lines changed

15 files changed

+650
-556
lines changed

src/librustc_mir/build/expr/as_lvalue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
9696
ExprKind::LogicalOp { .. } |
9797
ExprKind::Box { .. } |
9898
ExprKind::Cast { .. } |
99+
ExprKind::Use { .. } |
99100
ExprKind::NeverToAny { .. } |
100101
ExprKind::ReifyFnPointer { .. } |
101102
ExprKind::UnsafeFnPointer { .. } |

src/librustc_mir/build/expr/as_rvalue.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
115115
let source = unpack!(block = this.as_operand(block, source));
116116
block.and(Rvalue::Cast(CastKind::Misc, source, expr.ty))
117117
}
118+
ExprKind::Use { source } => {
119+
let source = unpack!(block = this.as_operand(block, source));
120+
block.and(Rvalue::Use(source))
121+
}
118122
ExprKind::ReifyFnPointer { source } => {
119123
let source = unpack!(block = this.as_operand(block, source));
120124
block.and(Rvalue::Cast(CastKind::ReifyFnPointer, source, expr.ty))

src/librustc_mir/build/expr/category.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ impl Category {
6868
ExprKind::Binary { .. } |
6969
ExprKind::Box { .. } |
7070
ExprKind::Cast { .. } |
71+
ExprKind::Use { .. } |
7172
ExprKind::ReifyFnPointer { .. } |
7273
ExprKind::UnsafeFnPointer { .. } |
7374
ExprKind::Unsize { .. } |

src/librustc_mir/build/expr/into.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
249249
ExprKind::Binary { .. } |
250250
ExprKind::Box { .. } |
251251
ExprKind::Cast { .. } |
252+
ExprKind::Use { .. } |
252253
ExprKind::ReifyFnPointer { .. } |
253254
ExprKind::UnsafeFnPointer { .. } |
254255
ExprKind::Unsize { .. } |

src/librustc_mir/hair/cx/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
600600
// Check to see if this cast is a "coercion cast", where the cast is actually done
601601
// using a coercion (or is a no-op).
602602
if let Some(&TyCastKind::CoercionCast) = cx.tcx.cast_kinds.borrow().get(&source.id) {
603-
// Skip the actual cast itexpr, as it's now a no-op.
604-
return source.make_mirror(cx);
603+
// Convert the lexpr to a vexpr.
604+
ExprKind::Use { source: source.to_ref() }
605605
} else {
606606
ExprKind::Cast { source: source.to_ref() }
607607
}

src/librustc_mir/hair/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ pub enum ExprKind<'tcx> {
139139
Cast {
140140
source: ExprRef<'tcx>,
141141
},
142+
Use {
143+
source: ExprRef<'tcx>,
144+
}, // Use a lexpr to get a vexpr.
142145
NeverToAny {
143146
source: ExprRef<'tcx>,
144147
},

src/librustc_trans/base.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,16 @@ pub fn compare_scalar_types<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
308308
_ => bug!("compare_scalar_types: must be a comparison operator"),
309309
}
310310
}
311-
ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyBool | ty::TyUint(_) | ty::TyChar => {
311+
ty::TyBool => {
312+
// FIXME(#36856) -- using `from_immediate` forces these booleans into `i8`,
313+
// which works around some LLVM bugs
314+
ICmp(bcx,
315+
bin_op_to_icmp_predicate(op, false),
316+
from_immediate(bcx, lhs),
317+
from_immediate(bcx, rhs),
318+
debug_loc)
319+
}
320+
ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyUint(_) | ty::TyChar => {
312321
ICmp(bcx,
313322
bin_op_to_icmp_predicate(op, false),
314323
lhs,

0 commit comments

Comments
 (0)