Hi,

This patch removes redundant memset and memcpy calls from libmpx.  Bootstrapped 
and tested w/ MPX on x86_64-unknown-linux-gnu.  Applied to trunk.

Thanks,
Ilya
--
libmpx/

2015-10-15  Ilya Enkovich  <enkovich....@gmail.com>

        PR other/66887
        * mpxrt/mpxrt.c (read_mpx_status_sig): Remove useless code.


diff --git a/libmpx/mpxrt/mpxrt.c b/libmpx/mpxrt/mpxrt.c
index 0eff87e..c29c5d9 100644
--- a/libmpx/mpxrt/mpxrt.c
+++ b/libmpx/mpxrt/mpxrt.c
@@ -152,13 +152,8 @@ xgetbv (uint32_t index)
 static uint64_t
 read_mpx_status_sig (ucontext_t *uctxt)
 {
-  uint8_t __attribute__ ((__aligned__ (64))) buffer[4096];
-  struct xsave_struct *xsave_buf = (struct xsave_struct *)buffer;
-
-  memset (buffer, 0, sizeof (buffer));
-  memcpy (buffer,
-         (uint8_t *)uctxt->uc_mcontext.fpregs + XSAVE_OFFSET_IN_FPMEM,
-         sizeof (struct xsave_struct));
+  uint8_t *regs = (uint8_t *)uctxt->uc_mcontext.fpregs + XSAVE_OFFSET_IN_FPMEM;
+  struct xsave_struct *xsave_buf = (struct xsave_struct *)regs;
   return xsave_buf->bndcsr.status_reg;
 }
 

Reply via email to