about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-01 11:44:51 +0000
committerbors <bors@rust-lang.org>2020-06-01 11:44:51 +0000
commitd3cba254e464303a6495942f3a831c2bbd7f1768 (patch)
treeba8aeb9a651f83878b8e0fc48572d92501c6198d /src/librustc_codegen_ssa
parentb85e3fe010413b8c528d4de593d912a5ba024653 (diff)
parent0aa7f4d2f2ff55b8cfe5de5e4e7665a8fdeaf050 (diff)
Auto merge of #71192 - oli-obk:eager_alloc_id_canonicalization, r=wesleywiser
Make TLS accesses explicit in MIR

r? @rust-lang/wg-mir-opt

cc @RalfJung @vakaras for miri thread locals

cc @bjorn3 for cranelift

fixes #70685
Diffstat (limited to 'src/librustc_codegen_ssa')
-rw-r--r--src/librustc_codegen_ssa/mir/rvalue.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs
index bb532abd84b..57f72b1065d 100644
--- a/src/librustc_codegen_ssa/mir/rvalue.rs
+++ b/src/librustc_codegen_ssa/mir/rvalue.rs
@@ -522,6 +522,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 let operand = OperandRef { val: OperandValue::Immediate(val), layout: box_layout };
                 (bx, operand)
             }
+            mir::Rvalue::ThreadLocalRef(def_id) => {
+                assert!(bx.cx().tcx().is_static(def_id));
+                let static_ = bx.get_static(def_id);
+                let layout = bx.layout_of(bx.cx().tcx().static_ptr_ty(def_id));
+                let operand = OperandRef::from_immediate_or_packed_pair(&mut bx, static_, layout);
+                (bx, operand)
+            }
             mir::Rvalue::Use(ref operand) => {
                 let operand = self.codegen_operand(&mut bx, operand);
                 (bx, operand)
@@ -745,6 +752,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
             mir::Rvalue::UnaryOp(..) |
             mir::Rvalue::Discriminant(..) |
             mir::Rvalue::NullaryOp(..) |
+            mir::Rvalue::ThreadLocalRef(_) |
             mir::Rvalue::Use(..) => // (*)
                 true,
             mir::Rvalue::Repeat(..) |