about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index a484b594418..60e13d9b8c3 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -1525,6 +1525,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         other: &EvaluatedCandidate<'tcx>,
         needs_infer: bool,
     ) -> bool {
+        // HACK(eddyb) remove instruction-counting noise from `-Z self-profile`.
+        #[cfg(target_arch = "x86_64")]
+        unsafe {
+            std::arch::asm!("mfence", options(nostack));
+        }
+
         if victim.candidate == other.candidate {
             return true;
         }